[OQRS] Move from global options to user options

This commit is contained in:
Andreas Kristiansen
2025-07-15 07:03:30 +02:00
parent 76779b95b6
commit 554a98e960
7 changed files with 135 additions and 111 deletions

View File

@@ -232,6 +232,9 @@ class User extends CI_Controller {
$data['user_sig_to_qso_tab'] = $this->input->post('user_sig_to_qso_tab');
$data['user_dok_to_qso_tab'] = $this->input->post('user_dok_to_qso_tab');
$data['user_language'] = $this->input->post('user_language');
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text') ?? '';
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name') ?? 'off';
$this->load->view('user/edit', $data);
} else {
$this->load->view('user/edit', $data);
@@ -291,8 +294,10 @@ class User extends CI_Controller {
$this->input->post('on_air_widget_show_only_most_recent_radio'),
$this->input->post('qso_widget_display_qso_time'),
$this->input->post('user_dashboard_banner') ?? 'Y',
$this->input->post('clubstation') == '1' ? true : false
)) {
$this->input->post('clubstation') == '1' ? true : false,
$this->input->post('global_oqrs_text'),
$this->input->post('oqrs_grouped_search') ?? 'off',
$this->input->post('oqrs_grouped_search_show_station_name') ?? 'off')) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = sprintf(__("Username %s already in use!"), '<b>' . $this->input->post('user_name') . '</b>');
@@ -344,6 +349,9 @@ class User extends CI_Controller {
$data['user_quicklog'] = $this->input->post('user_quicklog');
$data['user_quicklog_enter'] = $this->input->post('user_quicklog_enter');
$data['user_language'] = $this->input->post('user_language');
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text') ?? '';
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name') ?? 'off';
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer', $footerData);
}
@@ -626,7 +634,7 @@ class User extends CI_Controller {
}
if($this->input->post('user_default_confirmation')) {
$data['user_default_confirmation'] = ($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : '').($this->input->post('user_default_confirmation_qrz') !== null ? 'Z' : '').($this->input->post('user_default_confirmation_clublog') !== null ? 'C' : '');
$data['user_default_confirmation'] = ($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : '').($this->input->post('user_default_confirmation_qrz') !== null ? 'Z' : '').($this->input->post('user_default_confirmation_clublog') !== null ? 'C' : '');
} else {
$data['user_default_confirmation'] = $q->user_default_confirmation;
}
@@ -759,6 +767,33 @@ class User extends CI_Controller {
}
}
if($this->input->post('global_oqrs_text')) {
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text', false);
} else {
$qkey_opt = $this->user_options_model->get_options('oqrs',array('option_name'=>'global_oqrs_text','option_key'=>'text'), $this->uri->segment(3))->result();
if (count($qkey_opt) > 0) {
$data['global_oqrs_text'] = $qkey_opt[0]->option_value;
}
}
if($this->input->post('oqrs_grouped_search')) {
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search', false);
} else {
$qkey_opt = $this->user_options_model->get_options('oqrs',array('option_name'=>'oqrs_grouped_search','option_key'=>'boolean'), $this->uri->segment(3))->result();
if (count($qkey_opt) > 0) {
$data['oqrs_grouped_search'] = $qkey_opt[0]->option_value;
}
}
if($this->input->post('oqrs_grouped_search_show_station_name')) {
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name', false);
} else {
$qkey_opt = $this->user_options_model->get_options('oqrs',array('option_name'=>'oqrs_grouped_search_show_station_name','option_key'=>'boolean'), $this->uri->segment(3))->result();
if (count($qkey_opt) > 0) {
$data['oqrs_grouped_search_show_station_name'] = $qkey_opt[0]->option_value;
}
}
// [MAP Custom] GET user options //
$options_object = $this->user_options_model->get_options('map_custom')->result();
if (count($options_object)>0) {
@@ -850,6 +885,11 @@ class User extends CI_Controller {
}
$this->user_options_model->set_option('header_menu', 'locations_quickswitch', array('boolean'=>xss_clean($this->input->post('user_locations_quickswitch', true))));
$this->user_options_model->set_option('header_menu', 'utc_headermenu', array('boolean'=>xss_clean($this->input->post('user_utc_headermenu', true))));
$this->user_options_model->set_option('oqrs', 'global_oqrs_text', array('text'=>xss_clean($this->input->post('global_oqrs_text', true))));
$this->user_options_model->set_option('oqrs', 'oqrs_grouped_search', array('boolean'=>xss_clean($this->input->post('oqrs_grouped_search', true))));
$this->user_options_model->set_option('oqrs', 'oqrs_grouped_search_show_station_name', array('boolean'=>xss_clean($this->input->post('oqrs_grouped_search_show_station_name', true))));
$this->session->set_flashdata('success', sprintf(__("User %s edited"), $this->input->post('user_name', true)));
redirect('user/edit/'.$this->uri->segment(3));
} else {
@@ -902,6 +942,9 @@ class User extends CI_Controller {
$data['on_air_widget_display_last_seen'] = $this->input->post('on_air_widget_display_last_seen', true);
$data['on_air_widget_show_only_most_recent_radio'] = $this->input->post('on_air_widget_show_only_most_recent_radio', true);
$data['qso_widget_display_qso_time'] = $this->input->post('qso_widget_display_qso_time', true);
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text', true);
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search', true);
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name', true);
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
@@ -1403,7 +1446,7 @@ class User extends CI_Controller {
$grid = $this->input->post('locator', TRUE);
}
// Allow empty locator
if (preg_match('/^$/', $grid)) return true;
if (preg_match('/^$/', $grid ?? '')) return true;
$this->load->library('Qra');
if ($this->qra->validate_grid($grid)) {
return true;