Updated user/add to prompt for first name, last name, callsign and locator
这个提交包含在:
父节点
19774bf670
当前提交
5d2e890da0
共有 4 个文件被更改,包括 72 次插入 和 27 次删除
|
|
@ -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_email', 'E-mail', 'required');
|
||||||
$this->form_validation->set_rules('user_password', 'Password', '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_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)
|
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_email'] = $this->input->post('user_email');
|
||||||
$data['user_password'] = $this->input->post('user_password');
|
$data['user_password'] = $this->input->post('user_password');
|
||||||
$data['user_type'] = $this->input->post('user_type');
|
$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('user/add', $data);
|
||||||
} else {
|
} else {
|
||||||
$this->load->view('user/add');
|
$this->load->view('user/add');
|
||||||
|
|
@ -43,7 +51,7 @@ class User extends CI_Controller {
|
||||||
}
|
}
|
||||||
else
|
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
|
// Check for errors
|
||||||
case EUSERNAMEEXISTS:
|
case EUSERNAMEEXISTS:
|
||||||
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
|
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
|
||||||
|
|
@ -65,6 +73,10 @@ class User extends CI_Controller {
|
||||||
$data['user_email'] = $this->input->post('user_email');
|
$data['user_email'] = $this->input->post('user_email');
|
||||||
$data['user_password'] = $this->input->post('user_password');
|
$data['user_password'] = $this->input->post('user_password');
|
||||||
$data['user_type'] = $this->input->post('user_type');
|
$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('user/add', $data);
|
||||||
$this->load->view('layout/footer');
|
$this->load->view('layout/footer');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,18 @@ class User_Model extends CI_Model {
|
||||||
|
|
||||||
// FUNCTION: bool add($username, $password, $email, $type)
|
// FUNCTION: bool add($username, $password, $email, $type)
|
||||||
// Add a user
|
// 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
|
// Check that the user isn't already used
|
||||||
if(!$this->exists($username)) {
|
if(!$this->exists($username)) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'user_name' => $username,
|
'user_name' => $username,
|
||||||
'user_password' => $this->_hash($password),
|
'user_password' => $this->_hash($password),
|
||||||
'user_email' => $email,
|
'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
|
// Check the password is valid
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,20 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Level</td>
|
||||||
|
<td><select name="user_type">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$levels = $this->config->item('auth_level');
|
||||||
|
while (list($key, $val) = each($levels)) {
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $key; ?>" <?php if(isset($user_type)) { if($user_type == $key) { echo "selected=\"selected\""; } } ?>><?php echo $val; ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>E-mail</td>
|
<td>E-mail</td>
|
||||||
<td><input type="text" name="user_email" value="<?php if(isset($user_email)) { echo $user_email; } ?>" />
|
<td><input type="text" name="user_email" value="<?php if(isset($user_email)) { echo $user_email; } ?>" />
|
||||||
|
|
@ -32,18 +46,33 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Type</td>
|
<td>First name</td>
|
||||||
<td><select name="user_type">
|
<td><input type="text" name="user_firstname" value="<?php if(isset($user_firstname)) { echo $user_firstname; } ?>" />
|
||||||
<?php
|
<?php if(isset($firstname_error)) { echo "<div class=\"small error\">".$firstname_error."</div>"; } ?>
|
||||||
|
|
||||||
$levels = $this->config->item('auth_level');
|
|
||||||
while (list($key, $val) = each($levels)) {
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $key; ?>" <?php if(isset($user_type)) { if($user_type == $key) { echo "selected=\"selected\""; } } ?>><?php echo $val; ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Last name</td>
|
||||||
|
<td><input type="text" name="user_lastname" value="<?php if(isset($user_lastname)) { echo $user_lastname; } ?>" />
|
||||||
|
<?php if(isset($lastname_error)) { echo "<div class=\"small error\">".$lastname_error."</div>"; } ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Callsign</td>
|
||||||
|
<td><input type="text" name="user_callsign" value="<?php if(isset($user_callsign)) { echo $user_callsign; } ?>" />
|
||||||
|
<?php if(isset($callsign_error)) { echo "<div class=\"small error\">".$callsign_error."</div>"; } ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Locator</td>
|
||||||
|
<td><input type="text" name="user_locator" value="<?php if(isset($user_locator)) { echo $user_locator; } ?>" />
|
||||||
|
<?php if(isset($locator_error)) { echo "<div class=\"small error\">".$locator_error."</div>"; } ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||||
<div><input type="submit" value="Submit" /></div>
|
<div><input type="submit" value="Submit" /></div>
|
||||||
|
|
|
||||||
|
|
@ -46,20 +46,6 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Callsign</td>
|
|
||||||
<td><input type="text" name="user_callsign" value="<?php if(isset($user_callsign)) { echo $user_callsign; } ?>" />
|
|
||||||
<?php if(isset($callsign_error)) { echo "<div class=\"small error\">".$callsign_error."</div>"; } else { ?>
|
|
||||||
<?php } ?>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Locator</td>
|
|
||||||
<td><input type="text" name="user_locator" value="<?php if(isset($user_locator)) { echo $user_locator; } ?>" />
|
|
||||||
<?php if(isset($locator_error)) { echo "<div class=\"small error\">".$locator_error."</div>"; } else { ?>
|
|
||||||
<?php } ?>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>First name</td>
|
<td>First name</td>
|
||||||
<td><input type="text" name="user_firstname" value="<?php if(isset($user_firstname)) { echo $user_firstname; } ?>" />
|
<td><input type="text" name="user_firstname" value="<?php if(isset($user_firstname)) { echo $user_firstname; } ?>" />
|
||||||
|
|
@ -74,6 +60,20 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Callsign</td>
|
||||||
|
<td><input type="text" name="user_callsign" value="<?php if(isset($user_callsign)) { echo $user_callsign; } ?>" />
|
||||||
|
<?php if(isset($callsign_error)) { echo "<div class=\"small error\">".$callsign_error."</div>"; } else { ?>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Locator</td>
|
||||||
|
<td><input type="text" name="user_locator" value="<?php if(isset($user_locator)) { echo $user_locator; } ?>" />
|
||||||
|
<?php if(isset($locator_error)) { echo "<div class=\"small error\">".$locator_error."</div>"; } else { ?>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||||
<div><input type="submit" value="Update profile" /></div>
|
<div><input type="submit" value="Update profile" /></div>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用