Skip to content

Commit 6fcecff

Browse files
committed
Add Optionhandling
1 parent 35b0cf8 commit 6fcecff

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

application/controllers/User.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ function add() {
238238
$data['user_pota_to_qso_tab'] = $this->input->post('user_pota_to_qso_tab');
239239
$data['user_sig_to_qso_tab'] = $this->input->post('user_sig_to_qso_tab');
240240
$data['user_dok_to_qso_tab'] = $this->input->post('user_dok_to_qso_tab');
241+
$data['user_station_to_qso_tab'] = $this->input->post('user_station_to_qso_tab');
241242
$data['user_language'] = $this->input->post('user_language');
242243
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text') ?? '';
243244
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
@@ -292,6 +293,7 @@ function add() {
292293
$this->input->post('user_pota_to_qso_tab'),
293294
$this->input->post('user_sig_to_qso_tab'),
294295
$this->input->post('user_dok_to_qso_tab'),
296+
$this->input->post('user_station_to_qso_tab'),
295297
$this->input->post('user_lotw_name'),
296298
$this->input->post('user_lotw_password'),
297299
$this->input->post('user_eqsl_name'),
@@ -811,6 +813,14 @@ function edit() {
811813
$data['user_dok_to_qso_tab'] = $qkey_opt[0]->option_value;
812814
}
813815
}
816+
if($this->input->post('user_station_to_qso_tab')) {
817+
$data['user_station_to_qso_tab'] = $this->input->post('user_station_to_qso_tab', false);
818+
} else {
819+
$qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'station','option_key'=>'show'), $this->uri->segment(3))->result();
820+
if (count($qkey_opt)>0) {
821+
$data['user_station_to_qso_tab'] = $qkey_opt[0]->option_value;
822+
}
823+
}
814824

815825
if($this->input->post('global_oqrs_text')) {
816826
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text', false);

application/models/User_model.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function add($username, $password, $email, $type, $firstname, $lastname, $callsi
221221
$user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url,
222222
$user_default_band, $user_default_confirmation, $user_qso_end_times, $user_qso_db_search_priority,$user_quicklog, $user_quicklog_enter,
223223
$user_language, $user_hamsat_key, $user_hamsat_workable_only, $user_iota_to_qso_tab, $user_sota_to_qso_tab,
224-
$user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab,
224+
$user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab, $user_station_to_qso_tab,
225225
$user_lotw_name, $user_lotw_password, $user_eqsl_name, $user_eqsl_password, $user_clublog_name, $user_clublog_password,
226226
$user_winkey, $on_air_widget_enabled, $on_air_widget_display_last_seen, $on_air_widget_show_only_most_recent_radio,
227227
$qso_widget_display_qso_time, $dashboard_banner, $dashboard_solar, $global_oqrs_text, $oqrs_grouped_search,
@@ -307,6 +307,7 @@ function add($username, $password, $email, $type, $firstname, $lastname, $callsi
307307
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','pota','show',".(xss_clean($user_pota_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
308308
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','sig','show',".(xss_clean($user_sig_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
309309
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','dok','show',".(xss_clean($user_dok_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
310+
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','station','show',".(xss_clean($user_station_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
310311
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_map','boolean','".xss_clean($dashboard_map ?? 'Y')."');");
311312
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_dashboard_banner','boolean','".xss_clean($dashboard_banner ?? 'Y')."');");
312313
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_dashboard_solar','boolean','".xss_clean($dashboard_solar ?? 'Y')."');");
@@ -380,6 +381,7 @@ function edit($fields) {
380381
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','pota','show',".(xss_clean($fields['user_pota_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
381382
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','sig','show',".(xss_clean($fields['user_sig_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
382383
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','dok','show',".(xss_clean($fields['user_dok_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
384+
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','station','show',".(xss_clean($fields['user_station_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
383385
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','enabled','".(xss_clean($fields['on_air_widget_enabled'] ?? 'false'))."');");
384386
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','display_last_seen','".(xss_clean($fields['on_air_widget_display_last_seen'] ?? 'false'))."');");
385387
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','display_only_most_recent_radio','".(xss_clean($fields['on_air_widget_show_only_most_recent_radio'] ?? 'true'))."');");

application/views/qso/index.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@
123123
<div class="card-body">
124124
<div class="tab-content" id="myTabContent">
125125
<div class="tab-pane fade show active" id="qso" role="tabpanel" aria-labelledby="qso-tab">
126+
127+
<?php if ($user_station_to_qso_tab ?? false) { ?>
128+
<div class="row">
129+
<div class="mb-3 col-md-12">
130+
<label class="col-sm-3 col-form-label" for="stationProfile"><?= __("Station Location"); ?></label>
131+
<select id="stationProfile" class="form-select form-control form-control-sm" name="station_profile" onChange="panMap(this.value);">
132+
<?php
133+
$power = '';
134+
foreach ($stations->result() as $stationrow) {
135+
?>
136+
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; $station_callsign = $stationrow->station_callsign; } ?>><?php echo $stationrow->station_profile_name; ?></option>
137+
<?php } ?>
138+
</select>
139+
</div>
140+
</div>
141+
<?php } ?>
142+
126143
<!-- HTML for Date/Time -->
127144
<?php if ($this->session->userdata('user_qso_end_times') == 1) { ?>
128145
<div class="row">
@@ -341,20 +358,6 @@
341358
</div>
342359
<?php } ?>
343360

344-
<?php if ($user_station_to_qso_tab ?? false) { ?>
345-
<div class="mb-3">
346-
<label for="stationProfile"><?= __("Station Location"); ?></label>
347-
<select id="stationProfile" class="form-select" name="station_profile" onChange="panMap(this.value);">
348-
<?php
349-
$power = '';
350-
foreach ($stations->result() as $stationrow) {
351-
?>
352-
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; $station_callsign = $stationrow->station_callsign; } ?>><?php echo $stationrow->station_profile_name; ?></option>
353-
<?php } ?>
354-
</select>
355-
</div>
356-
<?php } ?>
357-
358361
<div class="mb-3 row">
359362
<label for="qth" class="col-sm-3 col-form-label"><?= __("Location"); ?></label>
360363
<div class="col-sm-9">

application/views/user/edit.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@
713713
<input name="user_dok_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="dokToQsoTab" <?php if ($user_dok_to_qso_tab ?? false) { echo 'checked'; } ?>>
714714
<label class="form-check-label" for="dokToQsoTab" ><?= __("DOK"); ?></label>
715715
</div>
716+
<div class="form-check form-switch">
717+
<input name="user_station_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="stationToQsoTab" <?php if ($user_station_to_qso_tab ?? false) { echo 'checked'; } ?>>
718+
<label class="form-check-label" for="stationToQsoTab" ><?= __("Station Location"); ?></label>
719+
</div>
716720
</div>
717721
</div>
718722
<button type="button" onclick="clearRefSwitches();" class="btn btn-primary"><i class="fas fa-recycle"></i> <?= __("Reset"); ?></button>

0 commit comments

Comments
 (0)