From 2d86c70e53e1050492d835d8e8fca6123f6f068f Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 23 Jul 2021 19:26:10 +0200 Subject: [PATCH] [Date format] Fixed displaying of correct date format in qso widgets and in the previous contacts table in live/post qso. --- application/controllers/Logbook.php | 15 ++++++++- application/views/qso/index.php | 52 +++++++++++++++++++---------- application/views/widgets/qsos.php | 17 ++++++++-- 3 files changed, 62 insertions(+), 22 deletions(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 78ec6208..c764ce09 100755 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -471,10 +471,23 @@ class Logbook extends CI_Controller { $html .= "QSL"; $html .= ""; $html .= ""; + + // Get Date format + if($this->session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + foreach ($query->result() as $row) { + + $timestamp = strtotime($row->COL_TIME_ON); + $html .= ""; - $html .= "".date($this->config->item('qso_date_format').' H:i',strtotime($row->COL_TIME_ON)).""; + $html .= "".date($custom_date_format, $timestamp). date(' H:i',strtotime($row->COL_TIME_ON)) . ""; $html .= "".str_replace("0","Ø",strtoupper($row->COL_CALL)).""; $html .= "".$row->COL_RST_SENT.""; $html .= "".$row->COL_RST_RCVD.""; diff --git a/application/views/qso/index.php b/application/views/qso/index.php index c5edf529..43d7b694 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -1,13 +1,13 @@
- +
- +
-
+
- +
- +
@@ -456,12 +456,12 @@
- +
- +
@@ -513,10 +513,26 @@ lang->line('gen_hamradio_band'); ?> - result() as $row) { ?> - '; ?> - config->item('qso_date_format').' H:i',strtotime($row->COL_TIME_ON)); ?> + session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + $i = 0; + foreach ($query->result() as $row) { + echo ''; + echo ''; + $timestamp = strtotime($row->COL_TIME_ON); + echo date($custom_date_format, $timestamp); + echo date(' H:i',strtotime($row->COL_TIME_ON)); + ?> + COL_CALL)); ?> @@ -534,7 +550,7 @@
-
+ diff --git a/application/views/widgets/qsos.php b/application/views/widgets/qsos.php index cbf7653c..a31f72d6 100644 --- a/application/views/widgets/qsos.php +++ b/application/views/widgets/qsos.php @@ -23,10 +23,21 @@ Band - session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + $i = 0; foreach ($last_five_qsos->result() as $row) { ?> '; ?> - COL_TIME_ON); echo date('d/m/y', $timestamp); ?> + COL_TIME_ON); echo date($custom_date_format, $timestamp); ?> COL_TIME_ON); echo date('H:i', $timestamp); ?> COL_PRIMARY_KEY; ?>">COL_CALL)); ?> COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?> @@ -42,4 +53,4 @@ - \ No newline at end of file +