[Satellite] Added satinfo popup

This commit is contained in:
Andreas Kristiansen
2025-03-31 11:47:07 +02:00
parent 3eedc0694a
commit 8991542afe
5 changed files with 89 additions and 1 deletions

View File

@@ -527,4 +527,13 @@ class Satellite extends CI_Controller {
// Calculate the day number
return Predict_Time::unix2daynum($timestamp, 0);
}
public function getSatelliteInfo() {
$satname = $this->security->xss_clean($this->input->post('sat', true));
$this->load->model('satellite_model');
$data['satinfo'] = $this->satellite_model->get_satellite_information($satname);
$this->load->view('satellite/satinfo', $data);
}
}

View File

@@ -12,6 +12,21 @@ class Satellite_model extends CI_Model {
return $this->db->query($sql)->result();
}
function get_satellite_information($satname = null) {
$bindings = [];
$sql = "select satellite.id, satellite.name as satname, satellitemode.name as modename, satellite.displayname, satellite.orbit, satellite.lotw as lotw, tle.updated, satellitemode.uplink_mode, satellitemode.downlink_mode, satellitemode. uplink_freq, satellitemode.downlink_freq
from satellite
left outer join satellitemode on satellite.id = satellitemode.satelliteid
left outer join tle on satellite.id = tle.satelliteid ";
if ($satname != null) {
$sql .= " where satellite.name = ? ";
$bindings[] = $satname;
}
return $this->db->query($sql, $bindings)->result();
}
function get_all_satellites_with_tle() {
$sql = "select satellite.id, satellite.name as satname, tle.tle
from satellite

View File

@@ -28,7 +28,7 @@ if (isset($filtered)) {
$tca=sat2pol($max_el_az,$max_el,$scale);
$control = array(2 * $tca[0] - ($aos[0] + $los[0]) / 2, 2 * $tca[1] - ($aos[1] + $los[1]) / 2); // Calc Controlpoints for Bezier-Curve
echo '<tr>';
echo '<td>' . $pass->satname . '</td>';
echo '<td>' . $pass->satname . ' <i class="satelliteinfo fa fa-info-circle"></i></td>';
echo '<td>' . Predict_Time::daynum2readable($pass->aos, $zone, $format) . '<span style="margin-left: 10px; display: inline-block;"><a href="' . $ics.'" target="newics"><i class="fas fa-calendar-plus"></i></a><span></td>';
echo '<td>' . Predict_Time::daynum2readable($pass->los, $zone, $format) . '</td>';
echo '<td>' . returntimediff(Predict_Time::daynum2readable($pass->aos, $zone, $format), Predict_Time::daynum2readable($pass->los, $zone, $format), $format) . '</td>';

View File

@@ -0,0 +1,33 @@
<?php
echo '
<table style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>
<th>' . __("Name") . '</th>
<th>' . __("Mode") . '</th>
<th>' . __("Uplink mode") . '</th>
<th>' . __("Uplink frequency") . '</th>
<th>' . __("Downlink mode") . '</th>
<th>' . __("Downlink frequency") . '</th>
<th>' . __("Orbit") . '</th>
<th>' . __("LoTW") . '</th>
<th>' . __("TLE date") . '</th>
</tr>
</thead>
<tbody><tr>';
foreach($satinfo as $sat) {
echo '<tr>';
echo '<td>' . $sat->satname . '</td>';
echo '<td>' . $sat->modename . '</td>';
echo '<td>' . $sat->uplink_mode . '</td>';
echo '<td>' . $sat->uplink_freq . '</td>';
echo '<td>' . $sat->downlink_mode . '</td>';
echo '<td>' . $sat->downlink_freq . '</td>';
echo '<td>' . $sat->orbit . '</td>';
echo '<td>' . $sat->lotw . '</td>';
echo '<td>' . $sat->updated . '</td>';
echo '</tr>';
}
echo '</tbody>
</table>';
?>

View File

@@ -36,6 +36,9 @@ function loadPasses() {
$(".ld-ext-right-plot").removeClass('running');
$(".ld-ext-right-plot").prop('disabled', false);
$('#searchpass').prop("disabled", false);
$('.satelliteinfo').click(function (event) {
getSatelliteInfo(this);
});
},
error: function(e) {
modalloading=false;
@@ -43,6 +46,34 @@ function loadPasses() {
});
}
function getSatelliteInfo(element) {
var satname = $(element).closest('td').contents().first().text().trim();
$.ajax({
url: base_url + 'index.php/satellite/getSatelliteInfo',
type: 'post',
data: {'sat': satname,
},
success: function (html) {
BootstrapDialog.show({
title: 'Satellite information',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'information-dialog',
nl2br: false,
message: html,
buttons: [{
label: lang_admin_close,
action: function (dialogItself) {
dialogItself.close();
}
}]
});
},
error: function(e) {
}
});
}
function loadSkedPasses() {
$.ajax({
url: base_url + 'index.php/satellite/searchSkedPasses',