Datatable usage for SOTA

This commit is contained in:
int2001
2025-07-06 12:23:50 +00:00
parent 9c7f8fdc04
commit 92701ee2d4
2 changed files with 66 additions and 12 deletions

View File

@@ -15,27 +15,36 @@
<!-- End of Award Info Box -->
<?php
if ($sota_all) {
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
$custom_date_format = $this->session->userdata('user_date_format');
} else {
// Get Default date format from /config/wavelog.php
$custom_date_format = $this->config->item('qso_date_format');
}
?>
<table class="table table-sm table-striped table-hover">
<table style="width: 100%" id="sotatable" class="potatable table table-sm table-striped table-hover">
<thead>
<tr>
<td><?= __("Reference"); ?></td>
<td><?= __("Date/Time"); ?></td>
<td><?= __("Callsign"); ?></td>
<td><?= __("Band"); ?></td>
<td><?= __("RST Sent"); ?></td>
<td><?= __("RST Received"); ?></td>
<th><?= __("Reference"); ?></th>
<th><?= __("Date"); ?></th>
<th><?= __("Time"); ?></th>
<th><?= __("Callsign"); ?></th>
<th><?= __("Band"); ?></th>
<th><?= __("RST Sent"); ?></th>
<th><?= __("RST Received"); ?></th>
</tr>
</thead>
<tbody>
<?php
if ($sota_all->num_rows() > 0) {
foreach ($sota_all->result() as $row) {
?>
<tr>
<td><a target="_blank" href="https://www.sotadata.org.uk/en/summit/<?php echo $row->COL_SOTA_REF; ?>"><?php echo $row->COL_SOTA_REF; ?></a></td>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - <?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
<td style="text-align: center"><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
<td style="text-align: center"><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
<td><?php echo $row->COL_CALL; ?></td>
<td><?php echo $row->COL_BAND; ?></td>
<td><?php echo $row->COL_RST_SENT; ?></td>
@@ -45,7 +54,7 @@
}
}
?>
</tbody>
</table>
<?php } else {
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';

View File

@@ -3132,6 +3132,51 @@ function viewEqsl(picture, callsign) {
$('[class*="buttons"]').css("color", "white");
}
</script>
<?php } else if ($this->uri->segment(2) == 'sota') { ?>
<script>
$.fn.dataTable.moment('<?php echo $usethisformat ?>');
$.fn.dataTable.ext.buttons.clear = {
className: 'buttons-clear',
action: function ( e, dt, node, config ) {
dt.search('').draw();
}
};
$('#sotatable').DataTable({
"pageLength": 25,
responsive: false,
ordering: true,
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
"language": {
url: getDataTablesLanguageUrl(),
},
"order": [ 0, 'asc' ],
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
className: 'mb-1 btn btn-primary', // Bootstrap classes
init: function(api, node, config) {
$(node).removeClass('dt-button').addClass('btn btn-primary'); // Ensure Bootstrap class applies
},
},
{
extend: 'clear',
className: 'mb-1 btn btn-primary', // Bootstrap classes
init: function(api, node, config) {
$(node).removeClass('dt-button').addClass('btn btn-primary'); // Ensure Bootstrap class applies
},
text: lang_admin_clear
}
]
});
// change color of csv-button if dark mode is chosen
if (isDarkModeTheme()) {
$('[class*="buttons"]').css("color", "white");
}
</script>
<?php } else if ($this->uri->segment(2) == "pota") { ?>
<script>
$.fn.dataTable.moment('<?php echo $usethisformat ?>');