[Users] Adds more date formats for users to select
Added some more date-formats and added date-format-chooser into user-…
这个提交包含在:
当前提交
a2115a1690
共有 4 个文件被更改,包括 62 次插入 和 43 次删除
|
|
@ -62,7 +62,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'), $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'))) {
|
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'))) {
|
||||||
// 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!';
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ 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, $firstname, $lastname, $callsign, $locator, $timezone) {
|
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format) {
|
||||||
// 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(
|
||||||
|
|
@ -108,7 +108,9 @@ class User_Model extends CI_Model {
|
||||||
'user_lastname' => xss_clean($lastname),
|
'user_lastname' => xss_clean($lastname),
|
||||||
'user_callsign' => xss_clean($callsign),
|
'user_callsign' => xss_clean($callsign),
|
||||||
'user_locator' => xss_clean($locator),
|
'user_locator' => xss_clean($locator),
|
||||||
'user_timezone' => xss_clean($timezone)
|
'user_timezone' => xss_clean($timezone),
|
||||||
|
'user_measurement_base' => xss_clean($measurement),
|
||||||
|
'user_date_format' => xss_clean($user_date_format),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check the password is valid
|
// Check the password is valid
|
||||||
|
|
|
||||||
|
|
@ -19,68 +19,83 @@
|
||||||
|
|
||||||
<form method="post" action="<?php echo site_url('user/add'); ?>" name="users">
|
<form method="post" action="<?php echo site_url('user/add'); ?>" name="users">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Username</label>
|
<label>Username</label>
|
||||||
<input class="form-control" type="text" name="user_name" value="<?php if(isset($user_name)) { echo $user_name; } ?>" />
|
<input class="form-control" type="text" name="user_name" value="<?php if(isset($user_name)) { echo $user_name; } ?>" />
|
||||||
<?php if(isset($username_error)) { echo "<div class=\"small error\">".$username_error."</div>"; } ?>
|
<?php if(isset($username_error)) { echo "<div class=\"small error\">".$username_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>User Role</label>
|
<label>User Role</label>
|
||||||
<select class="custom-select" name="user_type">
|
<select class="custom-select" name="user_type">
|
||||||
<?php
|
<?php
|
||||||
|
$levels = $this->config->item('auth_level');
|
||||||
$levels = $this->config->item('auth_level');
|
while (list($key, $val) = each($levels)) {
|
||||||
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>
|
||||||
<option value="<?php echo $key; ?>" <?php if(isset($user_type)) { if($user_type == $key) { echo "selected=\"selected\""; } } ?>><?php echo $val; ?></option>
|
<?php } ?>
|
||||||
<?php } ?>
|
</select>
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Email Address</label>
|
<label>Email Address</label>
|
||||||
<input class="form-control" type="text" name="user_email" value="<?php if(isset($user_email)) { echo $user_email; } ?>" />
|
<input class="form-control" type="text" name="user_email" value="<?php if(isset($user_email)) { echo $user_email; } ?>" />
|
||||||
<?php if(isset($email_error)) { echo "<div class=\"small error\">".$email_error."</div>"; } ?>
|
<?php if(isset($email_error)) { echo "<div class=\"small error\">".$email_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Password</label>
|
<label>Password</label>
|
||||||
<input class="form-control" type="password" name="user_password" value="<?php if(isset($user_password)) { echo $user_password; } ?>" />
|
<input class="form-control" type="password" name="user_password" value="<?php if(isset($user_password)) { echo $user_password; } ?>" />
|
||||||
<?php if(isset($password_error)) { echo "<div class=\"small error\">".$password_error."</div>"; } ?>
|
<?php if(isset($password_error)) { echo "<div class=\"small error\">".$password_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>First Name</label>
|
<label>First Name</label>
|
||||||
<input class="form-control" type="text" name="user_firstname" value="<?php if(isset($user_firstname)) { echo $user_firstname; } ?>" />
|
<input class="form-control" type="text" name="user_firstname" value="<?php if(isset($user_firstname)) { echo $user_firstname; } ?>" />
|
||||||
<?php if(isset($firstname_error)) { echo "<div class=\"small error\">".$firstname_error."</div>"; } ?>
|
<?php if(isset($firstname_error)) { echo "<div class=\"small error\">".$firstname_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Last Name</label>
|
<label>Last Name</label>
|
||||||
<input class="form-control" type="text" name="user_lastname" value="<?php if(isset($user_lastname)) { echo $user_lastname; } ?>" />
|
<input class="form-control" 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>"; } ?>
|
<?php if(isset($lastname_error)) { echo "<div class=\"small error\">".$lastname_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Callsign</label>
|
<label>Callsign</label>
|
||||||
<input class="form-control" type="text" name="user_callsign" value="<?php if(isset($user_callsign)) { echo $user_callsign; } ?>" />
|
<input class="form-control" 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>"; } ?>
|
<?php if(isset($callsign_error)) { echo "<div class=\"small error\">".$callsign_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Locator</label>
|
<label>Locator</label>
|
||||||
<input class="form-control" type="text" name="user_locator" value="<?php if(isset($user_locator)) { echo $user_locator; } ?>" />
|
<input class="form-control" 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>"; } ?>
|
<?php if(isset($locator_error)) { echo "<div class=\"small error\">".$locator_error."</div>"; } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Timezone</label>
|
<label>Timezone</label>
|
||||||
<?php
|
<?php
|
||||||
if(!isset($user_timezone)) { $user_timezone = 0; }
|
if(!isset($user_timezone)) { $user_timezone = 0; }
|
||||||
echo form_dropdown('user_timezone', $timezones, $user_timezone);
|
echo form_dropdown('user_timezone', $timezones, $user_timezone);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="SelectDateFormat">Date Format</label>
|
||||||
|
<select name="user_date_format" class="custom-select" id="SelectDateFormat" aria-describedby="SelectDateFormatHelp">
|
||||||
|
<option value="">Select Format</option>
|
||||||
|
<option value="d/m/y"><?php echo date('d/m/y'); ?></option>
|
||||||
|
<option value="d/m/Y"><?php echo date('d/m/Y'); ?></option>
|
||||||
|
<option value="m/d/y"><?php echo date('m/d/y'); ?></option>
|
||||||
|
<option value="m/d/Y"><?php echo date('m/d/Y'); ?></option>
|
||||||
|
<option value="d.m.Y"><?php echo date('d.m.Y'); ?></option>
|
||||||
|
<option value="Y-m-d"><?php echo date('Y-m-d'); ?></option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<small id="SelectDateFormatHelp" class="form-text text-muted">Select how you would like dates shown when logged into your account.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="user_measurement_base">Measurement preference</label>
|
<label for="user_measurement_base">Measurement preference</label>
|
||||||
|
|
@ -93,11 +108,11 @@
|
||||||
<small id="user_measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
<small id="user_measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||||
<button type="submit" class="btn btn-primary">Create Account</button>
|
<button type="submit" class="btn btn-primary">Create Account</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,8 @@
|
||||||
<option value="d/m/Y" <?php if($user_date_format == "d/m/Y") { echo "selected=\"selected\""; } ?>><?php echo date('d/m/Y'); ?></option>
|
<option value="d/m/Y" <?php if($user_date_format == "d/m/Y") { echo "selected=\"selected\""; } ?>><?php echo date('d/m/Y'); ?></option>
|
||||||
<option value="m/d/y" <?php if($user_date_format == "m/d/y") { echo "selected=\"selected\""; } ?>><?php echo date('m/d/y'); ?></option>
|
<option value="m/d/y" <?php if($user_date_format == "m/d/y") { echo "selected=\"selected\""; } ?>><?php echo date('m/d/y'); ?></option>
|
||||||
<option value="m/d/Y" <?php if($user_date_format == "m/d/Y") { echo "selected=\"selected\""; } ?>><?php echo date('m/d/Y'); ?></option>
|
<option value="m/d/Y" <?php if($user_date_format == "m/d/Y") { echo "selected=\"selected\""; } ?>><?php echo date('m/d/Y'); ?></option>
|
||||||
|
<option value="d.m.Y" <?php if($user_date_format == "d.m.Y") { echo "selected=\"selected\""; } ?>><?php echo date('d.m.Y'); ?></option>
|
||||||
|
<option value="Y-m-d" <?php if($user_date_format == "Y-m-d") { echo "selected=\"selected\""; } ?>><?php echo date('Y-m-d'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<small id="SelectDateFormatHelp" class="form-text text-muted">Select how you would like dates shown when logged into your account.</small>
|
<small id="SelectDateFormatHelp" class="form-text text-muted">Select how you would like dates shown when logged into your account.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用