diff --git a/application/config/migration.php b/application/config/migration.php index 516bd52fe..7c48317f2 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ | be upgraded / downgraded to. | */ -$config['migration_version'] = 65; +$config['migration_version'] = 66; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/User.php b/application/controllers/User.php index cc4e68c7a..85bc1ce75 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -56,6 +56,7 @@ function add() { $data['user_measurement_base'] = $this->input->post('user_measurement_base'); $data['user_stylesheet'] = $this->input->post('user_stylesheet'); $data['user_sota_lookup'] = $this->input->post('user_sota_lookup'); + $data['user_show_notes'] = $this->input->post('user_show_notes'); $this->load->view('user/add', $data); } else { $this->load->view('user/add', $data); @@ -64,7 +65,7 @@ function add() { } else { - switch($this->user_model->add($this->input->post('user_name'), $this->input->post('user_password'), $this->input->post('user_email'), $this->input->post('user_type'), $this->input->post('user_firstname'), $this->input->post('user_lastname'), $this->input->post('user_callsign'), $this->input->post('user_locator'), $this->input->post('user_timezone'), $this->input->post('user_measurement_base'), $this->input->post('user_date_format'), $this->input->post('user_stylesheet'), $this->input->post('user_sota_lookup'))) { + switch($this->user_model->add($this->input->post('user_name'), $this->input->post('user_password'), $this->input->post('user_email'), $this->input->post('user_type'), $this->input->post('user_firstname'), $this->input->post('user_lastname'), $this->input->post('user_callsign'), $this->input->post('user_locator'), $this->input->post('user_timezone'), $this->input->post('user_measurement_base'), $this->input->post('user_date_format'), $this->input->post('user_stylesheet'), $this->input->post('user_sota_lookup'), $this->input->post('user_show_notes'))) { // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username '.$this->input->post('user_name').' already in use!'; @@ -95,6 +96,7 @@ function add() { $data['user_measurement_base'] = $this->input->post('user_measurement_base'); $data['user_stylesheet'] = $this->input->post('user_stylesheet'); $data['user_sota_lookup'] = $this->input->post('user_sota_lookup'); + $data['user_show_notes'] = $this->input->post('user_show_notes'); $this->load->view('user/add', $data); $this->load->view('interface_assets/footer'); } @@ -257,6 +259,12 @@ function edit() { $data['user_sota_lookup'] = $q->user_sota_lookup; } + if($this->input->post('user_show_notes')) { + $data['user_show_notes'] = $this->input->post('user_show_notes', true); + } else { + $data['user_show_notes'] = $q->user_show_notes; + } + $this->load->view('user/edit', $data); $this->load->view('interface_assets/footer'); } @@ -299,6 +307,7 @@ function edit() { $data['user_timezone'] = $this->input->post('user_timezone', true); $data['user_stylesheet'] = $this->input->post('user_stylesheet'); $data['user_sota_lookup'] = $this->input->post('user_sota_lookup'); + $data['user_show_notes'] = $this->input->post('user_show_notes'); $this->load->view('user/edit'); $this->load->view('interface_assets/footer'); } diff --git a/application/migrations/066_add_user_hide_notes.php b/application/migrations/066_add_user_hide_notes.php new file mode 100644 index 000000000..447be1226 --- /dev/null +++ b/application/migrations/066_add_user_hide_notes.php @@ -0,0 +1,25 @@ +dbforge->add_column('users', $fields); + } + + public function down() + { + $this->dbforge->drop_column('users', 'user_show_notes'); + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index f27e2f4f4..d2e23a09e 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -96,7 +96,7 @@ function exists_by_email($email) { // FUNCTION: bool add($username, $password, $email, $type) // Add a user - function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup) { + function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( @@ -113,6 +113,7 @@ function add($username, $password, $email, $type, $firstname, $lastname, $callsi 'user_date_format' => xss_clean($user_date_format), 'user_stylesheet' => xss_clean($user_stylesheet), 'user_sota_lookup' => xss_clean($user_sota_lookup), + 'user_show_notes' => xss_clean($user_show_notes), ); // Check the password is valid @@ -155,6 +156,7 @@ function edit($fields) { 'user_date_format' => xss_clean($fields['user_date_format']), 'user_stylesheet' => xss_clean($fields['user_stylesheet']), 'user_sota_lookup' => xss_clean($fields['user_sota_lookup']), + 'user_show_notes' => xss_clean($fields['user_show_notes']), ); // Check to see if the user is allowed to change user levels @@ -263,6 +265,7 @@ function update_session($id) { 'user_date_format' => $u->row()->user_date_format, 'user_stylesheet' => $u->row()->user_stylesheet, 'user_sota_lookup' => $u->row()->user_sota_lookup, + 'user_show_notes' => $u->row()->user_show_notes, ); $this->session->set_userdata($userdata); diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index d736259d6..b2f7dffef 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -73,8 +73,9 @@ + session->userdata('user_show_notes') == 1) { ?> Notes - +