kopia lustrzana https://github.com/magicbug/Cloudlog
[User selectable columns] Added a fifth column, used only in logbook view. Also fixed a bug when adding user accounts.
rodzic
9692adc75a
commit
de5c65c121
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 69;
|
||||
$config['migration_version'] = 70;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -70,6 +70,7 @@ class User extends CI_Controller {
|
|||
$data['user_column2'] = $this->input->post('user_column2');
|
||||
$data['user_column3'] = $this->input->post('user_column3');
|
||||
$data['user_column4'] = $this->input->post('user_column4');
|
||||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$this->load->view('user/add', $data);
|
||||
} else {
|
||||
$this->load->view('user/add', $data);
|
||||
|
@ -95,7 +96,8 @@ class User extends CI_Controller {
|
|||
$this->input->post('user_column1'),
|
||||
$this->input->post('user_column2'),
|
||||
$this->input->post('user_column3'),
|
||||
$this->input->post('user_column4'))) {
|
||||
$this->input->post('user_column4'),
|
||||
$this->input->post('user_column5'))) {
|
||||
// Check for errors
|
||||
case EUSERNAMEEXISTS:
|
||||
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
|
||||
|
@ -131,6 +133,7 @@ class User extends CI_Controller {
|
|||
$data['user_column2'] = $this->input->post('user_column2');
|
||||
$data['user_column3'] = $this->input->post('user_column3');
|
||||
$data['user_column4'] = $this->input->post('user_column4');
|
||||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$this->load->view('user/add', $data);
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
@ -323,6 +326,12 @@ class User extends CI_Controller {
|
|||
$data['user_column4'] = $q->user_column4;
|
||||
}
|
||||
|
||||
if($this->input->post('user_column5')) {
|
||||
$data['user_column5'] = $this->input->post('user_column5', true);
|
||||
} else {
|
||||
$data['user_column5'] = $q->user_column5;
|
||||
}
|
||||
|
||||
$this->load->view('user/edit', $data);
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
@ -370,6 +379,8 @@ class User extends CI_Controller {
|
|||
$data['user_column2'] = $this->input->post('user_column2');
|
||||
$data['user_column3'] = $this->input->post('user_column3');
|
||||
$data['user_column4'] = $this->input->post('user_column4');
|
||||
$data['user_column4'] = $this->input->post('user_column4');
|
||||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$this->load->view('user/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
|
|
@ -7,3 +7,4 @@ $lang['account_column1_text'] = 'Choose column 1';
|
|||
$lang['account_column2_text'] = 'Choose column 2';
|
||||
$lang['account_column3_text'] = 'Choose column 3';
|
||||
$lang['account_column4_text'] = 'Choose column 4';
|
||||
$lang['account_column5_text'] = 'Choose column 5 (only for logbook)';
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This migration creates a table called options which will hold global options needed within cloudlog
|
||||
* removing the need for lots of configuration files.
|
||||
*/
|
||||
|
||||
class Migration_add_fifth_column extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'user_column5 varchar(32) default "Country"',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('users', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('users', 'user_column5');
|
||||
}
|
||||
}
|
|
@ -96,7 +96,9 @@ class User_Model extends CI_Model {
|
|||
|
||||
// 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, $user_show_notes) {
|
||||
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
|
||||
$measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes,
|
||||
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5) {
|
||||
// Check that the user isn't already used
|
||||
if(!$this->exists($username)) {
|
||||
$data = array(
|
||||
|
@ -118,6 +120,7 @@ class User_Model extends CI_Model {
|
|||
'user_column2' => xss_clean($user_column2),
|
||||
'user_column3' => xss_clean($user_column3),
|
||||
'user_column4' => xss_clean($user_column4),
|
||||
'user_column5' => xss_clean($user_column5),
|
||||
);
|
||||
|
||||
// Check the password is valid
|
||||
|
@ -165,6 +168,7 @@ class User_Model extends CI_Model {
|
|||
'user_column2' => xss_clean($fields['user_column2']),
|
||||
'user_column3' => xss_clean($fields['user_column3']),
|
||||
'user_column4' => xss_clean($fields['user_column4']),
|
||||
'user_column5' => xss_clean($fields['user_column5']),
|
||||
);
|
||||
|
||||
// Check to see if the user is allowed to change user levels
|
||||
|
@ -278,6 +282,7 @@ class User_Model extends CI_Model {
|
|||
'user_column2' => $u->row()->user_column2,
|
||||
'user_column3' => $u->row()->user_column3,
|
||||
'user_column4' => $u->row()->user_column4,
|
||||
'user_column5' => $u->row()->user_column5,
|
||||
);
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
|
|
|
@ -191,6 +191,21 @@
|
|||
<option value="State"><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
|
||||
<option value="Grid"><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="column5"><?php echo $this->lang->line('account_column5_text'); ?></label>
|
||||
<select class="custom-select" id="column5" name="user_column5">
|
||||
<option value="Band"> <?php echo $this->lang->line('gen_hamradio_band'); ?></option>
|
||||
<option value="Mode"> <?php echo $this->lang->line('gen_hamradio_mode'); ?></option>
|
||||
<option value="RSTS"><?php echo $this->lang->line('gen_hamradio_rsts'); ?></option>
|
||||
<option value="RSTR"><?php echo $this->lang->line('gen_hamradio_rstr'); ?></option>
|
||||
<option value="Country" selected ='selected'><?php echo $this->lang->line('general_word_country'); ?></option>
|
||||
<option value="IOTA"><?php echo $this->lang->line('gen_hamradio_iota'); ?></option>
|
||||
<option value="State"><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
|
||||
<option value="Grid"><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
|
|
|
@ -378,6 +378,19 @@
|
|||
<option value="Grid" <?php if ($user_column4 == "Grid") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="column5"><?php echo $this->lang->line('account_column5_text'); ?></label>
|
||||
<select class="custom-select" id="column5" name="user_column5">
|
||||
<option value="Band" <?php if ($user_column5 == "Band") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_band'); ?></option>
|
||||
<option value="Mode" <?php if ($user_column5 == "Mode") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_mode'); ?></option>
|
||||
<option value="RSTS" <?php if ($user_column5 == "RSTS") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_rsts'); ?></option>
|
||||
<option value="RSTR" <?php if ($user_column5 == "RSTR") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_rstr'); ?></option>
|
||||
<option value="Country" <?php if ($user_column5 == "Country") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_country'); ?></option>
|
||||
<option value="IOTA" <?php if ($user_column5 == "IOTA") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_iota'); ?></option>
|
||||
<option value="State" <?php if ($user_column5 == "State") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
|
||||
<option value="Grid" <?php if ($user_column5 == "Grid") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -55,9 +55,20 @@
|
|||
case 'Band': echo $this->lang->line('gen_hamradio_band'); break;
|
||||
}
|
||||
echo '</td>';
|
||||
?>
|
||||
<td><?php echo $this->lang->line('general_word_country'); ?></td>
|
||||
<?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
|
||||
echo '<td>';
|
||||
switch($this->session->userdata('user_column5')==""?'Country':$this->session->userdata('user_column5')) {
|
||||
case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break;
|
||||
case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break;
|
||||
case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break;
|
||||
case 'Country': echo $this->lang->line('general_word_country'); break;
|
||||
case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break;
|
||||
case 'State': echo $this->lang->line('gen_hamradio_state'); break;
|
||||
case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break;
|
||||
case 'Band': echo $this->lang->line('gen_hamradio_band'); break;
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
|
||||
<td>QSL</td>
|
||||
<?php if($this->session->userdata('user_eqsl_name') != "") { ?>
|
||||
<td>eQSL</td>
|
||||
|
|
Ładowanie…
Reference in New Issue