From ecd7f7f6ac44471f198f8b19b72d9e8eb0b3da3e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 24 Sep 2019 22:19:49 +0100 Subject: [PATCH] On /station/ next to each profile it gives a QSO count. --- application/models/Stations.php | 7 ++++++- application/views/station_profile/index.php | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/application/models/Stations.php b/application/models/Stations.php index a5d4cd07..bb9bdd1d 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -9,7 +9,12 @@ class Stations extends CI_Model { } function all() { - return $this->db->get('station_profile'); + + $this->db->select('station_profile.*, count('.$this->config->item('table_name').'.station_id) as qso_total'); + $this->db->from('station_profile'); + $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left'); + $this->db->group_by('station_profile.station_id'); + return $this->db->get(); } function profile($id) { diff --git a/application/views/station_profile/index.php b/application/views/station_profile/index.php index efd9b91b..df4aec67 100644 --- a/application/views/station_profile/index.php +++ b/application/views/station_profile/index.php @@ -42,6 +42,7 @@ SOTA CQ ITU + QSO Count @@ -58,6 +59,7 @@ station_sota;?> station_cq;?> station_itu;?> + qso_total;?> station_active != 1) { ?> station_id; ?>" class="btn btn-outline-secondary btn-sm btn-sm" onclick="return confirm('Are you sure you want to make logbook station_profile_name; ?> the active logbook?');">Set Active