Merge pull request #2219 from phl0/lotwBadgeGradient

Lotw badge gradient
pull/2224/head
Peter Goodhall 2023-06-21 22:18:25 +01:00 zatwierdzone przez GitHub
commit ef0c3e98ce
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 41 dodań i 3 usunięć

Wyświetl plik

@ -101,7 +101,18 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
<?php } ?> <?php } ?>
<td> <td>
<a id="edit_qso" href="javascript:displayQso(<?php echo $row->COL_PRIMARY_KEY; ?>)"><?php echo str_replace("0","&Oslash;",strtoupper($row->COL_CALL)); ?></a> <a id="edit_qso" href="javascript:displayQso(<?php echo $row->COL_PRIMARY_KEY; ?>)"><?php echo str_replace("0","&Oslash;",strtoupper($row->COL_CALL)); ?></a>
<?php echo ($row->callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' . $row->lastupload . '">L</small>'); ?> <?php
$lotw_hint = '';
$diff = (time() - strtotime($row->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';
}
?>
<?php $timestamp = strtotime($row->lastupload); echo ($row->callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success'.$lotw_hint.'" data-toggle="tooltip" data-original-title="LoTW User. Last upload was '.date($custom_date_format." H:i", $timestamp).'">L</small>'); ?>
</td> </td>
<?php <?php

Wyświetl plik

@ -441,3 +441,15 @@ div#station_logbooks_linked_table_paginate {
#lotw_manual_results { #lotw_manual_results {
padding-top: 10px; padding-top: 10px;
} }
.lotw_info_yellow {
background-image: linear-gradient(to bottom, #3fb618, yellow);
}
.lotw_info_orange {
background-image: linear-gradient(to bottom, #3fb618, orange);
}
.lotw_info_red {
background-image: linear-gradient(to bottom, #3fb618, red);
}

Wyświetl plik

@ -26,7 +26,7 @@ function updateRow(qso) {
let c = 1; let c = 1;
cells.eq(c++).text(qso.qsoDateTime); cells.eq(c++).text(qso.qsoDateTime);
cells.eq(c++).text(qso.de); cells.eq(c++).text(qso.de);
cells.eq(c++).html('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + '">L</small>')); cells.eq(c++).html('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success'+qso.lotw_hint+'" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + '">L</small>'));
cells.eq(c++).text(qso.mode); cells.eq(c++).text(qso.mode);
cells.eq(c++).text(qso.rstS); cells.eq(c++).text(qso.rstS);
cells.eq(c++).text(qso.rstR); cells.eq(c++).text(qso.rstR);
@ -81,7 +81,7 @@ function loadQSOTable(rows) {
data.push('<div class="form-check"><input class="form-check-input" type="checkbox" /></div>'); data.push('<div class="form-check"><input class="form-check-input" type="checkbox" /></div>');
data.push(qso.qsoDateTime); data.push(qso.qsoDateTime);
data.push(qso.de); data.push(qso.de);
data.push('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + ' ">L</small>')); data.push('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success'+qso.lotw_hint+'" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + ' ">L</small>'));
data.push(qso.mode); data.push(qso.mode);
data.push(qso.rstS); data.push(qso.rstS);
data.push(qso.rstR); data.push(qso.rstR);

Wyświetl plik

@ -62,6 +62,7 @@ class QSO
/** Lotw callsign info **/ /** Lotw callsign info **/
private string $callsign; private string $callsign;
private string $lastupload; 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 * @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->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']));
$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"), 'end' => $this->end === null ? null : $this->end->format("Y-m-d"),
'callsign' => $this->callsign, 'callsign' => $this->callsign,
'lastupload' => $this->lastupload, 'lastupload' => $this->lastupload,
'lotw_hint' => $this->lotw_hint,
]; ];
} }