Make SOTA switchable

This commit is contained in:
phl0
2024-03-22 07:57:31 +01:00
parent 3326883ff6
commit 7b31239245
5 changed files with 56 additions and 18 deletions

View File

@@ -40,6 +40,13 @@ class QSO extends CI_Controller {
$data['user_iota_to_qso_tab'] = 0;
}
$qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sota','option_key'=>'show'))->result();
if (count($qkey_opt)>0) {
$data['user_sota_to_qso_tab'] = $qkey_opt[0]->option_value;
} else {
$data['user_sota_to_qso_tab'] = 0;
}
$this->load->library('form_validation');
$this->form_validation->set_rules('start_date', 'Date', 'required');

View File

@@ -98,6 +98,7 @@ class User extends CI_Controller {
$data['user_hamsat_key'] = $this->input->post('user_hamsat_key');
$data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only');
$data['user_iota_to_qso_tab'] = $this->input->post('user_iota_to_qso_tab');
$data['user_sota_to_qso_tab'] = $this->input->post('user_sota_to_qso_tab');
$data['language'] = $this->input->post('language');
$this->load->view('user/edit', $data);
} else {
@@ -139,7 +140,8 @@ class User extends CI_Controller {
$this->input->post('language'),
$this->input->post('user_hamsat_key'),
$this->input->post('user_hamsat_workable_only'),
$this->input->post('user_iota_to_qso_tab')
$this->input->post('user_iota_to_qso_tab'),
$this->input->post('user_sota_to_qso_tab')
)) {
// Check for errors
case EUSERNAMEEXISTS:
@@ -526,6 +528,15 @@ class User extends CI_Controller {
}
}
if($this->input->post('user_sota_to_qso_tab')) {
$data['user_sota_to_qso_tab'] = $this->input->post('user_sota_to_qso_tab', false);
} else {
$qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sota','option_key'=>'show'))->result();
if (count($qkey_opt)>0) {
$data['user_sota_to_qso_tab'] = $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) {

View File

@@ -150,7 +150,7 @@ class User_Model extends CI_Model {
$user_pota_lookup, $user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5,
$user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url,
$user_default_band, $user_default_confirmation, $user_qso_end_times, $user_quicklog, $user_quicklog_enter,
$language, $user_hamsat_key, $user_hamsat_workable_only, $user_iota_to_qso_tab) {
$language, $user_hamsat_key, $user_hamsat_workable_only, $user_iota_to_qso_tab, $user_sota_to_qso_tab) {
// Check that the user isn't already used
if(!$this->exists($username)) {
$data = array(
@@ -211,6 +211,7 @@ class User_Model extends CI_Model {
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'hamsat','hamsat_key','api','".xss_clean($user_hamsat_key)."');");
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'hamsat','hamsat_key','workable','".xss_clean($user_hamsat_workable_only)."');");
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','iota','show',".(xss_clean($user_iota_to_qso_tab) == "on" ? 1 : 0).");");
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','sota','show',".(xss_clean($user_sota_to_qso_tab) == "on" ? 1 : 0).");");
return OK;
} else {
@@ -265,6 +266,7 @@ class User_Model extends CI_Model {
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');");
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','workable','".xss_clean($fields['user_hamsat_workable_only'])."');");
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','iota','show',".(xss_clean($fields['user_iota_to_qso_tab']) == "on" ? 1 : 0).");");
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','sota','show',".(xss_clean($fields['user_sota_to_qso_tab']) == "on" ? 1 : 0).");");
// Check to see if the user is allowed to change user levels
if($this->session->userdata('user_type') == 99) {

View File

@@ -190,21 +190,33 @@
</div>
</div>
<?php if ($user_iota_to_qso_tab) { ?>
<div class="mb-3 row">
<label class="col-sm-3 col-form-label" for="iota_ref"><?php echo lang('gen_hamradio_iota_reference'); ?></label>
<div class="col-sm-9">
<select class="form-select" id="iota_ref" name="iota_ref">
<option value =""></option>
<?php
foreach($iota as $i){
echo '<option value=' . $i->tag . '>' . $i->tag . ' - ' . $i->name . '</option>';
}
?>
</select>
</div>
</div>
<?php } ?>
<?php if ($user_iota_to_qso_tab) { ?>
<div class="mb-3 row">
<label class="col-sm-3 col-form-label" for="iota_ref"><?php echo lang('gen_hamradio_iota_reference'); ?></label>
<div class="col-sm-9 align-self-center">
<select class="form-select" id="iota_ref" name="iota_ref">
<option value =""></option>
<?php
foreach($iota as $i){
echo '<option value=' . $i->tag . '>' . $i->tag . ' - ' . $i->name . '</option>';
}
?>
</select>
</div>
</div>
<?php } ?>
<?php if ($user_sota_to_qso_tab) { ?>
<div class="mb-3 row">
<label class="col-sm-3 col-form-label" for="sota_ref"><?php echo lang('gen_hamradio_sota_reference'); ?></label>
<div class="col-sm-7 align-self-center">
<input class="form-control" id="sota_ref" type="text" name="sota_ref" value="" />
</div>
<div class="col-sm-2 align-self-center">
<small id="sota_info" class="btn btn-secondary spw-buttons"></small>
</div>
</div>
<?php } ?>
<div class="mb-3 row">
<label for="qth" class="col-sm-3 col-form-label"><?php echo lang('general_word_location'); ?></label>
@@ -388,6 +400,7 @@
</div>
<?php } ?>
<?php if (!$user_sota_to_qso_tab) { ?>
<div class="row">
<div class="mb-3 col-md-9">
<label for="sota_ref"><?php echo lang('gen_hamradio_sota_reference'); ?></label>
@@ -398,6 +411,7 @@
<small id="sota_info" class="btn btn-secondary spw-buttons"></small>
</div>
</div>
<?php } ?>
<div class="row">
<div class="mb-3 col-md-9">

View File

@@ -574,7 +574,11 @@
<label for="references_select"><?php echo lang('account_show_references_on_1st_tab'); ?></label>
<div class="form-check form-switch">
<input name="user_iota_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="iotaToQsoTab" <?php if ($user_iota_to_qso_tab) { echo 'checked'; } ?>>
<label class="form-check-label" for="iotaToQsoTab" ><?php echo lang('gen_hamradio_iota'); ?></label>
<label class="form-check-label" for="iotaToQsoTab" ><?php echo lang('gen_hamradio_iota_reference'); ?></label>
</div>
<div class="form-check form-switch">
<input name="user_sota_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="sotaToQsoTab" <?php if ($user_sota_to_qso_tab) { echo 'checked'; } ?>>
<label class="form-check-label" for="sotaToQsoTab" ><?php echo lang('gen_hamradio_sota_reference'); ?></label>
</div>
</div>
</div>