mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Switch to percent on QSL-View
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
<div class="container">
|
||||
<br />
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?= __("QSL Statistics"); ?>
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span><?= __("QSL Statistics"); ?></span>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<button type="button" class="btn btn-primary" id="qsl_abs" onclick="qslSetDisplay(false)"><?= __("Absolute"); ?></button>
|
||||
<button type="button" class="btn btn-outline-primary" id="qsl_pct" onclick="qslSetDisplay(true)"><?= __("Percent"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($qsoarray) {
|
||||
@@ -63,28 +67,30 @@
|
||||
$grandEqsl += $totals['eqsl'];
|
||||
$grandQrz += $totals['qrz'];
|
||||
$grandClublog += $totals['clublog'];
|
||||
$q = $totals['qso'] ?: 1;
|
||||
echo '<tr>
|
||||
<th>' . $mode . '</th>
|
||||
<td>' . $totals['qso'] . '</td>
|
||||
<td>' . $totals['qsl'] . '</td>
|
||||
<td>' . $totals['lotw'] . '</td>
|
||||
<td>' . $totals['eqsl'] . '</td>
|
||||
<td>' . $totals['qrz'] . '</td>
|
||||
<td>' . $totals['clublog'] . '</td>
|
||||
<td>' . $totals['qso'] . '</td>
|
||||
<td data-abs="' . $totals['qsl'] . '" data-pct="' . number_format($totals['qsl'] / $q * 100, 1) . '%">' . $totals['qsl'] . '</td>
|
||||
<td data-abs="' . $totals['lotw'] . '" data-pct="' . number_format($totals['lotw'] / $q * 100, 1) . '%">' . $totals['lotw'] . '</td>
|
||||
<td data-abs="' . $totals['eqsl'] . '" data-pct="' . number_format($totals['eqsl'] / $q * 100, 1) . '%">' . $totals['eqsl'] . '</td>
|
||||
<td data-abs="' . $totals['qrz'] . '" data-pct="' . number_format($totals['qrz'] / $q * 100, 1) . '%">' . $totals['qrz'] . '</td>
|
||||
<td data-abs="' . $totals['clublog'] . '" data-pct="' . number_format($totals['clublog'] / $q * 100, 1) . '%">' . $totals['clublog'] . '</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$gq = $grandQso ?: 1;
|
||||
echo '</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>' . __("Total") . '</th>
|
||||
<th>' . $grandQso . '</th>
|
||||
<th>' . $grandQsl . '</th>
|
||||
<th>' . $grandLotw . '</th>
|
||||
<th>' . $grandEqsl . '</th>
|
||||
<th>' . $grandQrz . '</th>
|
||||
<th>' . $grandClublog . '</th>
|
||||
<th>' . $grandQso . '</th>
|
||||
<th data-abs="' . $grandQsl . '" data-pct="' . number_format($grandQsl / $gq * 100, 1) . '%">' . $grandQsl . '</th>
|
||||
<th data-abs="' . $grandLotw . '" data-pct="' . number_format($grandLotw / $gq * 100, 1) . '%">' . $grandLotw . '</th>
|
||||
<th data-abs="' . $grandEqsl . '" data-pct="' . number_format($grandEqsl / $gq * 100, 1) . '%">' . $grandEqsl . '</th>
|
||||
<th data-abs="' . $grandQrz . '" data-pct="' . number_format($grandQrz / $gq * 100, 1) . '%">' . $grandQrz . '</th>
|
||||
<th data-abs="' . $grandClublog . '" data-pct="' . number_format($grandClublog / $gq * 100, 1) . '%">' . $grandClublog . '</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@@ -99,9 +105,9 @@
|
||||
<div class="table-wrapper">
|
||||
<table style="width: 100%" class="flex-wrap table-sm table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th colspan = 7>' . $band . '</th>';
|
||||
echo '</tr>
|
||||
echo '<tr>';
|
||||
echo '<th colspan = 7>' . $band . '</th>';
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
echo '<tr><th></th>';
|
||||
@@ -127,24 +133,26 @@
|
||||
$clublogtotal += $value[$band]['clublog'] ?? 0;
|
||||
$total = ($value[$band]['qso'] ?? 0) + ($value[$band]['qsl'] ?? 0) + ($value[$band]['lotw'] ?? 0) + ($value[$band]['eqsl'] ?? 0) + ($value[$band]['qrz'] ?? 0) + ($value[$band]['clublog'] ??0 );
|
||||
if ($total > 0) {
|
||||
$q = ($value[$band]['qso'] ?? 0) ?: 1;
|
||||
echo '<tr>
|
||||
<th>'. $mode .'</th>';
|
||||
echo '<td>' . $value[$band]['qso'] . '</td>';
|
||||
echo '<td>' . $value[$band]['qsl'] . '</td>';
|
||||
echo '<td>' . $value[$band]['lotw'] . '</td>';
|
||||
echo '<td>' . $value[$band]['eqsl'] . '</td>';
|
||||
echo '<td>' . $value[$band]['qrz'] . '</td>';
|
||||
echo '<td>' . $value[$band]['clublog'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$band]['qsl'] . '" data-pct="' . number_format(($value[$band]['qsl'] ?? 0) / $q * 100, 1) . '%">' . $value[$band]['qsl'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$band]['lotw'] . '" data-pct="' . number_format(($value[$band]['lotw'] ?? 0) / $q * 100, 1) . '%">' . $value[$band]['lotw'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$band]['eqsl'] . '" data-pct="' . number_format(($value[$band]['eqsl'] ?? 0) / $q * 100, 1) . '%">' . $value[$band]['eqsl'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$band]['qrz'] . '" data-pct="' . number_format(($value[$band]['qrz'] ?? 0) / $q * 100, 1) . '%">' . $value[$band]['qrz'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$band]['clublog'] . '" data-pct="' . number_format(($value[$band]['clublog'] ?? 0) / $q * 100, 1) . '%">' . $value[$band]['clublog'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
$bq = $qsototal ?: 1;
|
||||
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
|
||||
echo '<th>' . $qsototal . '</th>';
|
||||
echo '<th>' . $qsltotal . '</th>';
|
||||
echo '<th>' . $lotwtotal . '</th>';
|
||||
echo '<th>' . $eqsltotal . '</th>';
|
||||
echo '<th>' . $qrztotal . '</th>';
|
||||
echo '<th>' . $clublogtotal . '</th>';
|
||||
echo '<th data-abs="' . $qsltotal . '" data-pct="' . number_format($qsltotal / $bq * 100, 1) . '%">' . $qsltotal . '</th>';
|
||||
echo '<th data-abs="' . $lotwtotal . '" data-pct="' . number_format($lotwtotal / $bq * 100, 1) . '%">' . $lotwtotal . '</th>';
|
||||
echo '<th data-abs="' . $eqsltotal . '" data-pct="' . number_format($eqsltotal / $bq * 100, 1) . '%">' . $eqsltotal . '</th>';
|
||||
echo '<th data-abs="' . $qrztotal . '" data-pct="' . number_format($qrztotal / $bq * 100, 1) . '%">' . $qrztotal . '</th>';
|
||||
echo '<th data-abs="' . $clublogtotal . '" data-pct="' . number_format($clublogtotal / $bq * 100, 1) . '%">' . $clublogtotal . '</th>';
|
||||
echo '</tr></tfoot></table></div>';
|
||||
}
|
||||
}
|
||||
@@ -154,9 +162,9 @@
|
||||
<div class="table-wrapper">
|
||||
<table style="width: 100%" class="mx-2 flex-wrap table-sm table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th colspan = 7>' . $sat . '</th>';
|
||||
echo '</tr>
|
||||
echo '<tr>';
|
||||
echo '<th colspan = 7>' . $sat . '</th>';
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
echo '<tr><th></th>';
|
||||
@@ -182,24 +190,26 @@
|
||||
$clublogtotal += $value[$sat]['clublog'] ?? 0;
|
||||
$total = ($value[$sat]['qso'] ?? 0) + ($value[$sat]['qsl'] ?? 0) + ($value[$sat]['lotw'] ?? 0) + ($value[$sat]['eqsl'] ?? 0) + ($value[$sat]['qrz'] ?? 0) + ($value[$sat]['clublog'] ?? 0);
|
||||
if ($total > 0) {
|
||||
echo '<tr>
|
||||
<th>'. $mode .'</th>';
|
||||
$q = ($value[$sat]['qso'] ?? 0) ?: 1;
|
||||
echo '<tr>
|
||||
<th>'. $mode .'</th>';
|
||||
echo '<td>' . $value[$sat]['qso'] . '</td>';
|
||||
echo '<td>' . $value[$sat]['qsl'] . '</td>';
|
||||
echo '<td>' . $value[$sat]['lotw'] . '</td>';
|
||||
echo '<td>' . $value[$sat]['eqsl'] . '</td>';
|
||||
echo '<td>' . $value[$sat]['qrz'] . '</td>';
|
||||
echo '<td>' . $value[$sat]['clublog'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$sat]['qsl'] . '" data-pct="' . number_format(($value[$sat]['qsl'] ?? 0) / $q * 100, 1) . '%">' . $value[$sat]['qsl'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$sat]['lotw'] . '" data-pct="' . number_format(($value[$sat]['lotw'] ?? 0) / $q * 100, 1) . '%">' . $value[$sat]['lotw'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$sat]['eqsl'] . '" data-pct="' . number_format(($value[$sat]['eqsl'] ?? 0) / $q * 100, 1) . '%">' . $value[$sat]['eqsl'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$sat]['qrz'] . '" data-pct="' . number_format(($value[$sat]['qrz'] ?? 0) / $q * 100, 1) . '%">' . $value[$sat]['qrz'] . '</td>';
|
||||
echo '<td data-abs="' . $value[$sat]['clublog'] . '" data-pct="' . number_format(($value[$sat]['clublog'] ?? 0) / $q * 100, 1) . '%">' . $value[$sat]['clublog'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
$sq = $qsototal ?: 1;
|
||||
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
|
||||
echo '<th>' . $qsototal . '</th>';
|
||||
echo '<th>' . $qsltotal . '</th>';
|
||||
echo '<th>' . $lotwtotal . '</th>';
|
||||
echo '<th>' . $eqsltotal . '</th>';
|
||||
echo '<th>' . $qrztotal . '</th>';
|
||||
echo '<th>' . $clublogtotal . '</th>';
|
||||
echo '<th data-abs="' . $qsltotal . '" data-pct="' . number_format($qsltotal / $sq * 100, 1) . '%">' . $qsltotal . '</th>';
|
||||
echo '<th data-abs="' . $lotwtotal . '" data-pct="' . number_format($lotwtotal / $sq * 100, 1) . '%">' . $lotwtotal . '</th>';
|
||||
echo '<th data-abs="' . $eqsltotal . '" data-pct="' . number_format($eqsltotal / $sq * 100, 1) . '%">' . $eqsltotal . '</th>';
|
||||
echo '<th data-abs="' . $qrztotal . '" data-pct="' . number_format($qrztotal / $sq * 100, 1) . '%">' . $qrztotal . '</th>';
|
||||
echo '<th data-abs="' . $clublogtotal . '" data-pct="' . number_format($clublogtotal / $sq * 100, 1) . '%">' . $clublogtotal . '</th>';
|
||||
echo '</tr></tfoot></table></div>';
|
||||
}
|
||||
}
|
||||
@@ -207,3 +217,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function qslSetDisplay(pct) {
|
||||
document.querySelectorAll('[data-abs][data-pct]').forEach(function (cell) {
|
||||
cell.textContent = pct ? cell.dataset.pct : cell.dataset.abs;
|
||||
});
|
||||
document.getElementById('qsl_abs').className = pct ? 'btn btn-outline-primary' : 'btn btn-primary';
|
||||
document.getElementById('qsl_pct').className = pct ? 'btn btn-primary' : 'btn btn-outline-primary';
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user