Merge pull request #341 from HB9HIL/utc_header

This commit is contained in:
HB9HIL
2024-05-05 17:02:09 +02:00
committed by GitHub
4 changed files with 38 additions and 0 deletions

View File

@@ -613,6 +613,7 @@ class User extends CI_Controller {
'qsoconfirm'=>array('0', 'fas fa-broadcast-tower', 'fas fa-user', 'fas fa-dot-circle', 'fas fa-check-circle' ));
$data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'))->row()->option_value ?? 'false');
$data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'))->row()->option_value ?? 'false');
$this->load->view('interface_assets/header', $data);
$this->load->view('user/edit', $data);
@@ -661,6 +662,7 @@ class User extends CI_Controller {
$this->user_options_model->del_option('map_custom','gridsquare');
}
$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->session->set_flashdata('success', lang('account_user').' '.$this->input->post('user_name', true).' '.lang('account_word_edited'));
redirect('user/edit/'.$this->uri->segment(3));
} else {
@@ -703,6 +705,7 @@ 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_locations_quickswitch'] = $this->input->post('user_locations_quickswitch', true);
$data['user_utc_headermenu'] = $this->input->post('user_utc_headermenu', true);
$data['language'] = $this->input->post('language');
$data['user_winkey'] = $this->input->post('user_winkey');
$data['user_hamsat_key'] = $this->input->post('user_hamsat_key');

View File

@@ -467,6 +467,14 @@
<li><a class="dropdown-item" href="<?php echo site_url('stationsetup'); ?>" title="Manage station locations"><?php echo lang('menu_station_setup'); ?>...</a></li>
</ul>
</li>
<?php
$utc_headermenu = ($this->user_options_model->get_options('header_menu', array('option_name' => 'utc_headermenu'))->row()->option_value ?? 'false');
if ($utc_headermenu == 'true') { ?>
<li class="nav-link disabled">
<a id="utc_header" style="width: 70px; display: inline-block;"></a>
</li>
<?php } ?>
<?php }
// Can add extra menu items by defining them in options. The format is json.

View File

@@ -457,6 +457,15 @@
</select>
<small id="SelectDateFormatHelp" class="form-text text-muted">Show the Station Locations Quickswitch in the main menu</small>
</div>
<div class="mb-3">
<label for="utc_headermenu">UTC Time in Menu</label>
<select class="form-select" id="utc_headermenu" name="user_utc_headermenu">
<option value="false" <?php if ($user_utc_headermenu == 'false') { echo " selected =\"selected\""; } ?>>Disabled</option>
<option value="true" <?php if ($user_utc_headermenu == 'true') { echo " selected =\"selected\""; } ?>>Enabled</option>
</select>
<small id="SelectDateFormatHelp" class="form-text text-muted">Show the current UTC Time in the menu</small>
</div>
<?php } ?>
</div>
</div>

View File

@@ -910,6 +910,24 @@ function set_active_loc_quickswitcher(new_active) {
});
}
$(document).ready(function() {
if ($('#utc_header').length > 0) {
function getCurrentUTCTime() {
var now = new Date();
var hours = now.getUTCHours().toString().padStart(2, '0');
var minutes = now.getUTCMinutes().toString().padStart(2, '0');
var seconds = now.getUTCSeconds().toString().padStart(2, '0');
return hours + ':' + minutes + ':' + seconds;
}
function updateUTCTime() {
$('#utc_header').text(getCurrentUTCTime() + 'z');
}
setInterval(updateUTCTime, 1000);
updateUTCTime();
}
});
console.log("Ready to unleash your coding prowess and join the fun?\n\n" +