From bab2e1d5896c5f34a3fb47df6194e549092264ec Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 20 Jun 2023 13:39:39 +0200 Subject: [PATCH 1/3] Custom date format for LoTW badge in /logbook --- application/views/view_log/partial/log_ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index cb4ea12e6..900bad856 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -99,7 +99,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { COL_CALL)); ?> - callsign == '' ? '' : ' L'); ?> + lastupload); echo ($row->callsign == '' ? '' : ' L'); ?> Date: Tue, 20 Jun 2023 15:03:30 +0200 Subject: [PATCH 2/3] Show last LoTW upload as visual hint --- application/views/view_log/partial/log_ajax.php | 13 ++++++++++++- assets/css/general.css | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index 900bad856..57e298655 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -99,7 +99,18 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { COL_CALL)); ?> - lastupload); echo ($row->callsign == '' ? '' : ' L'); ?> + lastupload)) / 86400; + if ($diff > 365) { + $lotw_hint = ' lotw_info_red'; + } elseif ($diff > 30) { + $lotw_hint = ' lotw_info_orange'; + } elseif ($diff > 7) { + $lotw_hint = ' lotw_info_yellow'; + } + ?> + lastupload); echo ($row->callsign == '' ? '' : ' L'); ?> Date: Tue, 20 Jun 2023 21:39:16 +0200 Subject: [PATCH 3/3] Apply LoTW hint color to advanced logbook --- assets/js/sections/logbookadvanced.js | 4 ++-- src/QSLManager/QSO.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 58cb84821..984d5620a 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -26,7 +26,7 @@ function updateRow(qso) { let c = 1; cells.eq(c++).text(qso.qsoDateTime); cells.eq(c++).text(qso.de); - cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L')); + cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L')); cells.eq(c++).text(qso.mode); cells.eq(c++).text(qso.rstS); cells.eq(c++).text(qso.rstR); @@ -81,7 +81,7 @@ function loadQSOTable(rows) { data.push('
'); data.push(qso.qsoDateTime); data.push(qso.de); - data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L')); + data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L')); data.push(qso.mode); data.push(qso.rstS); data.push(qso.rstR); diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index a64bd4029..22033afe4 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -62,6 +62,7 @@ class QSO /** Lotw callsign info **/ private string $callsign; private string $lastupload; + private string $lotw_hint; /** * @param array $data Does no validation, it's assumed to be a row from the database in array format @@ -195,6 +196,19 @@ class QSO } $this->callsign = ($data['callsign'] === null) ? '' :$data['callsign']; $this->lastupload = ($data['lastupload'] === null) ? '' : date($custom_date_format . " H:i", strtotime($data['lastupload'])); + $lotw_hint = ''; + if ($data['lastupload'] !== null) { + $diff = time(); + $diff = (time() - strtotime($data['lastupload'])) / 86400; + if ($diff > 365) { + $lotw_hint = ' lotw_info_red'; + } elseif ($diff > 30) { + $lotw_hint = ' lotw_info_orange'; + } elseif ($diff > 7) { + $lotw_hint = ' lotw_info_yellow'; + } + } + $this->lotw_hint = $lotw_hint; } @@ -776,6 +790,7 @@ class QSO 'end' => $this->end === null ? null : $this->end->format("Y-m-d"), 'callsign' => $this->callsign, 'lastupload' => $this->lastupload, + 'lotw_hint' => $this->lotw_hint, ]; }