From e8dc47773a4532fff5f437262918e503e2655e4e Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sun, 5 May 2024 14:56:11 +0200 Subject: [PATCH] option to show utc time in header menu --- application/controllers/User.php | 3 +++ application/views/interface_assets/header.php | 8 ++++++++ application/views/user/edit.php | 9 +++++++++ assets/js/sections/common.js | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/application/controllers/User.php b/application/controllers/User.php index 0c67da620..c344ca598 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -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'); diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 3fc91f4f0..591baefcf 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -467,6 +467,14 @@
  • ...
  • + user_options_model->get_options('header_menu', array('option_name' => 'utc_headermenu'))->row()->option_value ?? 'false'); + if ($utc_headermenu == 'true') { ?> + + + Show the Station Locations Quickswitch in the main menu + +
    + + + Show the current UTC Time in the menu +
    diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index 017745cfb..6b422c0cc 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -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" +