mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Function to show distance records per SAT
This commit is contained in:
@@ -33,6 +33,10 @@ class Distancerecords extends CI_Controller {
|
||||
case 'M d, y': $usethisformat = 'MMM D, YY';break;
|
||||
}
|
||||
|
||||
$data['scripts'] = [
|
||||
'assets/js/sections/distancerecords.js',
|
||||
];
|
||||
|
||||
// Render Page
|
||||
$data['custom_date_format'] = $custom_date_format;
|
||||
$data['page_title'] = __("Satellite Distance Records");
|
||||
@@ -45,4 +49,17 @@ class Distancerecords extends CI_Controller {
|
||||
$this->load->view('interface_assets/footer', $footerData);
|
||||
}
|
||||
|
||||
public function sat_records_ajax() {
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat")));
|
||||
$searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode'));
|
||||
$data['results'] = $this->logbook_model->sat_distances($sat);
|
||||
|
||||
$data['page_title'] = __("Log View")." - " . __("Satellite Distance Records");
|
||||
$data['filter'] = $sat;
|
||||
|
||||
$this->load->view('distancerecords/details', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -419,6 +419,18 @@ class Logbook_model extends CI_Model {
|
||||
return($row);
|
||||
}
|
||||
}
|
||||
public function sat_distances($sat){
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->where('COL_SAT_NAME', $sat);
|
||||
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
|
||||
$this->db->order_by("COL_DISTANCE", "desc");
|
||||
$this->db->limit(500);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
/*
|
||||
* Used to fetch QSOs from the logbook in the awards
|
||||
*/
|
||||
|
||||
3
application/views/distancerecords/details.php
Normal file
3
application/views/distancerecords/details.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<h5><?= __("Filtering on"); ?> <?php echo $filter; ?></h5>
|
||||
|
||||
<?php $this->load->view('view_log/partial/log_ajax'); ?>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center"><?php echo $i; ?></td>
|
||||
<td style="text-align: center"><?php echo $row->sat; ?></td>
|
||||
<td style="text-align: center"><a href="javascript:displayDistanceQsos('<?php echo $row->sat; ?>')"><?php echo $row->sat; ?></a></td>
|
||||
<td style="text-align: right"><?php printf("%.01f", floatval($row->distance)); ?></td>
|
||||
<td style="text-align: center"><?php $timestamp = strtotime($row->time ?? ''); echo date($custom_date_format, $timestamp); ?></td>
|
||||
<td style="text-align: center"><?php $timestamp = strtotime($row->time ?? ''); echo date('H:i', $timestamp); ?></td>
|
||||
|
||||
62
assets/js/sections/distancerecords.js
Normal file
62
assets/js/sections/distancerecords.js
Normal file
@@ -0,0 +1,62 @@
|
||||
var modalloading=false;
|
||||
function displayDistanceQsos(sat) {
|
||||
if (!(modalloading)) {
|
||||
var ajax_data = ({
|
||||
'Sat': sat,
|
||||
})
|
||||
modalloading=true;
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/distancerecords/sat_records_ajax',
|
||||
type: 'post',
|
||||
data: ajax_data,
|
||||
success: function (html) {
|
||||
var dialog = new BootstrapDialog({
|
||||
title: lang_general_word_qso_data,
|
||||
cssClass: 'qso-dialog',
|
||||
size: BootstrapDialog.SIZE_WIDE,
|
||||
nl2br: false,
|
||||
message: html,
|
||||
onshown: function(dialog) {
|
||||
modalloading=false;
|
||||
$('[data-bs-toggle="tooltip"]').tooltip();
|
||||
$('.contacttable').DataTable({
|
||||
"pageLength": 25,
|
||||
responsive: false,
|
||||
ordering: false,
|
||||
"scrollY": "550px",
|
||||
"scrollCollapse": true,
|
||||
"paging": false,
|
||||
"scrollX": true,
|
||||
"language": {
|
||||
url: getDataTablesLanguageUrl(),
|
||||
},
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'csv'
|
||||
]
|
||||
});
|
||||
// change color of csv-button if dark mode is chosen
|
||||
if (isDarkModeTheme()) {
|
||||
$(".buttons-csv").css("color", "white");
|
||||
}
|
||||
$('.table-responsive .dropdown-toggle').off('mouseenter').on('mouseenter', function () {
|
||||
showQsoActionsMenu($(this).closest('.dropdown'));
|
||||
});
|
||||
},
|
||||
buttons: [{
|
||||
label: lang_admin_close,
|
||||
action: function(dialogItself) {
|
||||
dialogItself.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
dialog.realize();
|
||||
$("#gridsquare_map").append(dialog.getModal());
|
||||
dialog.open();
|
||||
},
|
||||
error: function(e) {
|
||||
modalloading=false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user