From 0996f957fd55b576acfc065498ee1d5f3fdf40b4 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 26 Jul 2021 13:13:16 +0200 Subject: [PATCH] [Awards IOTA] Added mode filtering. --- application/controllers/Awards.php | 5 ++++ application/models/Iota.php | 35 +++++++++++++++++++++---- application/views/awards/iota/index.php | 34 ++++++++++++++++++------ 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index e26b82c3..e37220f3 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -319,6 +319,8 @@ class Awards extends CI_Controller { public function iota () { $this->load->model('iota'); + $this->load->model('modes'); + $data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. @@ -334,6 +336,7 @@ class Awards extends CI_Controller { } $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view + $data['modes'] = $this->modes->active(); // Used in the view for mode select if($this->input->method() === 'post') { $postdata['worked'] = $this->input->post('worked'); @@ -348,6 +351,7 @@ class Awards extends CI_Controller { $postdata['Oceania'] = $this->input->post('Oceania'); $postdata['Antarctica'] = $this->input->post('Antarctica'); $postdata['band'] = $this->input->post('band'); + $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page $postdata['worked'] = 1; @@ -362,6 +366,7 @@ class Awards extends CI_Controller { $postdata['Oceania'] = 1; $postdata['Antarctica'] = 1; $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; } $iotalist = $this->iota->fetchIota($postdata); diff --git a/application/models/Iota.php b/application/models/Iota.php index a9fa8691..d46c279d 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -81,7 +81,7 @@ class IOTA extends CI_Model { if ($postdata['worked'] != NULL) { $workedIota = $this->getIotaBandWorked($station_id, $band, $postdata); foreach ($workedIota as $wiota) { - $iotaMatrix[$wiota->tag][$band] = '
tag.'","'. $band . '","All","IOTA")\'>W
'; + $iotaMatrix[$wiota->tag][$band] = '
tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>W
'; } } @@ -89,7 +89,7 @@ class IOTA extends CI_Model { if ($postdata['confirmed'] != NULL) { $confirmedIota = $this->getIotaBandConfirmed($station_id, $band, $postdata); foreach ($confirmedIota as $ciota) { - $iotaMatrix[$ciota->tag][$band] = '
tag.'","'. $band . '","All","IOTA")\'>C
'; + $iotaMatrix[$ciota->tag][$band] = '
tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>C
'; } } } @@ -127,7 +127,11 @@ class IOTA extends CI_Model { join iota on thcv.col_iota = iota.tag where station_id = " . $station_id . " and thcv.col_iota is not null - and col_qsl_rcvd = 'Y'"; + and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } if ($band == 'SAT') { $sql .= " and col_prop_mode ='" . $band . "'"; @@ -154,6 +158,10 @@ class IOTA extends CI_Model { where station_id = ' . $station_id . ' and thcv.col_iota is not null'; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + if ($band == 'SAT') { $sql .= " and col_prop_mode ='" . $band . "'"; } @@ -188,6 +196,11 @@ class IOTA extends CI_Model { if ($postdata['notworked'] == NULL) { $sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id = ". $station_id . " and col_iota = iota.tag"; + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + if ($postdata['band'] != 'All') { if ($postdata['band'] == 'SAT') { $sql .= " and col_prop_mode ='" . $postdata['band'] . "'"; @@ -214,6 +227,10 @@ class IOTA extends CI_Model { and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $station_id . " and col_iota = thcv.col_iota"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + if ($postdata['band'] != 'All') { if ($postdata['band'] == 'SAT') { $sql .= " and col_prop_mode ='" . $postdata['band'] . "'"; @@ -224,7 +241,7 @@ class IOTA extends CI_Model { } } - $sql .= " and col_qsl_rcvd = 'Y')"; + $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y'))"; if ($postdata['band'] != 'All') { if ($postdata['band'] == 'SAT') { @@ -240,6 +257,10 @@ class IOTA extends CI_Model { $sql .= " and coalesce(iota.status, '') <> 'D'"; } + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addContinentsToQuery($postdata); $query = $this->db->query($sql); @@ -252,7 +273,11 @@ class IOTA extends CI_Model { join iota on thcv.col_iota = iota.tag where station_id = " . $station_id . " and thcv.col_iota is not null - and col_qsl_rcvd = 'Y'"; + and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } if ($postdata['includedeleted'] == NULL) { $sql .= " and coalesce(iota.status, '') <> 'D'"; diff --git a/application/views/awards/iota/index.php b/application/views/awards/iota/index.php index f82f85fa..542104a3 100644 --- a/application/views/awards/iota/index.php +++ b/application/views/awards/iota/index.php @@ -5,7 +5,6 @@
-
Deleted IOTA
@@ -16,7 +15,6 @@
-
Worked / Confirmed
@@ -69,11 +67,10 @@
-
-
- +
+ +
+ +
+
+
- - + +
@@ -99,7 +117,7 @@ $i = 1; if ($iota_array) { echo ' - +