[Dashboard] Adds Radio Status showing radios active in the last 15mins

This commit is contained in:
Peter Goodhall 2021-05-03 14:06:56 +01:00
parent 31b5439bc1
commit bbdd0eadde
3 changed files with 46 additions and 0 deletions

View File

@ -44,6 +44,12 @@ class Dashboard extends CI_Controller {
$this->load->view('setup/check_list');
$this->load->view('interface_assets/footer');
} else {
//
$this->load->model('cat');
$data['radio_status'] = $this->cat->recent_status();
// Store info
$data['todays_qsos'] = $this->logbook_model->todays_qsos();
$data['total_qsos'] = $this->logbook_model->total_qsos();

View File

@ -82,6 +82,13 @@
return $query;
}
function recent_status() {
$this->db->where("timestamp > date_sub(now(), interval 15 minute)", NULL, FALSE);
$query = $this->db->get('cat');
return $query;
}
/* Return list of radios */
function radios() {
$this->db->select('id, radio');

View File

@ -89,6 +89,39 @@
<div class="col-sm-4">
<div class="table-responsive">
<?php if($radio_status->num_rows()) { ?>
<table class="table table-striped">
<tr class="titles">
<td colspan="2"><i class="fas fa-broadcast-tower"></i> Radio Status</td>
</tr>
<?php foreach ($radio_status->result_array() as $row) { ?>
<tr>
<td><?php echo $row['radio']; ?></td>
<td>
<?php if($row['radio'] == "SatPC32") { ?>
<?php echo $row['sat_name']; ?>
<?php } else { ?>
<?php echo frequency_display_string($row['frequency']); ?> (<?php echo $row['mode']; ?>)
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
<?php } ?>
<?php
// converts a frequency in Hz (e.g. 3650) to 3.650 MHz
function frequency_display_string($frequency)
{
return number_format (($frequency / 1000 / 1000), 3) . " MHz";
}
?>
<table class="table table-striped">
<tr class="titles">
<td colspan="2"><i class="fas fa-chart-bar"></i> <?php echo $this->lang->line('dashboard_qso_breakdown'); ?></td>