From f13aa832543219ac8ec20c21982d4d6d6c54f7c5 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 27 Jun 2023 08:36:50 +0200 Subject: [PATCH] [Advanced Logbook] Added link to IOTA --- assets/js/sections/logbookadvanced.js | 2 +- src/QSLManager/QSO.php | 28 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 9e2a8057..70f026da 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -46,7 +46,7 @@ function updateRow(qso) { cells.eq(c++).text(qso.dxcc); cells.eq(c++).text(qso.state); cells.eq(c++).text(qso.cqzone); - cells.eq(c++).text(qso.iota); + cells.eq(c++).html(qso.iota); $('[data-toggle="tooltip"]').tooltip(); return row; diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 66b1e760..98a4a614 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -191,7 +191,7 @@ class QSO $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $data['COL_CQZ']; $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; $this->dxcc = ($data['name'] === null) ? '- NONE -' : ucwords(strtolower($data['name']), "- (/"); - $this->iota = ($data['COL_IOTA'] === null) ? '' :$data['COL_IOTA']; + $this->iota = ($data['COL_IOTA'] === null) ? '' : $this->getIotaLink($data['COL_IOTA']); if (array_key_exists('end', $data)) { $this->end = ($data['end'] === null) ? null : DateTime::createFromFormat("Y-m-d", $data['end'], new DateTimeZone('UTC')); } else { @@ -199,10 +199,18 @@ class QSO } $this->callsign = ($data['callsign'] === null) ? '' :$data['callsign']; $this->lastupload = ($data['lastupload'] === null) ? '' : date($custom_date_format . " H:i", strtotime($data['lastupload'])); + $this->lotw_hint = $this->getLotwHint($data['lastupload']); + } + + /** + * @return string + */ + function getLotwHint($lastupload): string + { $lotw_hint = ''; - if ($data['lastupload'] !== null) { + if ($lastupload !== null) { $diff = time(); - $diff = (time() - strtotime($data['lastupload'])) / 86400; + $diff = (time() - strtotime($lastupload)) / 86400; if ($diff > 365) { $lotw_hint = ' lotw_info_red'; } elseif ($diff > 30) { @@ -211,9 +219,9 @@ class QSO $lotw_hint = ' lotw_info_yellow'; } } - $this->lotw_hint = $lotw_hint; + return $lotw_hint; } - + /** * @return string */ @@ -940,7 +948,7 @@ class QSO return trim(implode(" ", $label)); } - private function getQrbLink($mygrid, $grid, $vucc) + private function getQrbLink($mygrid, $grid, $vucc) : string { if (!empty($grid)) { return ''; @@ -949,4 +957,12 @@ class QSO } return ''; } + + private function getIotaLink($iota) : string + { + if ($iota !== '') { + return '' . $iota . ''; + } + return ''; + } }