From e558abf89079550f1b319ff64580582a0fc52488 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 7 Feb 2021 00:03:05 +0100 Subject: [PATCH] [Awards][US Counties] Added US Counties Award. Only totals so far. --- application/controllers/Awards.php | 11 ++++ application/models/Counties.php | 63 +++++++++++++++++++ application/views/awards/counties/index.php | 33 ++++++++++ application/views/interface_assets/footer.php | 24 +++++++ application/views/interface_assets/header.php | 2 + 5 files changed, 133 insertions(+) create mode 100644 application/models/Counties.php create mode 100644 application/views/awards/counties/index.php diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 8318381d..45b9e538 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -438,4 +438,15 @@ class Awards extends CI_Controller { $data['filter'] = "iota ".$iota. " and ".$band; $this->load->view('awards/details', $data); } + + public function counties() { + $this->load->model('counties'); + $data['counties_array'] = $this->counties->get_counties_array(); + + // Render Page + $data['page_title'] = "Awards - US Counties"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/counties/index'); + $this->load->view('interface_assets/footer'); + } } diff --git a/application/models/Counties.php b/application/models/Counties.php new file mode 100644 index 00000000..8cdce8fb --- /dev/null +++ b/application/models/Counties.php @@ -0,0 +1,63 @@ +get_counties_summary(); + + if (isset($countiesArray)) { + return $countiesArray; + } else { + return 0; + } + return 0; + } + + /* + * Returns a result of worked/confirmed US Counties, grouped by STATE + * QSL card and EQSL is valid for award. Satellite does not count. + * No band split, as it only count the number of counties in the award. + */ + function get_counties_summary() { + $station_id = $this->get_station_id(); + + $sql = "select count(distinct COL_CNTY) countycountworked, coalesce(x.countycountconfirmed, 0) countycountconfirmed, thcv.COL_STATE + from " . $this->config->item('table_name') . " thcv + left outer join ( + select count(distinct COL_CNTY) countycountconfirmed, COL_STATE + from " . $this->config->item('table_name') . + " where station_id =" . $station_id . + " and COL_DXCC in ('291', '6', '110') + and coalesce(COL_CNTY, '') <> '' + and COL_BAND != 'SAT' + and (col_qsl_rcvd='Y' or col_eqsl_qsl_rcvd='Y') + group by COL_STATE + order by COL_STATE + ) x on thcv.COL_STATE = x.COL_STATE + where station_id =" . $station_id . + " and COL_DXCC in ('291', '6', '110') + and coalesce(COL_CNTY, '') <> '' + and COL_BAND != 'SAT' + group by thcv.COL_STATE + order by thcv.COL_STATE"; + + $query = $this->db->query($sql); + return $query->result_array(); + } + + function get_station_id() { + $CI =& get_instance(); + $CI->load->model('Stations'); + return $CI->Stations->find_active(); + } +} diff --git a/application/views/awards/counties/index.php b/application/views/awards/counties/index.php new file mode 100644 index 00000000..72d588eb --- /dev/null +++ b/application/views/awards/counties/index.php @@ -0,0 +1,33 @@ +
+

+ + + + + + + + + + + $counties) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + $worked += $counties['countycountworked']; + $confirmed += $counties['countycountconfirmed']; + } + ?> + + + + + +
StateCounties WorkedCounties Confirmed
' . $counties['COL_STATE'] .''. $counties['countycountworked'] .''. $counties['countycountconfirmed'] .'
Total
+ +
\ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 1e5388d9..e7535170 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2929,6 +2929,30 @@ function deleteQsl(id) { }); + + +uri->segment(2) == "counties") { ?> + diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 60331c19..2ff3a70d 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -111,6 +111,8 @@ SOTA + US Counties + VUCC WAB