From f8d720361525f439acbe136b244343a0d03e0a21 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 18 Jan 2023 13:34:27 +0100 Subject: [PATCH 1/4] Fix SQL query and rename QSL type --- application/models/Dok.php | 2 +- application/views/awards/dok/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Dok.php b/application/models/Dok.php index 240578110..1ae0cbd94 100644 --- a/application/models/Dok.php +++ b/application/models/Dok.php @@ -126,7 +126,7 @@ function get_dok_array($bands, $postdata, $location_list) { $sql = ''; $qsl = array(); if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) { - $sql .= 'and ('; + $sql .= ' and ('; if ($postdata['qsl'] != NULL) { array_push($qsl, "col_qsl_rcvd = 'Y'"); } diff --git a/application/views/awards/dok/index.php b/application/views/awards/dok/index.php index 080640448..8baabb894 100644 --- a/application/views/awards/dok/index.php +++ b/application/views/awards/dok/index.php @@ -36,7 +36,7 @@
-
QSL / LoTW
+
QSL Type
input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > From 75cf2c7c7c0403aafccf7fa288e84d0366429acc Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 18 Jan 2023 13:35:58 +0100 Subject: [PATCH 2/4] Implement eQSL and QSL filter for CQ awards --- application/controllers/Awards.php | 9 ++++-- application/models/Cq.php | 41 +++++++++++++++++++-------- application/views/awards/cq/index.php | 8 ++++-- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index cd7d92908..ac7ab5ec0 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -359,8 +359,9 @@ class Awards extends CI_Controller { $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view if($this->input->method() === 'post') { - $postdata['lotw'] = $this->input->post('lotw'); $postdata['qsl'] = $this->input->post('qsl'); + $postdata['lotw'] = $this->input->post('lotw'); + $postdata['eqsl'] = $this->input->post('eqsl'); $postdata['worked'] = $this->input->post('worked'); $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); @@ -368,8 +369,9 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -639,8 +641,9 @@ class Awards extends CI_Controller { $bands[] = $this->input->post('band'); - $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; diff --git a/application/models/Cq.php b/application/models/Cq.php index 03915fa10..b4fecee58 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -24,6 +24,19 @@ class CQ extends CI_Model{ $cqZ[$i]['count'] = 0; // Inits each cq zone's count } + $qsl = ""; + if ($postdata['confirmed'] != NULL) { + if ($postdata['qsl'] != NULL ) { + $qsl .= "Q"; + } + if ($postdata['lotw'] != NULL ) { + $qsl .= "L"; + } + if ($postdata['eqsl'] != NULL ) { + $qsl .= "E"; + } + } + foreach ($bands as $band) { for ($i = 1; $i <= 40; $i++) { $bandCq[$i][$band] = '-'; // Sets all to dash to indicate no result @@ -32,14 +45,14 @@ class CQ extends CI_Model{ if ($postdata['worked'] != NULL) { $cqBand = $this->getCQWorked($location_list, $band, $postdata); foreach ($cqBand as $line) { - $bandCq[$line->col_cqz][$band] = ''; + $bandCq[$line->col_cqz][$band] = ''; $cqZ[$line->col_cqz]['count']++; } } if ($postdata['confirmed'] != NULL) { $cqBand = $this->getCQConfirmed($location_list, $band, $postdata); foreach ($cqBand as $line) { - $bandCq[$line->col_cqz][$band] = ''; + $bandCq[$line->col_cqz][$band] = ''; $cqZ[$line->col_cqz]['count']++; } } @@ -132,16 +145,20 @@ class CQ extends CI_Model{ function addQslToQuery($postdata) { $sql = ''; - if ($postdata['lotw'] != NULL and $postdata['qsl'] == NULL) { - $sql .= " and col_lotw_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL and $postdata['lotw'] == NULL) { - $sql .= " and col_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL && $postdata['lotw'] != NULL) { - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + $qsl = array(); + if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) { + $sql .= ' and ('; + if ($postdata['qsl'] != NULL) { + array_push($qsl, "col_qsl_rcvd = 'Y'"); + } + if ($postdata['lotw'] != NULL) { + array_push($qsl, "col_lotw_qsl_rcvd = 'Y'"); + } + if ($postdata['eqsl'] != NULL) { + array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'"); + } + $sql .= implode(' or ', $qsl); + $sql .= ')'; } return $sql; } diff --git a/application/views/awards/cq/index.php b/application/views/awards/cq/index.php index e5cd4476a..23c64037d 100644 --- a/application/views/awards/cq/index.php +++ b/application/views/awards/cq/index.php @@ -57,7 +57,7 @@
-
QSL / LoTW
+
QSL Type
input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > @@ -67,6 +67,10 @@ input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
+
+ input->post('eqsl')) echo ' checked="checked"'; ?> > + +
@@ -201,4 +205,4 @@
- \ No newline at end of file + From 90b2e9c7f9ed690c58fab681d8b2fc9f1e10b433 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 18 Jan 2023 13:51:46 +0100 Subject: [PATCH 3/4] Implement eQSL and QSL filter for DXCC awards --- application/controllers/Awards.php | 9 ++++-- application/models/Dxcc.php | 41 +++++++++++++++++-------- application/views/awards/dxcc/index.php | 6 +++- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index ac7ab5ec0..a9d3da43e 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -151,8 +151,9 @@ class Awards extends CI_Controller { $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view if($this->input->method() === 'post') { - $postdata['lotw'] = $this->input->post('lotw'); $postdata['qsl'] = $this->input->post('qsl'); + $postdata['lotw'] = $this->input->post('lotw'); + $postdata['eqsl'] = $this->input->post('eqsl'); $postdata['worked'] = $this->input->post('worked'); $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); @@ -168,8 +169,9 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -691,8 +693,9 @@ class Awards extends CI_Controller { $bands[] = $this->input->post('band'); - $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 4548cc945..cfa3b65c6 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -69,6 +69,19 @@ class DXCC extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $qsl = ""; + if ($postdata['confirmed'] != NULL) { + if ($postdata['qsl'] != NULL ) { + $qsl .= "Q"; + } + if ($postdata['lotw'] != NULL ) { + $qsl .= "L"; + } + if ($postdata['eqsl'] != NULL ) { + $qsl .= "E"; + } + } + foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display foreach ($dxccArray as $dxcc) { $dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/"); @@ -82,7 +95,7 @@ class DXCC extends CI_Model { if ($postdata['worked'] != NULL) { $workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata); foreach ($workedDXCC as $wdxcc) { - $dxccMatrix[$wdxcc->dxcc][$band] = ''; + $dxccMatrix[$wdxcc->dxcc][$band] = ''; } } @@ -90,7 +103,7 @@ class DXCC extends CI_Model { if ($postdata['confirmed'] != NULL) { $confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata); foreach ($confirmedDXCC as $cdxcc) { - $dxccMatrix[$cdxcc->dxcc][$band] = ''; + $dxccMatrix[$cdxcc->dxcc][$band] = ''; } } } @@ -315,16 +328,20 @@ class DXCC extends CI_Model { // Made function instead of repeating this several times function addQslToQuery($postdata) { $sql = ''; - if ($postdata['lotw'] != NULL and $postdata['qsl'] == NULL) { - $sql .= " and col_lotw_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL and $postdata['lotw'] == NULL) { - $sql .= " and col_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL && $postdata['lotw'] != NULL) { - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + $qsl = array(); + if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) { + $sql .= ' and ('; + if ($postdata['qsl'] != NULL) { + array_push($qsl, "col_qsl_rcvd = 'Y'"); + } + if ($postdata['lotw'] != NULL) { + array_push($qsl, "col_lotw_qsl_rcvd = 'Y'"); + } + if ($postdata['eqsl'] != NULL) { + array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'"); + } + $sql .= implode(' or ', $qsl); + $sql .= ')'; } return $sql; } diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index e1dd3c476..54aa3dabf 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -67,7 +67,7 @@
-
QSL / LoTW
+
QSL Type
input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > @@ -77,6 +77,10 @@ input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
+
+ input->post('eqsl')) echo ' checked="checked"'; ?> > + +
From accf4add5205c27744bbb5adfd9d0ae200c346e5 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 18 Jan 2023 14:08:56 +0100 Subject: [PATCH 4/4] Implement eQSL and QSL filter for WAS awards --- application/controllers/Awards.php | 9 ++++-- application/models/Was.php | 41 ++++++++++++++++++-------- application/views/awards/was/index.php | 6 +++- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index a9d3da43e..3e33e787f 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -421,8 +421,9 @@ class Awards extends CI_Controller { $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view if($this->input->method() === 'post') { - $postdata['lotw'] = $this->input->post('lotw'); $postdata['qsl'] = $this->input->post('qsl'); + $postdata['lotw'] = $this->input->post('lotw'); + $postdata['eqsl'] = $this->input->post('eqsl'); $postdata['worked'] = $this->input->post('worked'); $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); @@ -430,8 +431,9 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -615,8 +617,9 @@ class Awards extends CI_Controller { $bands[] = $band_type; - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; diff --git a/application/models/Was.php b/application/models/Was.php index fc3d9f28d..346861215 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -19,6 +19,19 @@ class was extends CI_Model { $states = array(); // Used for keeping track of which states that are not worked + $qsl = ""; + if ($postdata['confirmed'] != NULL) { + if ($postdata['qsl'] != NULL ) { + $qsl .= "Q"; + } + if ($postdata['lotw'] != NULL ) { + $qsl .= "L"; + } + if ($postdata['eqsl'] != NULL ) { + $qsl .= "E"; + } + } + foreach ($stateArray as $state) { // Generating array for use in the table $states[$state]['count'] = 0; // Inits each state's count } @@ -32,14 +45,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } @@ -238,16 +251,20 @@ class was extends CI_Model { function addQslToQuery($postdata) { $sql = ''; - if ($postdata['lotw'] != NULL and $postdata['qsl'] == NULL) { - $sql .= " and col_lotw_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL and $postdata['lotw'] == NULL) { - $sql .= " and col_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL && $postdata['lotw'] != NULL) { - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + $qsl = array(); + if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) { + $sql .= ' and ('; + if ($postdata['qsl'] != NULL) { + array_push($qsl, "col_qsl_rcvd = 'Y'"); + } + if ($postdata['lotw'] != NULL) { + array_push($qsl, "col_lotw_qsl_rcvd = 'Y'"); + } + if ($postdata['eqsl'] != NULL) { + array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'"); + } + $sql .= implode(' or ', $qsl); + $sql .= ')'; } return $sql; } diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index 22e8bb998..410d4190a 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -24,7 +24,7 @@
-
QSL / LoTW
+
QSL Type
input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > @@ -34,6 +34,10 @@ input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
+
+ input->post('eqsl')) echo ' checked="checked"'; ?> > + +