diff --git a/application/controllers/user.php b/application/controllers/user.php index ac0b81b9..abe7eb63 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -25,6 +25,10 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_email', 'E-mail', 'required'); $this->form_validation->set_rules('user_password', 'Password', 'required'); $this->form_validation->set_rules('user_type', 'Type', 'required'); + $this->form_validation->set_rules('user_firstname', 'First name', 'required'); + $this->form_validation->set_rules('user_lastname', 'Last name', 'required'); + $this->form_validation->set_rules('user_callsign', 'Callsign', 'required'); + $this->form_validation->set_rules('user_locator', 'Locator', 'required'); if ($this->form_validation->run() == FALSE) { @@ -35,6 +39,10 @@ class User extends CI_Controller { $data['user_email'] = $this->input->post('user_email'); $data['user_password'] = $this->input->post('user_password'); $data['user_type'] = $this->input->post('user_type'); + $data['user_firstname'] = $this->input->post('user_firstname'); + $data['user_lastname'] = $this->input->post('user_lastname'); + $data['user_callsign'] = $this->input->post('user_callsign'); + $data['user_locator'] = $this->input->post('user_locator'); $this->load->view('user/add', $data); } else { $this->load->view('user/add'); @@ -43,7 +51,7 @@ class User extends CI_Controller { } 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'))) { + 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'))) { // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username '.$this->input->post('user_name').' already in use!'; @@ -65,6 +73,10 @@ class User extends CI_Controller { $data['user_email'] = $this->input->post('user_email'); $data['user_password'] = $this->input->post('user_password'); $data['user_type'] = $this->input->post('user_type'); + $data['user_firstname'] = $this->input->post('user_firstname'); + $data['user_lastname'] = $this->input->post('user_lastname'); + $data['user_callsign'] = $this->input->post('user_callsign'); + $data['user_locator'] = $this->input->post('user_locator'); $this->load->view('user/add', $data); $this->load->view('layout/footer'); } diff --git a/application/models/user_model.php b/application/models/user_model.php index 39982dca..29d940f3 100644 --- a/application/models/user_model.php +++ b/application/models/user_model.php @@ -74,14 +74,18 @@ class User_Model extends CI_Model { // FUNCTION: bool add($username, $password, $email, $type) // Add a user - function add($username, $password, $email, $type) { + function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( 'user_name' => $username, 'user_password' => $this->_hash($password), 'user_email' => $email, - 'user_type' => $type + 'user_type' => $type, + 'user_firstname' => $firstname, + 'user_lastname' => $lastname, + 'user_callsign' => $callsign, + 'user_locator' => $locator ); // Check the password is valid diff --git a/application/views/user/add.php b/application/views/user/add.php index 44a3f99a..dc891e22 100644 --- a/application/views/user/add.php +++ b/application/views/user/add.php @@ -17,6 +17,20 @@ + + Level + + + + E-mail @@ -32,18 +46,33 @@ - Type - + First name + + ".$firstname_error.""; } ?> + + + Last name + + ".$lastname_error.""; } ?> + + + + + Callsign + + ".$callsign_error.""; } ?> + + + + + Locator + + ".$locator_error.""; } ?> + + +
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 7d988438..885cbb2b 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -46,20 +46,6 @@ - - Callsign - - ".$callsign_error.""; } else { ?> - - - - - Locator - - ".$locator_error.""; } else { ?> - - - First name @@ -74,6 +60,20 @@ + + Callsign + + ".$callsign_error.""; } else { ?> + + + + + Locator + + ".$locator_error.""; } else { ?> + + +