From bbdd0eadde95b3d7b0e08cd5bf6b1882d03d3d20 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 3 May 2021 14:06:56 +0100 Subject: [PATCH] [Dashboard] Adds Radio Status showing radios active in the last 15mins --- application/controllers/Dashboard.php | 6 +++++ application/models/Cat.php | 7 ++++++ application/views/dashboard/index.php | 33 +++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index 2d868c50..f539f572 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -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(); diff --git a/application/models/Cat.php b/application/models/Cat.php index 399cb57d..6057b8b7 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -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'); diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index b8a0dcd7..9a691545 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -89,6 +89,39 @@
+ + num_rows()) { ?> + + + + + + + result_array() as $row) { ?> + + + + + + +
Radio Status
+ + + + () + +
+ + + + +
lang->line('dashboard_qso_breakdown'); ?>