Using custom date format in requests table

This commit is contained in:
Andreas Kristiansen
2025-07-22 08:11:46 +02:00
parent 6446c1ac13
commit e181471d1e
3 changed files with 18 additions and 24 deletions

View File

@@ -283,6 +283,15 @@ class Oqrs extends CI_Controller {
}
public function search() {
// Get Date format
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');
}
$this->load->model('oqrs_model');
$searchCriteria = array(
@@ -294,6 +303,11 @@ class Oqrs extends CI_Controller {
);
$qsos = $this->oqrs_model->searchOqrs($searchCriteria);
foreach ($qsos as &$qso) {
$qso['requesttime'] = date($custom_date_format . " H:i", strtotime($qso['requesttime']));
$qso['date'] = date($custom_date_format, strtotime($qso['date']));
$qso['time'] = date('H:i', strtotime($qso['time']));
}
header("Content-Type: application/json");
print json_encode($qsos);

View File

@@ -77,6 +77,7 @@ function echo_qsl_method($method) {
</div>
</form>
</div>
<table style="width:100%" class="table-sm oqrstable table table-striped table-bordered table-hover table-condensed text-center" id="qsoList">
<thead>
<tr>
@@ -97,26 +98,6 @@ function echo_qsl_method($method) {
</tr>
</thead>
<tbody>
<?php
/*foreach ($result as $qso) {
echo '<tr class="oqrsid_'.$qso->id.'" oqrsid="'.$qso->id.'">';
echo '<td><div class="form-check"><input class="form-check-input" type="checkbox" /></div></td>';
echo '<td>'. $qso->requesttime .'</td>';
echo '<td>'. $qso->date .'</td>';
echo '<td>'. $qso->time .'</td>';
echo '<td>'. $qso->band .'</td>';
echo '<td>'. $qso->mode .'</td>';
echo '<td>'. $qso->requestcallsign .'</td>';
echo '<td>'. $qso->station_callsign .'</td>';
echo '<td>'. $qso->email .'</td>';
echo '<td>'. $qso->note .'</td>';
echo '<td>'; echo_qsl_method($qso->qslroute); echo '</td>';
echo '<td><button class="btn btn-primary btn-sm" type="button" onclick="searchLog(\''. $qso->requestcallsign .'\');"><i class="fas fa-search"></i> Call</button>
<button class="btn btn-primary btn-sm" type="button" onclick="searchLogTimeDate(\''. $qso->id .'\');"><i class="fas fa-search"></i> Date/Time</button>
</td>';
echo '<td>'; echo_status($qso->status); echo '</td>';
echo '</tr>';
}*/
?>
</tbody>
</table>

View File

@@ -387,7 +387,7 @@ function loadOqrsTable(rows) {
uninitialized.each(function() {
$(this).DataTable({
searching: false,
searching: true,
responsive: false,
ordering: true,
createdRow: function (row, data, dataIndex) {
@@ -425,9 +425,8 @@ function loadOqrsTable(rows) {
qso.note,
echo_qsl_method(qso.qslroute),
echo_searchlog_button(qso.requestcallsign, qso.id),
echo_status(qso.status),
echo_status(qso.status),
];
data.id='oqrsID_' + qso.id;
let createdRow = table.row.add(data).index();
table.rows(createdRow).nodes().to$().data('oqrsID', qso.id);