Commented migscript, Added lang-choser to Useradd

pull/2361/head
int2001 2023-08-02 07:06:34 +00:00
rodzic 5d98554999
commit bca73b1295
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DFB1C13CD2DB037B
3 zmienionych plików z 21 dodań i 10 usunięć

Wyświetl plik

@ -32,6 +32,8 @@ class User extends CI_Controller {
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$data['existing_languages'] = $this->find();
$this->load->model('bands'); $this->load->model('bands');
$this->load->library('form_validation'); $this->load->library('form_validation');
@ -53,15 +55,14 @@ class User extends CI_Controller {
// Get timezones // Get timezones
$data['timezones'] = $this->user_model->timezones(); $data['timezones'] = $this->user_model->timezones();
$data['language'] = 'english';
if ($this->form_validation->run() == FALSE) if ($this->form_validation->run() == FALSE) {
{
$data['page_title'] = "Add User"; $data['page_title'] = "Add User";
$data['measurement_base'] = $this->config->item('measurement_base'); $data['measurement_base'] = $this->config->item('measurement_base');
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
if($this->input->post('user_name')) if($this->input->post('user_name')) {
{
$data['user_name'] = $this->input->post('user_name'); $data['user_name'] = $this->input->post('user_name');
$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');
@ -95,9 +96,7 @@ class User extends CI_Controller {
$this->load->view('user/add', $data); $this->load->view('user/add', $data);
} }
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} } else {
else
{
switch($this->user_model->add($this->input->post('user_name'), switch($this->user_model->add($this->input->post('user_name'),
$this->input->post('user_password'), $this->input->post('user_password'),
$this->input->post('user_email'), $this->input->post('user_email'),
@ -125,8 +124,9 @@ class User extends CI_Controller {
$this->input->post('user_amsat_status_upload'), $this->input->post('user_amsat_status_upload'),
$this->input->post('user_mastodon_url'), $this->input->post('user_mastodon_url'),
$this->input->post('user_gridmap_default_band'), $this->input->post('user_gridmap_default_band'),
($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''),
$this->input->post('language'), $this->input->post('language'),
($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''))) { )) {
// 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!';

Wyświetl plik

@ -3,8 +3,7 @@
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
/* /*
* This adds an option to enable grid and name lookup * This adds a field to user-table to hold/persist language-setting per user
* for WWFF references
*/ */
class Migration_add_user_language extends CI_Migration { class Migration_add_user_language extends CI_Migration {

Wyświetl plik

@ -190,6 +190,18 @@
</select> </select>
<small id="user_measurement_base_Help" class="form-text text-muted"><?php echo lang('account_choose_which_unit_distances_will_be_shown_in'); ?></small> <small id="user_measurement_base_Help" class="form-text text-muted"><?php echo lang('account_choose_which_unit_distances_will_be_shown_in'); ?></small>
</div> </div>
<?php if ($this->config->item('cl_multilanguage')) { ?>
<div class="form-group">
<label for="language">Cloudlog Language</label>
<?php
foreach($existing_languages as $lang){
$options[$lang] = ucfirst($lang);
}
echo form_dropdown('language', $options, $language);
?>
<small id="language_Help" class="form-text text-muted">Choose Cloudlog language.</small>
</div>
<?php } ?>
</div> </div>
</div> </div>