[Advanced Logbook] Added link to IOTA

这个提交包含在:
Andreas 2023-06-27 08:36:50 +02:00
父节点 3ef655f4b7
当前提交 f13aa83254
共有 2 个文件被更改,包括 23 次插入7 次删除

查看文件

@ -46,7 +46,7 @@ function updateRow(qso) {
cells.eq(c++).text(qso.dxcc); cells.eq(c++).text(qso.dxcc);
cells.eq(c++).text(qso.state); cells.eq(c++).text(qso.state);
cells.eq(c++).text(qso.cqzone); cells.eq(c++).text(qso.cqzone);
cells.eq(c++).text(qso.iota); cells.eq(c++).html(qso.iota);
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
return row; return row;

查看文件

@ -191,7 +191,7 @@ class QSO
$this->cqzone = ($data['COL_CQZ'] === null) ? '' : $data['COL_CQZ']; $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $data['COL_CQZ'];
$this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE'];
$this->dxcc = ($data['name'] === null) ? '- NONE -' : ucwords(strtolower($data['name']), "- (/"); $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)) { if (array_key_exists('end', $data)) {
$this->end = ($data['end'] === null) ? null : DateTime::createFromFormat("Y-m-d", $data['end'], new DateTimeZone('UTC')); $this->end = ($data['end'] === null) ? null : DateTime::createFromFormat("Y-m-d", $data['end'], new DateTimeZone('UTC'));
} else { } else {
@ -199,10 +199,18 @@ class QSO
} }
$this->callsign = ($data['callsign'] === null) ? '' :$data['callsign']; $this->callsign = ($data['callsign'] === null) ? '' :$data['callsign'];
$this->lastupload = ($data['lastupload'] === null) ? '' : date($custom_date_format . " H:i", strtotime($data['lastupload'])); $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 = ''; $lotw_hint = '';
if ($data['lastupload'] !== null) { if ($lastupload !== null) {
$diff = time(); $diff = time();
$diff = (time() - strtotime($data['lastupload'])) / 86400; $diff = (time() - strtotime($lastupload)) / 86400;
if ($diff > 365) { if ($diff > 365) {
$lotw_hint = ' lotw_info_red'; $lotw_hint = ' lotw_info_red';
} elseif ($diff > 30) { } elseif ($diff > 30) {
@ -211,7 +219,7 @@ class QSO
$lotw_hint = ' lotw_info_yellow'; $lotw_hint = ' lotw_info_yellow';
} }
} }
$this->lotw_hint = $lotw_hint; return $lotw_hint;
} }
/** /**
@ -940,7 +948,7 @@ class QSO
return trim(implode(" ", $label)); return trim(implode(" ", $label));
} }
private function getQrbLink($mygrid, $grid, $vucc) private function getQrbLink($mygrid, $grid, $vucc) : string
{ {
if (!empty($grid)) { if (!empty($grid)) {
return '<a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>'; return '<a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>';
@ -949,4 +957,12 @@ class QSO
} }
return ''; return '';
} }
private function getIotaLink($iota) : string
{
if ($iota !== '') {
return '<a href="https://www.iota-world.org/iotamaps/?grpref=' .$iota . '" target="_blank">' . $iota . '</a>';
}
return '';
}
} }