mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2999 from AndreasK79/lba_qso_duration
[Advanced Logbook] Added duration as a column
This commit is contained in:
@@ -161,7 +161,8 @@ class Logbookadvanced extends CI_Controller {
|
||||
'qrzReceived' => xss_clean($this->input->post('qrzReceived')),
|
||||
'distance' => xss_clean($this->input->post('distance')),
|
||||
'sortcolumn' => xss_clean($this->input->post('sortcolumn')),
|
||||
'sortdirection' => xss_clean($this->input->post('sortdirection'))
|
||||
'sortdirection' => xss_clean($this->input->post('sortdirection')),
|
||||
'duration' => xss_clean($this->input->post('duration'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -394,7 +395,8 @@ class Logbookadvanced extends CI_Controller {
|
||||
'ids' => json_decode(xss_clean($this->input->post('ids'))),
|
||||
'qsoids' => xss_clean($this->input->post('qsoids')),
|
||||
'sortcolumn' => 'qsotime',
|
||||
'sortdirection' => 'desc'
|
||||
'sortdirection' => 'desc',
|
||||
'duration' => '*'
|
||||
);
|
||||
|
||||
$result = $this->logbookadvanced_model->getSearchResultArray($searchCriteria);
|
||||
@@ -622,6 +624,7 @@ class Logbookadvanced extends CI_Controller {
|
||||
$json_string['frequency']['show'] = $this->def_boolean($this->input->post('frequency'));
|
||||
$json_string['dcl']['show'] = $this->def_boolean($this->input->post('dcl'));
|
||||
$json_string['last_modification']['show'] = $this->def_boolean($this->input->post('last_modification'));
|
||||
$json_string['duration']['show'] = $this->def_boolean($this->input->post('duration'));
|
||||
|
||||
$obj['column_settings']= json_encode($json_string);
|
||||
|
||||
|
||||
@@ -534,6 +534,11 @@ class Logbookadvanced_model extends CI_Model {
|
||||
$conditions[] = "coalesce(COL_DISTANCE, '') = ''";
|
||||
}
|
||||
|
||||
if ($searchCriteria['duration'] !== '*' && $searchCriteria['duration'] !== '') {
|
||||
$conditions[] = "TIMESTAMPDIFF(MINUTE, COL_TIME_ON, COL_TIME_OFF) >= ?";
|
||||
$binding[] = $searchCriteria['duration'];
|
||||
}
|
||||
|
||||
if (($searchCriteria['propmode'] ?? '') == 'None') {
|
||||
$conditions[] = "(trim(COL_PROP_MODE) = '' OR COL_PROP_MODE is null)";
|
||||
} elseif ($searchCriteria['propmode'] !== '') {
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
\"frequency\":{\"show\":\"true\"},
|
||||
\"dcl\":{\"show\":\"true\"},
|
||||
\"last_modification\":{\"show\":\"false\"},
|
||||
\"duration\":{\"show\":\"false\"},
|
||||
}";
|
||||
}
|
||||
$current_opts = json_decode($options);
|
||||
@@ -240,6 +241,10 @@
|
||||
echo "\nvar o_template = { last_modification: {show: 'false'}};";
|
||||
echo "\nuser_options={...user_options, ...o_template};";
|
||||
}
|
||||
if (!isset($current_opts->duration)) {
|
||||
echo "\nvar o_template = { duration: {show: 'false'}};";
|
||||
echo "\nuser_options={...user_options, ...o_template};";
|
||||
}
|
||||
|
||||
foreach ($mapoptions as $mo) {
|
||||
if ($mo != null) {
|
||||
@@ -506,6 +511,10 @@ $options = json_decode($options);
|
||||
<div <?php if (($options->distance->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
|
||||
<label class="form-label" for="distance"><?= __("Distance"); ?> <i class="fa fa-question-circle" aria-hidden="true" data-bs-toggle="tooltip" title="<?= __("Distance in kilometers. Search will look for distances greater than or equal to this value."); ?>"></i></label>
|
||||
<input onclick="this.select()" type="text" name="distance" class="form-control form-control-sm border border-secondary" value="*" placeholder="<?= __("Empty"); ?>">
|
||||
</div>
|
||||
<div <?php if (($options->duration->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
|
||||
<label class="form-label" for="duration"><?= __("Duration"); ?> <i class="fa fa-question-circle" aria-hidden="true" data-bs-toggle="tooltip" title="<?= __("Duration in minutes. Search will look for durations greater than or equal to this value."); ?>"></i></label>
|
||||
<input onclick="this.select()" type="text" name="duration" class="form-control form-control-sm border border-secondary" value="*" placeholder="<?= __("Empty"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -892,6 +901,9 @@ $options = json_decode($options);
|
||||
</th>
|
||||
<?php if (($options->datetime->show ?? "true") == "true") {
|
||||
echo '<th>' . __("Date/Time") . '</th>';
|
||||
} ?>
|
||||
<?php if (($options->duration->show ?? "false") == "true") {
|
||||
echo '<th>' . __("Duration") . '</th>';
|
||||
} ?>
|
||||
<?php if (($options->last_modification->show ?? "false") == "true") {
|
||||
echo '<th>' . __("Last modified") . '</th>';
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
<label class="form-check-label" for="datetime"><?= __("Date/Time"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" name="duration" type="checkbox" id="duration" <?php if (($options->duration->show ?? "false") == "true") { echo 'checked'; } ?>>
|
||||
<label class="form-check-label" for="duration"><?= __("Duration"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" name="de" type="checkbox" id="de" <?php if (($options->de->show ?? "true") == "true") { echo 'checked'; } ?>>
|
||||
|
||||
@@ -63,6 +63,9 @@ function updateRow(qso) {
|
||||
if ((user_options.datetime.show ?? 'true') == "true"){
|
||||
cells.eq(c++).text(qso.qsoDateTime);
|
||||
}
|
||||
if ((user_options.duration.show ?? 'true') == "true"){
|
||||
cells.eq(c++).text(qso.duration);
|
||||
}
|
||||
if ((user_options.last_modification.show ?? 'true') == "true"){
|
||||
cells.eq(c++).text(qso.last_modified);
|
||||
}
|
||||
@@ -283,6 +286,9 @@ function loadQSOTable(rows) {
|
||||
data.push(qso.qsoDateTime);
|
||||
}
|
||||
}
|
||||
if ((user_options.duration.show ?? 'true') == "true"){
|
||||
data.push(qso.duration);
|
||||
}
|
||||
if ((user_options.last_modification.show ?? 'true') == "true"){
|
||||
data.push(qso.last_modified);
|
||||
}
|
||||
@@ -765,7 +771,8 @@ $(document).ready(function () {
|
||||
qrzReceived: this.qrzReceived.value,
|
||||
distance: this.distance.value,
|
||||
sortcolumn: this.sortcolumn.value,
|
||||
sortdirection: this.sortdirection.value
|
||||
sortdirection: this.sortdirection.value,
|
||||
duration: this.duration.value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
@@ -1816,6 +1823,7 @@ function saveOptions() {
|
||||
type: 'post',
|
||||
data: {
|
||||
datetime: $('input[name="datetime"]').is(':checked') ? true : false,
|
||||
duration: $('input[name="duration"]').is(':checked') ? true : false,
|
||||
last_modification: $('input[name="last_modification"]').is(':checked') ? true : false,
|
||||
de: $('input[name="de"]').is(':checked') ? true : false,
|
||||
dx: $('input[name="dx"]').is(':checked') ? true : false,
|
||||
|
||||
@@ -551,7 +551,8 @@ function getFormData(form) {
|
||||
qrzReceived: form.qrzReceived.value,
|
||||
distance: form.distance.value,
|
||||
sortcolumn: form.sortcolumn.value,
|
||||
sortdirection: form.sortdirection.value
|
||||
sortdirection: form.sortdirection.value,
|
||||
duration: form.duration.value
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ class QSO
|
||||
{
|
||||
private string $qsoID;
|
||||
private string $qsoDateTime;
|
||||
private string $duration;
|
||||
private string $de;
|
||||
private string $profilename;
|
||||
private string $dx;
|
||||
@@ -303,8 +304,19 @@ class QSO
|
||||
|
||||
$this->measurement_base = $measurement_base;
|
||||
|
||||
$this->duration = $this->calculateDuration($data['COL_TIME_ON'], $data['COL_TIME_OFF']);
|
||||
|
||||
}
|
||||
|
||||
function calculateDuration($start, $end) {
|
||||
if ($start == null || $end == null) {
|
||||
return '';
|
||||
}
|
||||
$start = new DateTime($start);
|
||||
$end = new DateTime($end);
|
||||
$interval = $end->diff($start);
|
||||
return $interval->format('%H:%I:%S');
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -1310,6 +1322,7 @@ class QSO
|
||||
'qth' => $this->qth,
|
||||
'frequency' => $this->getFormattedFrequency(),
|
||||
'last_modified' => $this->last_modified,
|
||||
'duration' => $this->duration
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user