From 8dc5c9619af67dffdc099761bb225dbc9f9fd88f Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:47:51 +0200 Subject: [PATCH] [Distances Worked] Added propagation filter --- application/controllers/Distances.php | 5 +++-- application/models/Distances_model.php | 28 +++++++++++++++++++++++++- application/views/distances/index.php | 26 ++++++++++++++++++++++++ assets/js/sections/distances.js | 4 +++- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/application/controllers/Distances.php b/application/controllers/Distances.php index 5c65831fa..af4957501 100644 --- a/application/controllers/Distances.php +++ b/application/controllers/Distances.php @@ -74,12 +74,13 @@ class Distances extends CI_Controller { $distance = $this->security->xss_clean($this->input->post('distance')); $band = $this->security->xss_clean($this->input->post('band')); $sat = $this->security->xss_clean($this->input->post('sat')); + $propagation = $this->security->xss_clean($this->input->post('propagation')); - $data['results'] = $this->distances_model->qso_details($distance, $band, $sat); + $data['results'] = $this->distances_model->qso_details($distance, $band, $sat, $propagation); // Render Page $data['page_title'] = "Log View - " . $distance; - $data['filter'] = __("QSOs with") . " " . $distance . " " . __("and band"). " " . $band; + $data['filter'] = __("QSOs with") . " " . $distance . " " . __("and band"). " " . $band. __("and propagation"). " " . $propagation; $this->load->view('awards/details', $data); } } diff --git a/application/models/Distances_model.php b/application/models/Distances_model.php index be96e7f04..68e920987 100644 --- a/application/models/Distances_model.php +++ b/application/models/Distances_model.php @@ -46,6 +46,19 @@ class Distances_model extends CI_Model $this->db->where('satellite.orbit', $clean_postdata['orbit']); } + if ( $clean_postdata['propagation'] == 'NoSAT' ) { // All without SAT + $this->db->where('col_prop_mode !=', 'SAT'); + } elseif ($clean_postdata['propagation'] == 'None') { // Empty Propmode + $this->db->group_start(); + $this->db->where('trim(col_prop_mode)', ''); + $this->db->or_where('col_prop_mode is null'); + $this->db->group_end(); + } elseif ($clean_postdata['propagation'] == 'All') { // Dont care for propmode + ; // No Prop-Filter + } else { // Propmode set, take care of it + $this->db->where('col_prop_mode', $clean_postdata['propagation']); + } + $this->db->where('station_id', $station_id); $queryresult = $this->db->get($this->config->item('table_name')); @@ -231,7 +244,7 @@ class Distances_model extends CI_Model /* * Used to fetch QSOs from the logbook in the awards */ - public function qso_details($distance, $band, $sat){ + public function qso_details($distance, $band, $sat, $propagation){ $distarray = $this->getdistparams($distance); $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -256,6 +269,19 @@ class Distances_model extends CI_Model } } } + + if ($propagation == 'NoSAT' ) { // All without SAT + $this->db->where('col_prop_mode !=', 'SAT'); + } elseif ($propagation == 'None') { // Empty Propmode + $this->db->group_start(); + $this->db->where('trim(col_prop_mode)', ''); + $this->db->or_where('col_prop_mode is null'); + $this->db->group_end(); + } elseif ($propagation == 'All') { // Dont care for propmode + ; // No Prop-Filter + } else { // Propmode set, take care of it + $this->db->where('col_prop_mode', $propagation); + } $this->db->order_by("COL_TIME_ON", "desc"); return $this->db->get($this->config->item('table_name')); diff --git a/application/views/distances/index.php b/application/views/distances/index.php index a02f379ff..25ea5f01b 100644 --- a/application/views/distances/index.php +++ b/application/views/distances/index.php @@ -50,6 +50,32 @@ } ?> + +