From c085f19835dcdb346bcd8cbd7c218b3285a1e898 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 08:19:21 +0000 Subject: [PATCH 01/15] Adding Clublog to Awards // Refactoring WAB (that it uses the functions) --- application/controllers/Awards.php | 179 +++++++++++++----------- application/models/Wab.php | 113 ++++++--------- application/views/awards/dxcc/index.php | 4 + application/views/awards/wab/index.php | 8 ++ 4 files changed, 153 insertions(+), 151 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 8a73292cb..29912f32a 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -65,6 +65,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); $postdata['band'] = $this->security->xss_clean($this->input->post('band')); @@ -74,6 +75,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = 1; $postdata['eqsl'] = 0; $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['band'] = 'All'; @@ -129,6 +131,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); @@ -446,6 +449,9 @@ class Awards extends CI_Controller { if (strpos($qsl, "Z") !== false) { $qsltype[] = "QRZ.com"; } + if (strpos($qsl, "C") !== false) { + $qsltype[] = "Clublog"; + } // Render Page $data['page_title'] = "Log View - " . $type; @@ -1440,6 +1446,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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; @@ -1492,6 +1499,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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; @@ -1529,7 +1537,7 @@ class Awards extends CI_Controller { $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; $postdata['band'] = $this->input->post('band'); - $postdata['mode'] = $this->input->post('mode'); + $postdata['mode'] = $this->input->post('mode'); $postdata['includedeleted'] = $this->input->post('includedeleted') == 0 ? NULL: 1; $postdata['Africa'] = $this->input->post('Africa') == 0 ? NULL: 1; $postdata['Asia'] = $this->input->post('Asia') == 0 ? NULL: 1; @@ -1579,89 +1587,97 @@ class Awards extends CI_Controller { } } - public function wab() { - $this->load->model('bands'); - $this->load->model('gridmap_model'); - $this->load->model('stations'); + public function wab() { + $this->load->model('bands'); + $this->load->model('gridmap_model'); + $this->load->model('stations'); - $data['modes'] = $this->gridmap_model->get_worked_modes(); - $data['bands'] = $this->bands->get_worked_bands(); - $data['orbits'] = $this->bands->get_worked_orbits(); - $data['sats_available'] = $this->bands->get_worked_sats(); + $data['modes'] = $this->gridmap_model->get_worked_modes(); + $data['bands'] = $this->bands->get_worked_bands(); + $data['orbits'] = $this->bands->get_worked_orbits(); + $data['sats_available'] = $this->bands->get_worked_sats(); - $data['user_default_band'] = $this->session->userdata('user_default_band'); - $data['user_default_confirmation'] = $this->session->userdata('user_default_confirmation'); + $data['user_default_band'] = $this->session->userdata('user_default_band'); + $data['user_default_confirmation'] = $this->session->userdata('user_default_confirmation'); - $footerData = []; - $footerData['scripts'] = [ - 'assets/js/sections/wab.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wab.js")) - ]; + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/wab.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wab.js")) + ]; - // Render page - $data['page_title'] = "Awards - Worked All Britain"; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/wab/index'); - $this->load->view('interface_assets/footer', $footerData); - } + // Render page + $data['page_title'] = "Awards - Worked All Britain"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/wab/index'); + $this->load->view('interface_assets/footer', $footerData); + } - public function wab_map() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); - $sat = $this->security->xss_clean($this->input->post('sat')); - $orbit = $this->security->xss_clean($this->input->post('orbit')); + public function wab_map() { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->load->model('wab'); + $this->load->model('wab'); - if ($logbooks_locations_array) { - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $wab_array = $this->wab->get_wab_array($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); - } else { - $location_list = null; - $wab_array = null; - } + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $wab_array = $this->wab->get_wab_array($location_list, $postdata); + } else { + $location_list = null; + $wab_array = null; + } - header('Content-Type: application/json'); - echo json_encode($wab_array); - } + header('Content-Type: application/json'); + echo json_encode($wab_array); + } - public function wab_list() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); - $sat = $this->security->xss_clean($this->input->post('sat')); - $orbit = $this->security->xss_clean($this->input->post('orbit')); + public function wab_list() { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->load->model('wab'); + $this->load->model('wab'); - if ($logbooks_locations_array) { - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $wab_array = $this->wab->get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); - } else { - $location_list = null; - $wab_array = null; - } + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $wab_array = $this->wab->get_wab_list($location_list, $postdata); + } else { + $location_list = null; + $wab_array = null; + } - $data['wab_array'] = $wab_array; - $data['postdata']['band'] = $band; - $data['postdata']['mode'] = $mode; - $data['postdata']['sat'] = $sat; - $data['postdata']['orbit'] = $orbit; + $data['wab_array'] = $wab_array; + $data['postdata']['band'] = $postdata['band']; + $data['postdata']['mode'] = $postdata['mode']; + $data['postdata']['sat'] = $postdata['sat']; + $data['postdata']['orbit'] = $postdata['orbit']; - $this->load->view('awards/wab/list', $data); - } + $this->load->view('awards/wab/list', $data); + } public function itu() { $footerData = []; @@ -1694,22 +1710,24 @@ 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['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); - $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); - $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - } + if($this->input->method() === 'post') { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + } else { // Setting default values at first load of page $postdata['qsl'] = 1; $postdata['lotw'] = 1; $postdata['eqsl'] = 0; $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -1750,6 +1768,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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/Wab.php b/application/models/Wab.php index e97980da3..ae8f355c0 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -6,13 +6,13 @@ class Wab extends CI_Model { $this->load->library('Genfunctions'); } - function get_wab_array($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { + function get_wab_array($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { $worked = array(); $confirmed = array(); - $worked = $this->getWabWorked($location_list, $band, $mode, $sat, $orbit); + $worked = $this->getWabWorked($location_list, $postdata); - $confirmed = $this->getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + $confirmed = $this->getWabConfirmed($location_list, $postdata); $wabarray = array(); @@ -38,15 +38,15 @@ class Wab extends CI_Model { } return $wabarray; - } + } - function get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { + function get_wab_list($location_list, $postdata) { $worked = array(); $confirmed = array(); - $worked = $this->getWabWorked($location_list, $band, $mode, $sat, $orbit); + $worked = $this->getWabWorked($location_list, $postdata); - $confirmed = $this->getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + $confirmed = $this->getWabConfirmed($location_list, $postdata); $wabarray = array(); @@ -74,91 +74,62 @@ class Wab extends CI_Model { ksort($wabarray); return $wabarray; - } + } - /* - * Function returns all worked, but not confirmed states - * $postdata contains data from the form, in this case Lotw or QSL are used - */ - function getWabWorked($location_list, $band, $mode, $sat, $orbit) { - $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; + /* + * Function returns all worked, but not confirmed states + * $postdata contains data from the form, in this case Lotw or QSL are used + */ + function getWabWorked($location_list, $postdata) { // $mode, $sat, $orbit) { + $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv + where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - if ($band == 'SAT') { - if ($sat != 'All') { - $sql .= " and col_sat_name ='" . $sat . "'"; + if ($postdata['band'] == 'SAT') { + if ($postdata['sat'] != 'All') { + $sql .= " and col_sat_name ='" . $postdata['sat'] . "'"; } } - if ($mode != 'All') { - $sql .= " and (col_mode = '" . $mode . "' or col_submode = '" . $mode . "')"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->addOrbitToQuery($orbit); + $sql .= $this->addOrbitToQuery($postdata['orbit']); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - /* - * Function returns all confirmed states on given band and on LoTW or QSL - * $postdata contains data from the form, in this case Lotw or QSL are used - */ - function getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { - $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; + /* + * Function returns all confirmed states on given band and on LoTW or QSL + * $postdata contains data from the form, in this case Lotw or QSL are used + */ + function getWabConfirmed($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { + $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv + where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - if ($band == 'SAT') { - if ($sat != 'All') { - $sql .= " and col_sat_name ='" . $sat . "'"; + if ($postdata['band'] == 'SAT') { + if ($postdata['sat'] != 'All') { + $sql .= " and col_sat_name ='" . $postdata['sat'] . "'"; } } - if ($mode != 'All') { - $sql .= " and (col_mode = '" . $mode . "' or col_submode = '" . $mode . "')"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->addOrbitToQuery($orbit); + $sql .= $this->addOrbitToQuery($postdata['orbit']); - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz); + $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } - - function addQslToQuery($qsl, $lotw, $eqsl, $qrz) { - $sql = ''; - $qslarray = array(); - if ($qrz != NULL || $lotw != NULL || $qsl != NULL || $eqsl != NULL) { - $sql .= ' and ('; - if ($qsl != NULL) { - array_push($qslarray, "col_qsl_rcvd = 'Y'"); - } - if ($lotw != NULL) { - array_push($qslarray, "col_lotw_qsl_rcvd = 'Y'"); - } - if ($eqsl != NULL) { - array_push($qslarray, "col_eqsl_qsl_rcvd = 'Y'"); - } - if ($qrz != NULL) { - array_push($qslarray, "COL_QRZCOM_QSO_DOWNLOAD_STATUS = 'Y'"); - } - if (count($qslarray) > 0) { - $sql .= implode(' or ', $qslarray); - } else { - $sql .= '1=0'; - } - $sql .= ')'; - } else { - $sql.=' and 1=0'; - } - return $sql; + return $query->result(); } // Adds orbit type to query diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index ba552d188..73f087a9c 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -72,6 +72,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/awards/wab/index.php b/application/views/awards/wab/index.php index 858d69c89..05433ba59 100644 --- a/application/views/awards/wab/index.php +++ b/application/views/awards/wab/index.php @@ -95,6 +95,14 @@ echo '>'; ?> +
+ '; ?> + +
From 2403642a3817bdf218366d4499bea0c837011733 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 09:20:04 +0000 Subject: [PATCH 02/15] Adjuisted DOK-Award --- application/controllers/Awards.php | 132 +++++++++++++------------ application/models/Logbook_model.php | 3 + application/models/Wab.php | 1 + application/views/awards/dok/index.php | 4 + application/views/awards/wab/index.php | 10 +- 5 files changed, 80 insertions(+), 70 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 29912f32a..b94d0dce7 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -127,14 +127,15 @@ 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['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); - $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); - $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); - $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $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['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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; + $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted')); $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa')); $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia')); @@ -414,67 +415,67 @@ class Awards extends CI_Controller { /* * Used to fetch QSOs from the logbook in the awards */ - public function qso_details_ajax(){ - $this->load->model('logbook_model'); + public function qso_details_ajax(){ + $this->load->model('logbook_model'); - $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); - $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); - $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); - $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); - $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); - $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); - $type = $this->security->xss_clean($this->input->post('Type')); - $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); - $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); - $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation); + $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); + $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); + $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); + $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); + $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); + $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); + $type = $this->security->xss_clean($this->input->post('Type')); + $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); + $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); + $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation); - // This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC. - // We replace the values to make it look a bit nicer - if ($type == 'DXCC2') { - $type = 'DXCC'; - $dxccname = $this->logbook_model->get_entity($searchphrase); - $searchphrase = $dxccname['name']; - } + // This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC. + // We replace the values to make it look a bit nicer + if ($type == 'DXCC2') { + $type = 'DXCC'; + $dxccname = $this->logbook_model->get_entity($searchphrase); + $searchphrase = $dxccname['name']; + } - $qsltype = []; - if (strpos($qsl, "Q") !== false) { - $qsltype[] = "QSL"; - } - if (strpos($qsl, "L") !== false) { - $qsltype[] = "LoTW"; - } - if (strpos($qsl, "E") !== false) { - $qsltype[] = "eQSL"; - } - if (strpos($qsl, "Z") !== false) { - $qsltype[] = "QRZ.com"; - } - if (strpos($qsl, "C") !== false) { - $qsltype[] = "Clublog"; - } + $qsltype = []; + if (strpos($qsl, "Q") !== false) { + $qsltype[] = "QSL"; + } + if (strpos($qsl, "L") !== false) { + $qsltype[] = "LoTW"; + } + if (strpos($qsl, "E") !== false) { + $qsltype[] = "eQSL"; + } + if (strpos($qsl, "Z") !== false) { + $qsltype[] = "QRZ.com"; + } + if (strpos($qsl, "C") !== false) { + $qsltype[] = "Clublog"; + } - // Render Page - $data['page_title'] = "Log View - " . $type; - $data['filter'] = $type." ".$searchphrase." and band ".$band; - if ($band == 'SAT') { - if ($sat != 'All' && $sat != null) { - $data['filter'] .= " and sat ".$sat; - } - if ($orbit != 'All' && $orbit != null) { - $data['filter'] .= " and orbit type ".$orbit; - } - } - if ($propagation != '' && $propagation != null) { - $data['filter'] .= " and propagation ".$propagation; - } - if ($mode != null && strtolower($mode) != 'all') { - $data['filter'] .= " and mode ".$mode; - } - if (!empty($qsltype)) { - $data['filter'] .= " and ".implode('/', $qsltype); - } - $this->load->view('awards/details', $data); - } + // Render Page + $data['page_title'] = "Log View - " . $type; + $data['filter'] = $type." ".$searchphrase." and band ".$band; + if ($band == 'SAT') { + if ($sat != 'All' && $sat != null) { + $data['filter'] .= " and sat ".$sat; + } + if ($orbit != 'All' && $orbit != null) { + $data['filter'] .= " and orbit type ".$orbit; + } + } + if ($propagation != '' && $propagation != null) { + $data['filter'] .= " and propagation ".$propagation; + } + if ($mode != null && strtolower($mode) != 'all') { + $data['filter'] .= " and mode ".$mode; + } + if (!empty($qsltype)) { + $data['filter'] .= " and ".implode('/', $qsltype); + } + $this->load->view('awards/details', $data); + } /* Handles showing worked SOTAs @@ -1338,6 +1339,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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/Logbook_model.php b/application/models/Logbook_model.php index bffe90cb9..146312230 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -545,6 +545,9 @@ class Logbook_model extends CI_Model { if (strpos($qsl, "Z") !== false) { $qslfilter[] = 'COL_QRZCOM_QSO_DOWNLOAD_STATUS = "Y"'; } + if (strpos($qsl, "C") !== false) { + $qslfilter[] = 'COL_CLUBLOG_QSO_DOWNLOAD_STATUS = "Y"'; + } $sql = "(".implode(' OR ', $qslfilter).")"; $this->db->where($sql); } diff --git a/application/models/Wab.php b/application/models/Wab.php index ae8f355c0..69bbe784d 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -108,6 +108,7 @@ class Wab extends CI_Model { * $postdata contains data from the form, in this case Lotw or QSL are used */ function getWabConfirmed($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { + var_dump($postdata); $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; diff --git a/application/views/awards/dok/index.php b/application/views/awards/dok/index.php index 4b3908103..27951347d 100644 --- a/application/views/awards/dok/index.php +++ b/application/views/awards/dok/index.php @@ -66,6 +66,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/awards/wab/index.php b/application/views/awards/wab/index.php index 05433ba59..b0a2f6961 100644 --- a/application/views/awards/wab/index.php +++ b/application/views/awards/wab/index.php @@ -64,7 +64,7 @@
- QSL
- LoTW
- eQSL
- QRZ.com
- Date: Mon, 27 May 2024 09:23:39 +0000 Subject: [PATCH 03/15] DXCC --- application/controllers/Awards.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index b94d0dce7..8a9422fdd 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -115,12 +115,10 @@ class Awards extends CI_Controller { if ($this->input->post('band') != NULL) { // Band is not set when page first loads. if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands $bands = $data['worked_bands']; - } - else { + } else { $bands[] = $this->security->xss_clean($this->input->post('band')); } - } - else { + } else { $bands = $data['worked_bands']; } @@ -148,8 +146,7 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); $postdata['sat'] = $this->security->xss_clean($this->input->post('sats')); $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits')); - } - else { // Setting default values at first load of page + } else { // Setting default values at first load of page $postdata['qsl'] = 1; $postdata['lotw'] = 1; $postdata['eqsl'] = 0; From 1fa5552f35c5c93d362ddd594f6a97999ce2bcbe Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 09:26:29 +0000 Subject: [PATCH 04/15] Waja --- application/controllers/Awards.php | 114 ++++++++++++------------ application/views/awards/waja/index.php | 4 + 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 8a9422fdd..ebdf59095 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -187,67 +187,69 @@ class Awards extends CI_Controller { ]; $this->load->model('waja'); - $this->load->model('modes'); - $this->load->model('bands'); + $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('waja'); - $data['modes'] = $this->modes->active(); + $data['worked_bands'] = $this->bands->get_worked_bands('waja'); + $data['modes'] = $this->modes->active(); - if ($this->input->post('band') != NULL) { // Band is not set when page first loads. - if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands - $bands = $data['worked_bands']; - } - else { - $bands[] = $this->security->xss_clean($this->input->post('band')); - } - } - else { - $bands = $data['worked_bands']; - } + if ($this->input->post('band') != NULL) { // Band is not set when page first loads. + if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands + $bands = $data['worked_bands']; + } + else { + $bands[] = $this->security->xss_clean($this->input->post('band')); + } + } + else { + $bands = $data['worked_bands']; + } - $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view + $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); - $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); - $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); - $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted')); - $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa')); - $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia')); - $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe')); - $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica')); - $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica')); - $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania')); - $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica')); - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - } - else { // Setting default values at first load of page - $postdata['qsl'] = 1; - $postdata['lotw'] = 1; - $postdata['eqsl'] = 0; - $postdata['qrz'] = 0; - $postdata['worked'] = 1; - $postdata['confirmed'] = 1; - $postdata['notworked'] = 1; - $postdata['includedeleted'] = 0; - $postdata['Africa'] = 1; - $postdata['Asia'] = 1; - $postdata['Europe'] = 1; - $postdata['NorthAmerica'] = 1; - $postdata['SouthAmerica'] = 1; - $postdata['Oceania'] = 1; - $postdata['Antarctica'] = 1; - $postdata['band'] = 'All'; - $postdata['mode'] = 'All'; - } + if($this->input->method() === 'post') { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted')); + $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa')); + $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia')); + $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe')); + $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica')); + $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica')); + $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania')); + $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + } + else { // Setting default values at first load of page + $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; + $postdata['worked'] = 1; + $postdata['confirmed'] = 1; + $postdata['notworked'] = 1; + $postdata['includedeleted'] = 0; + $postdata['Africa'] = 1; + $postdata['Asia'] = 1; + $postdata['Europe'] = 1; + $postdata['NorthAmerica'] = 1; + $postdata['SouthAmerica'] = 1; + $postdata['Oceania'] = 1; + $postdata['Antarctica'] = 1; + $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; + } - $data['waja_array'] = $this->waja->get_waja_array($bands, $postdata); - $data['waja_summary'] = $this->waja->get_waja_summary($bands, $postdata); + $data['waja_array'] = $this->waja->get_waja_array($bands, $postdata); + $data['waja_summary'] = $this->waja->get_waja_summary($bands, $postdata); // Render Page $data['page_title'] = "Awards - WAJA"; diff --git a/application/views/awards/waja/index.php b/application/views/awards/waja/index.php index 565db062c..6fdb60ea5 100644 --- a/application/views/awards/waja/index.php +++ b/application/views/awards/waja/index.php @@ -64,6 +64,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> >
+
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
From ee613cd247f2c76e587e24912125cd2047c59881 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 10:06:24 +0000 Subject: [PATCH 05/15] Added Clublog to JS --- assets/js/sections/jcc.js | 1 + assets/js/sections/jccmap.js | 1 + 2 files changed, 2 insertions(+) diff --git a/assets/js/sections/jcc.js b/assets/js/sections/jcc.js index 89bec3c2c..07931f2a7 100644 --- a/assets/js/sections/jcc.js +++ b/assets/js/sections/jcc.js @@ -34,6 +34,7 @@ function export_qsos() { lotw: +$('#lotw').prop('checked'), qrz: +$('#qrz').prop('checked'), eqsl: +$('#eqsl').prop('checked'), + clublog: +$('#clublog').prop('checked'), includedeleted: +$('#includedeleted').prop('checked'), Africa: +$('#Africa').prop('checked'), Asia: +$('#Asia').prop('checked'), diff --git a/assets/js/sections/jccmap.js b/assets/js/sections/jccmap.js index 39bdfdb31..0d314e833 100644 --- a/assets/js/sections/jccmap.js +++ b/assets/js/sections/jccmap.js @@ -14,6 +14,7 @@ function load_jcc_map() { qsl: +$('#qsl').prop('checked'), lotw: +$('#lotw').prop('checked'), qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), eqsl: +$('#eqsl').prop('checked'), }, success: function(data) { From b37f595edc2ac26d0f6cf44fa08668dd97e669b1 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 10:06:36 +0000 Subject: [PATCH 06/15] Added CL to JCC and fixed bug where map differs from summary --- application/controllers/Awards.php | 216 ++++++++++++------------- application/models/Jcc_model.php | 70 +++----- application/views/awards/jcc/index.php | 4 + 3 files changed, 136 insertions(+), 154 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index ebdf59095..522f0c779 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -266,67 +266,66 @@ class Awards extends CI_Controller { ]; $this->load->model('jcc_model'); - $this->load->model('modes'); - $this->load->model('bands'); + $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('jcc'); - $data['modes'] = $this->modes->active(); + $data['worked_bands'] = $this->bands->get_worked_bands('jcc'); + $data['modes'] = $this->modes->active(); - if ($this->input->post('band') != NULL) { // Band is not set when page first loads. - if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands - $bands = $data['worked_bands']; - } - else { - $bands[] = $this->security->xss_clean($this->input->post('band')); - } - } - else { - $bands = $data['worked_bands']; - } + if ($this->input->post('band') != NULL) { // Band is not set when page first loads. + if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands + $bands = $data['worked_bands']; + } else { + $bands[] = $this->security->xss_clean($this->input->post('band')); + } + } else { + $bands = $data['worked_bands']; + } - $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view + $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); - $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); - $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); - $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted')); - $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa')); - $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia')); - $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe')); - $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica')); - $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica')); - $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania')); - $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica')); - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - } - else { // Setting default values at first load of page - $postdata['qsl'] = 1; - $postdata['lotw'] = 1; - $postdata['eqsl'] = 0; - $postdata['qrz'] = 0; - $postdata['worked'] = 1; - $postdata['confirmed'] = 1; - $postdata['notworked'] = 0; - $postdata['includedeleted'] = 0; - $postdata['Africa'] = 1; - $postdata['Asia'] = 1; - $postdata['Europe'] = 1; - $postdata['NorthAmerica'] = 1; - $postdata['SouthAmerica'] = 1; - $postdata['Oceania'] = 1; - $postdata['Antarctica'] = 1; - $postdata['band'] = 'All'; - $postdata['mode'] = 'All'; - } + if($this->input->method() === 'post') { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted')); + $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa')); + $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia')); + $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe')); + $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica')); + $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica')); + $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania')); + $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + } else { // Setting default values at first load of page + $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; + $postdata['worked'] = 1; + $postdata['confirmed'] = 1; + $postdata['notworked'] = 0; + $postdata['includedeleted'] = 0; + $postdata['Africa'] = 1; + $postdata['Asia'] = 1; + $postdata['Europe'] = 1; + $postdata['NorthAmerica'] = 1; + $postdata['SouthAmerica'] = 1; + $postdata['Oceania'] = 1; + $postdata['Antarctica'] = 1; + $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; + } - $data['jcc_array'] = $this->jcc_model->get_jcc_array($bands, $postdata); - $data['jcc_summary'] = $this->jcc_model->get_jcc_summary($bands, $postdata); + $data['jcc_array'] = $this->jcc_model->get_jcc_array($bands, $postdata); + $data['jcc_summary'] = $this->jcc_model->get_jcc_summary($bands, $postdata); // Render Page $data['page_title'] = "Awards - JCC"; @@ -335,37 +334,38 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer', $footerData); } - public function jcc_export() { - $this->load->model('Jcc_model'); - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); - $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); - $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + public function jcc_export() { + $this->load->model('Jcc_model'); + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); + $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); + $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $qsos = $this->Jcc_model->exportJcc($postdata); + $qsos = $this->Jcc_model->exportJcc($postdata); - $fp = fopen( 'php://output', 'w' ); - $i=1; - fputcsv($fp, array('No', 'Callsign', 'Date', 'Band', 'Mode', 'Remarks'), ';'); - foreach ($qsos as $qso) { - fputcsv($fp, array($i, $qso['call'], $qso['date'], ($qso['prop_mode'] != null ? $qso['band'].' / '.$qso['prop_mode'] : $qso['band']), $qso['mode'], $qso['cnty'].' - '.$qso['jcc']), ';'); - $i++; - } - fclose($fp); - return; - } + $fp = fopen( 'php://output', 'w' ); + $i=1; + fputcsv($fp, array('No', 'Callsign', 'Date', 'Band', 'Mode', 'Remarks'), ';'); + foreach ($qsos as $qso) { + fputcsv($fp, array($i, $qso['call'], $qso['date'], ($qso['prop_mode'] != null ? $qso['band'].' / '.$qso['prop_mode'] : $qso['band']), $qso['mode'], $qso['cnty'].' - '.$qso['jcc']), ';'); + $i++; + } + fclose($fp); + return; + } - public function jcc_cities() { - $this->load->model('Jcc_model'); - $data = $this->Jcc_model->jccCities(); - header('Content-Type: application/json'); - echo json_encode($data, JSON_PRETTY_PRINT); - } + public function jcc_cities() { + $this->load->model('Jcc_model'); + $data = $this->Jcc_model->jccCities(); + header('Content-Type: application/json'); + echo json_encode($data, JSON_PRETTY_PRINT); + } public function vucc() { @@ -1491,35 +1491,35 @@ class Awards extends CI_Controller { This displays the DXCC map */ public function jcc_map() { - $this->load->model('jcc_model'); - $this->load->model('bands'); + $this->load->model('jcc_model'); + $this->load->model('bands'); - $bands[] = $this->security->xss_clean($this->input->post('band')); + $bands[] = $this->security->xss_clean($this->input->post('band')); - $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['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; - $postdata['clublog'] = $this->input->post('clublog') == 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; - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $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['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 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; + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $jcc_wkd = $this->jcc_model->fetch_jcc_wkd($postdata); - $jcc_cnfm = $this->jcc_model->fetch_jcc_cnfm($postdata); + $jcc_wkd = $this->jcc_model->fetch_jcc_wkd($postdata); + $jcc_cnfm = $this->jcc_model->fetch_jcc_cnfm($postdata); - $jccs = []; - foreach ($jcc_wkd as $jcc) { - $jccs[$jcc->COL_CNTY] = array(1, 0); - } - foreach ($jcc_cnfm as $jcc) { - $jccs[$jcc->COL_CNTY][1] = 1; - } + $jccs = []; + foreach ($jcc_wkd as $jcc) { + $jccs[$jcc->COL_CNTY] = array(1, 0); + } + foreach ($jcc_cnfm as $jcc) { + $jccs[$jcc->COL_CNTY][1] = 1; + } - header('Content-Type: application/json'); - echo json_encode($jccs); + header('Content-Type: application/json'); + echo json_encode($jccs); } /* diff --git a/application/models/Jcc_model.php b/application/models/Jcc_model.php index 7d99f4868..16b0be900 100644 --- a/application/models/Jcc_model.php +++ b/application/models/Jcc_model.php @@ -2,8 +2,13 @@ class Jcc_model extends CI_Model { + + private $location_list=null; function __construct() { $this->load->library('Genfunctions'); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->location_list = "'".implode("','",$logbooks_locations_array)."'"; } public $jaCities = array( @@ -924,14 +929,6 @@ class Jcc_model extends CI_Model { ); function get_jcc_array($bands, $postdata) { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $jccArray = array_keys($this->jaCities); @@ -951,14 +948,14 @@ class Jcc_model extends CI_Model { } if ($postdata['worked'] != NULL) { - $jccBand = $this->getJccWorked($location_list, $band, $postdata); + $jccBand = $this->getJccWorked($this->location_list, $band, $postdata); foreach ($jccBand as $line) { $bandJcc[$line->col_cnty][$band] = ''; $cities[$line->col_cnty]['count']++; } } if ($postdata['confirmed'] != NULL) { - $jccBand = $this->getJccConfirmed($location_list, $band, $postdata); + $jccBand = $this->getJccConfirmed($this->location_list, $band, $postdata); foreach ($jccBand as $line) { $bandJcc[$line->col_cnty][$band] = ''; $cities[$line->col_cnty]['count']++; @@ -968,7 +965,7 @@ class Jcc_model extends CI_Model { // We want to remove the worked cities in the list, since we do not want to display them if ($postdata['worked'] == NULL) { - $jccBand = $this->getJccWorked($location_list, $postdata['band'], $postdata); + $jccBand = $this->getJccWorked($this->location_list, $postdata['band'], $postdata); foreach ($jccBand as $line) { unset($bandJcc[$line->col_cnty]); } @@ -976,7 +973,7 @@ class Jcc_model extends CI_Model { // We want to remove the confirmed cities in the list, since we do not want to display them if ($postdata['confirmed'] == NULL) { - $wasBand = $this->getJccConfirmed($location_list, $postdata['band'], $postdata); + $wasBand = $this->getJccConfirmed($this->location_list, $postdata['band'], $postdata); foreach ($wasBand as $line) { unset($bandJcc[$line->col_cnty]); } @@ -1116,35 +1113,25 @@ class Jcc_model extends CI_Model { /* * Function gets worked and confirmed summary on each band on the active stationprofile */ - function get_jcc_summary($bands, $postdata) - { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - + function get_jcc_summary($bands, $postdata) { foreach ($bands as $band) { if ($band != 'SAT') { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $worked = $this->getSummaryByBand($band, $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $this->location_list); $jccSummary['worked'][$band] = $worked[0]->count; $jccSummary['confirmed'][$band] = $confirmed[0]->count; } } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list); $jccSummary['worked']['Total'] = $workedTotal[0]->count; $jccSummary['confirmed']['Total'] = $confirmedTotal[0]->count; if (in_array('SAT', $bands)) { - $worked = $this->getSummaryByBand('SAT', $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed('SAT', $postdata, $location_list); + $worked = $this->getSummaryByBand('SAT', $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed('SAT', $postdata, $this->location_list); $jccSummary['worked']['SAT'] = $worked[0]->count; $jccSummary['confirmed']['SAT'] = $confirmed[0]->count; } @@ -1152,8 +1139,7 @@ class Jcc_model extends CI_Model { return $jccSummary; } - function getSummaryByBand($band, $postdata, $location_list) - { + function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; $sql .= " where station_id in (" . $location_list . ")"; @@ -1185,8 +1171,7 @@ class Jcc_model extends CI_Model { return $query->result(); } - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { + function getSummaryByBandConfirmed($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; $sql .= " where station_id in (" . $location_list . ")"; @@ -1230,17 +1215,8 @@ class Jcc_model extends CI_Model { } function exportJcc($postdata) { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $sql = "SELECT distinct col_cnty FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ")"; + where station_id in (" . $this->location_list . ")"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; @@ -1259,7 +1235,7 @@ class Jcc_model extends CI_Model { } $qsos = array(); foreach($jccs as $jcc) { - $qso = $this->getFirstQso($location_list, $jcc, $postdata); + $qso = $this->getFirstQso($this->location_list, $jcc, $postdata); $qsos[] = array('call' => $qso[0]->COL_CALL, 'date' => $qso[0]->COL_TIME_ON, 'band' => $qso[0]->COL_BAND, 'mode' => $qso[0]->COL_MODE, 'prop_mode' => $qso[0]->COL_PROP_MODE, 'cnty' => $qso[0]->COL_CNTY, 'jcc' => $this->jaCities[$qso[0]->COL_CNTY]['name']); } @@ -1282,7 +1258,8 @@ class Jcc_model extends CI_Model { } function fetch_jcc_wkd($postdata) { - $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1'; + $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1 + and station_id in ('.$this->location_list.')'; $sql .= $this->addStateToQuery(); $sql .= $this->genfunctions->addBandToQuery($postdata['band']); if ($postdata['mode'] != 'All') { @@ -1294,7 +1271,8 @@ class Jcc_model extends CI_Model { } function fetch_jcc_cnfm($postdata) { - $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1'; + $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1 + and station_id in ('.$this->location_list.')'; $sql .= $this->addStateToQuery(); $sql .= $this->genfunctions->addBandToQuery($postdata['band']); if ($postdata['mode'] != 'All') { diff --git a/application/views/awards/jcc/index.php b/application/views/awards/jcc/index.php index 17fdd5a6f..7b42374ed 100644 --- a/application/views/awards/jcc/index.php +++ b/application/views/awards/jcc/index.php @@ -63,6 +63,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
From 854615f6dc0d5db41663bcd2aff3eecf9791ce04 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 10:38:08 +0000 Subject: [PATCH 07/15] Added Clublog to WajaMap --- assets/js/sections/wajamap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/sections/wajamap.js b/assets/js/sections/wajamap.js index 18ca4d51b..e12df68d8 100644 --- a/assets/js/sections/wajamap.js +++ b/assets/js/sections/wajamap.js @@ -74,6 +74,7 @@ function load_waja_map() { lotw: +$('#lotw').prop('checked'), eqsl: +$('#eqsl').prop('checked'), qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), }, success: function(data) { prefectures = data; From 79c3a54b6c2f16896f0c44d963a7570527b087f6 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 10:38:17 +0000 Subject: [PATCH 08/15] Added Clublog to Wajamap and fixed bug which counted the totals wrong --- application/controllers/Awards.php | 1 + application/models/Waja.php | 65 ++++++++++-------------------- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 522f0c779..2fbe8dc84 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -1395,6 +1395,7 @@ class Awards extends CI_Controller { $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; $postdata['band'] = $this->security->xss_clean($this->input->post('band')); diff --git a/application/models/Waja.php b/application/models/Waja.php index 6c48fbd3a..900ba50cf 100644 --- a/application/models/Waja.php +++ b/application/models/Waja.php @@ -2,8 +2,12 @@ class WAJA extends CI_Model { + private $location_list=null; function __construct() { $this->load->library('Genfunctions'); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->location_list = "'".implode("','",$logbooks_locations_array)."'"; } public $jaPrefectures = array( @@ -56,15 +60,6 @@ class WAJA extends CI_Model { '47' => 'Okinawa'); function get_waja_array($bands, $postdata) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $wajaArray = array_keys($this->jaPrefectures); @@ -84,14 +79,14 @@ class WAJA extends CI_Model { } if ($postdata['worked'] != NULL) { - $wajaBand = $this->getWajaWorked($location_list, $band, $postdata); + $wajaBand = $this->getWajaWorked($this->location_list, $band, $postdata); foreach ($wajaBand as $line) { $bandWaja[$line->col_state][$band] = ''; $prefectures[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { - $wajaBand = $this->getWajaConfirmed($location_list, $band, $postdata); + $wajaBand = $this->getWajaConfirmed($this->location_list, $band, $postdata); foreach ($wajaBand as $line) { $bandWaja[$line->col_state][$band] = ''; $prefectures[$line->col_state]['count']++; @@ -101,7 +96,7 @@ class WAJA extends CI_Model { // We want to remove the worked states in the list, since we do not want to display them if ($postdata['worked'] == NULL) { - $wajaBand = $this->getWajaWorked($location_list, $postdata['band'], $postdata); + $wajaBand = $this->getWajaWorked($this->location_list, $postdata['band'], $postdata); foreach ($wajaBand as $line) { unset($bandWaja[$line->col_state]); } @@ -109,8 +104,8 @@ class WAJA extends CI_Model { // We want to remove the confirmed states in the list, since we do not want to display them if ($postdata['confirmed'] == NULL) { - $wasBand = $this->getWajaConfirmed($location_list, $postdata['band'], $postdata); - foreach ($wasBand as $line) { + $wajaBand = $this->getWajaConfirmed($this->location_list, $postdata['band'], $postdata); + foreach ($wajaBand as $line) { unset($bandWaja[$line->col_state]); } } @@ -125,8 +120,7 @@ class WAJA extends CI_Model { if (isset($bandWaja)) { return $bandWaja; - } - else { + } else { return 0; } } @@ -247,27 +241,16 @@ class WAJA extends CI_Model { /* * Function gets worked and confirmed summary on each band on the active stationprofile */ - function get_waja_summary($bands, $postdata) - { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - + function get_waja_summary($bands, $postdata) { foreach ($bands as $band) { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $worked = $this->getSummaryByBand($band, $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $this->location_list); $wajaSummary['worked'][$band] = $worked[0]->count; $wajaSummary['confirmed'][$band] = $confirmed[0]->count; } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list); $wajaSummary['worked']['Total'] = $workedTotal[0]->count; $wajaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; @@ -275,10 +258,8 @@ class WAJA extends CI_Model { return $wajaSummary; } - function getSummaryByBand($band, $postdata, $location_list) - { + function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { @@ -286,12 +267,11 @@ class WAJA extends CI_Model { } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); + $bandslots = $this->bands->get_worked_bands('waja'); $bandslots_list = "'".implode("','",$bandslots)."'"; - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -308,10 +288,8 @@ class WAJA extends CI_Model { return $query->result(); } - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { + function getSummaryByBandConfirmed($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { @@ -319,12 +297,11 @@ class WAJA extends CI_Model { } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); + $bandslots = $this->bands->get_worked_bands('waja'); $bandslots_list = "'".implode("','",$bandslots)."'"; - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; From df5864176b129fc899a745b355b962281743fff1 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 10:48:12 +0000 Subject: [PATCH 09/15] Small adjustments at SOTA/POTA/WWFF --- application/controllers/Awards.php | 184 ++++++++++++++--------------- application/models/Pota.php | 9 +- application/models/Sota.php | 9 +- application/models/Wwff.php | 9 +- 4 files changed, 104 insertions(+), 107 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 2fbe8dc84..f82c8d884 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -368,113 +368,113 @@ class Awards extends CI_Controller { } - public function vucc() { - $this->load->model('vucc'); - $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('vucc'); + public function vucc() { + $this->load->model('vucc'); + $this->load->model('bands'); + $data['worked_bands'] = $this->bands->get_worked_bands('vucc'); - $data['vucc_array'] = $this->vucc->get_vucc_array($data); + $data['vucc_array'] = $this->vucc->get_vucc_array($data); - // Render Page - $data['page_title'] = "Awards - VUCC"; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/vucc/index'); - $this->load->view('interface_assets/footer'); - } + // Render Page + $data['page_title'] = "Awards - VUCC"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/vucc/index'); + $this->load->view('interface_assets/footer'); + } - public function vucc_band(){ - $this->load->model('vucc'); - $band = str_replace('"', "", $this->security->xss_clean($this->input->get("Band"))); - $type = str_replace('"', "", $this->security->xss_clean($this->input->get("Type"))); - $data['vucc_array'] = $this->vucc->vucc_details($band, $type); - $data['type'] = $type; + public function vucc_band(){ + $this->load->model('vucc'); + $band = str_replace('"', "", $this->security->xss_clean($this->input->get("Band"))); + $type = str_replace('"', "", $this->security->xss_clean($this->input->get("Type"))); + $data['vucc_array'] = $this->vucc->vucc_details($band, $type); + $data['type'] = $type; - // Render Page - $data['page_title'] = "VUCC - " .$band . " Band"; - $data['filter'] = "band ".$band; - $data['band'] = $band; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/vucc/band'); - $this->load->view('interface_assets/footer'); - } + // Render Page + $data['page_title'] = "VUCC - " .$band . " Band"; + $data['filter'] = "band ".$band; + $data['band'] = $band; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/vucc/band'); + $this->load->view('interface_assets/footer'); + } - public function vucc_details_ajax(){ - $this->load->model('logbook_model'); + public function vucc_details_ajax(){ + $this->load->model('logbook_model'); - $gridsquare = str_replace('"', "", $this->security->xss_clean($this->input->post("Gridsquare"))); - $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); - $data['results'] = $this->logbook_model->vucc_qso_details($gridsquare, $band); + $gridsquare = str_replace('"', "", $this->security->xss_clean($this->input->post("Gridsquare"))); + $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); + $data['results'] = $this->logbook_model->vucc_qso_details($gridsquare, $band); - // Render Page - $data['page_title'] = "Log View - VUCC"; - $data['filter'] = "vucc " . $gridsquare . " and band ".$band; - $this->load->view('awards/details', $data); - } + // Render Page + $data['page_title'] = "Log View - VUCC"; + $data['filter'] = "vucc " . $gridsquare . " and band ".$band; + $this->load->view('awards/details', $data); + } /* * Used to fetch QSOs from the logbook in the awards */ - public function qso_details_ajax(){ - $this->load->model('logbook_model'); + public function qso_details_ajax() { + $this->load->model('logbook_model'); - $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); - $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); - $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); - $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); - $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); - $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); - $type = $this->security->xss_clean($this->input->post('Type')); - $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); - $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); - $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation); + $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); + $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); + $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); + $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); + $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); + $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); + $type = $this->security->xss_clean($this->input->post('Type')); + $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); + $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); + $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation); - // This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC. - // We replace the values to make it look a bit nicer - if ($type == 'DXCC2') { - $type = 'DXCC'; - $dxccname = $this->logbook_model->get_entity($searchphrase); - $searchphrase = $dxccname['name']; - } + // This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC. + // We replace the values to make it look a bit nicer + if ($type == 'DXCC2') { + $type = 'DXCC'; + $dxccname = $this->logbook_model->get_entity($searchphrase); + $searchphrase = $dxccname['name']; + } - $qsltype = []; - if (strpos($qsl, "Q") !== false) { - $qsltype[] = "QSL"; - } - if (strpos($qsl, "L") !== false) { - $qsltype[] = "LoTW"; - } - if (strpos($qsl, "E") !== false) { - $qsltype[] = "eQSL"; - } - if (strpos($qsl, "Z") !== false) { - $qsltype[] = "QRZ.com"; - } - if (strpos($qsl, "C") !== false) { - $qsltype[] = "Clublog"; - } + $qsltype = []; + if (strpos($qsl, "Q") !== false) { + $qsltype[] = "QSL"; + } + if (strpos($qsl, "L") !== false) { + $qsltype[] = "LoTW"; + } + if (strpos($qsl, "E") !== false) { + $qsltype[] = "eQSL"; + } + if (strpos($qsl, "Z") !== false) { + $qsltype[] = "QRZ.com"; + } + if (strpos($qsl, "C") !== false) { + $qsltype[] = "Clublog"; + } - // Render Page - $data['page_title'] = "Log View - " . $type; - $data['filter'] = $type." ".$searchphrase." and band ".$band; - if ($band == 'SAT') { - if ($sat != 'All' && $sat != null) { - $data['filter'] .= " and sat ".$sat; - } - if ($orbit != 'All' && $orbit != null) { - $data['filter'] .= " and orbit type ".$orbit; - } - } - if ($propagation != '' && $propagation != null) { - $data['filter'] .= " and propagation ".$propagation; - } - if ($mode != null && strtolower($mode) != 'all') { - $data['filter'] .= " and mode ".$mode; - } - if (!empty($qsltype)) { - $data['filter'] .= " and ".implode('/', $qsltype); - } - $this->load->view('awards/details', $data); - } + // Render Page + $data['page_title'] = "Log View - " . $type; + $data['filter'] = $type." ".$searchphrase." and band ".$band; + if ($band == 'SAT') { + if ($sat != 'All' && $sat != null) { + $data['filter'] .= " and sat ".$sat; + } + if ($orbit != 'All' && $orbit != null) { + $data['filter'] .= " and orbit type ".$orbit; + } + } + if ($propagation != '' && $propagation != null) { + $data['filter'] .= " and propagation ".$propagation; + } + if ($mode != null && strtolower($mode) != 'all') { + $data['filter'] .= " and mode ".$mode; + } + if (!empty($qsltype)) { + $data['filter'] .= " and ".implode('/', $qsltype); + } + $this->load->view('awards/details', $data); + } /* Handles showing worked SOTAs diff --git a/application/models/Pota.php b/application/models/Pota.php index 1c5c8a40f..2a3329392 100644 --- a/application/models/Pota.php +++ b/application/models/Pota.php @@ -3,13 +3,12 @@ class Pota extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if (!$logbooks_locations_array) { - return null; - } + return null; + } $this->load->model('bands'); diff --git a/application/models/Sota.php b/application/models/Sota.php index 46d7e5f56..dbd4fc9b0 100644 --- a/application/models/Sota.php +++ b/application/models/Sota.php @@ -3,13 +3,12 @@ class Sota extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if (!$logbooks_locations_array) { - return null; - } + return null; + } $this->load->model('bands'); diff --git a/application/models/Wwff.php b/application/models/Wwff.php index e15584c3b..a17b70a48 100644 --- a/application/models/Wwff.php +++ b/application/models/Wwff.php @@ -3,13 +3,12 @@ class Wwff extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if (!$logbooks_locations_array) { - return null; - } + return null; + } $this->load->model('bands'); From 0b683c9b49cec80ba61c293b9fd68d4826dc7812 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 12:21:31 +0000 Subject: [PATCH 10/15] Removed dbg --- application/models/Wab.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/models/Wab.php b/application/models/Wab.php index 69bbe784d..ae8f355c0 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -108,7 +108,6 @@ class Wab extends CI_Model { * $postdata contains data from the form, in this case Lotw or QSL are used */ function getWabConfirmed($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { - var_dump($postdata); $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; From 5ba44b61a9518f6fcf5ba778c4670b03fbbdb861 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 12:22:21 +0000 Subject: [PATCH 11/15] Taking a break (at IOTA) --- application/controllers/Awards.php | 12 +- application/models/Iota.php | 481 +++++++++++------------- application/views/awards/iota/index.php | 27 ++ 3 files changed, 260 insertions(+), 260 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index f82c8d884..462fab282 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -784,7 +784,7 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer', $footerData); } - public function iota () { + public function iota () { $this->load->model('iota'); $this->load->model('modes'); $this->load->model('bands'); @@ -805,6 +805,11 @@ class Awards extends CI_Controller { $data['modes'] = $this->modes->active(); // Used in the view for mode select if($this->input->method() === 'post') { + $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['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')) ?? NULL; $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')) ?? NULL; $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')) ?? NULL; @@ -819,6 +824,11 @@ class Awards extends CI_Controller { $postdata['band'] = $this->security->xss_clean($this->input->post('band')) ?? NULL; $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')) ?? NULL; } else { // Setting default values at first load of page + $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; diff --git a/application/models/Iota.php b/application/models/Iota.php index a70e5e530..a39e377c0 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -5,360 +5,323 @@ class IOTA extends CI_Model { $this->load->library('Genfunctions'); } - function get_iota_array($iotaArray, $bands, $postdata) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + function get_iota_array($iotaArray, $bands, $postdata) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if (!$logbooks_locations_array) { - return null; - } + if (!$logbooks_locations_array) { + return null; + } $location_list = "'".implode("','",$logbooks_locations_array)."'"; + foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display + foreach ($iotaArray as $iota) { + $iotaMatrix[$iota->tag]['prefix'] = $iota->prefix; + $iotaMatrix[$iota->tag]['name'] = $iota->name; + if ($postdata['includedeleted']) + $iotaMatrix[$iota->tag]['Deleted'] = isset($iota->status) && $iota->status == 'D' ? "
Y
" : ''; + $iotaMatrix[$iota->tag][$band] = '-'; + } - foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display - foreach ($iotaArray as $iota) { - $iotaMatrix[$iota->tag]['prefix'] = $iota->prefix; - $iotaMatrix[$iota->tag]['name'] = $iota->name; - if ($postdata['includedeleted']) - $iotaMatrix[$iota->tag]['Deleted'] = isset($iota->status) && $iota->status == 'D' ? "
Y
" : ''; - $iotaMatrix[$iota->tag][$band] = '-'; - } + // If worked is checked, we add worked iotas to the array + if ($postdata['worked'] != NULL) { + $workedIota = $this->getIotaBandWorked($location_list, $band, $postdata); + foreach ($workedIota as $wiota) { + $iotaMatrix[$wiota->tag][$band] = ''; + } + } - // If worked is checked, we add worked iotas to the array - if ($postdata['worked'] != NULL) { - $workedIota = $this->getIotaBandWorked($location_list, $band, $postdata); - foreach ($workedIota as $wiota) { - $iotaMatrix[$wiota->tag][$band] = ''; - } - } + // If confirmed is checked, we add confirmed iotas to the array + if ($postdata['confirmed'] != NULL) { + $confirmedIota = $this->getIotaBandConfirmed($location_list, $band, $postdata); + foreach ($confirmedIota as $ciota) { + $iotaMatrix[$ciota->tag][$band] = ''; + } + } + } - // If confirmed is checked, we add confirmed iotas to the array - if ($postdata['confirmed'] != NULL) { - $confirmedIota = $this->getIotaBandConfirmed($location_list, $band, $postdata); - foreach ($confirmedIota as $ciota) { - $iotaMatrix[$ciota->tag][$band] = ''; - } - } - } + // We want to remove the worked iotas in the list, since we do not want to display them + if ($postdata['worked'] == NULL) { + $workedIota = $this->getIotaWorked($location_list, $postdata); + foreach ($workedIota as $wiota) { + if (array_key_exists($wiota->tag, $iotaMatrix)) { + unset($iotaMatrix[$wiota->tag]); + } + } + } - // We want to remove the worked iotas in the list, since we do not want to display them - if ($postdata['worked'] == NULL) { - $workedIota = $this->getIotaWorked($location_list, $postdata); - foreach ($workedIota as $wiota) { - if (array_key_exists($wiota->tag, $iotaMatrix)) { - unset($iotaMatrix[$wiota->tag]); - } - } - } + // We want to remove the confirmed iotas in the list, since we do not want to display them + if ($postdata['confirmed'] == NULL) { + $confirmedIOTA = $this->getIotaConfirmed($location_list, $postdata); + foreach ($confirmedIOTA as $ciota) { + if (array_key_exists($ciota->tag, $iotaMatrix)) { + unset($iotaMatrix[$ciota->tag]); + } + } + } - // We want to remove the confirmed iotas in the list, since we do not want to display them - if ($postdata['confirmed'] == NULL) { - $confirmedIOTA = $this->getIotaConfirmed($location_list, $postdata); - foreach ($confirmedIOTA as $ciota) { - if (array_key_exists($ciota->tag, $iotaMatrix)) { - unset($iotaMatrix[$ciota->tag]); - } - } - } + if (isset($iotaMatrix)) { + return $iotaMatrix; + } else { + return 0; + } + } - if (isset($iotaMatrix)) { - return $iotaMatrix; - } - else { - return 0; - } - } - - function getIotaBandConfirmed($location_list, $band, $postdata) { - $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + function getIotaBandConfirmed($location_list, $band, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($band); - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->genfunctions->addQslToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function getIotaBandWorked($location_list, $band, $postdata) { - $sql = 'SELECT distinct UPPER(col_iota) as tag FROM ' . $this->config->item('table_name'). ' thcv - join iota on thcv.col_iota = iota.tag - where station_id in (' . $location_list . - ') and thcv.col_iota is not null'; + function getIotaBandWorked($location_list, $band, $postdata) { + $sql = 'SELECT distinct UPPER(col_iota) as tag FROM ' . $this->config->item('table_name'). ' thcv + join iota on thcv.col_iota = iota.tag + where station_id in (' . $location_list . + ') and thcv.col_iota is not null'; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($band); - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function fetchIota($postdata) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + function fetchIota($postdata) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if (!$logbooks_locations_array) { - return null; - } + if (!$logbooks_locations_array) { + return null; + } $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $sql = "select tag, name, prefix, dxccid, status, lat1, lat2, lon1, lon2 from iota where 1=1"; + $sql = "select tag, name, prefix, dxccid, status, lat1, lat2, lon1, lon2 from iota where 1=1"; - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - if ($postdata['notworked'] == NULL) { - $sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id in (". $location_list . ") and col_iota = iota.tag"; + if ($postdata['notworked'] == NULL) { + $sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id in (". $location_list . ") 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'] . "'"; - } - else { - $sql .= " and col_prop_mode !='SAT'"; - $sql .= " and col_band ='" . $postdata['band'] . "'"; - } - } - $sql .= ")"; - } + if ($postdata['band'] != 'All') { + if ($postdata['band'] == 'SAT') { + $sql .= " and col_prop_mode ='" . $postdata['band'] . "'"; + } else { + $sql .= " and col_prop_mode !='SAT'"; + $sql .= " and col_band ='" . $postdata['band'] . "'"; + } + } + $sql .= ")"; + } - $sql .= ' order by tag'; - $query = $this->db->query($sql); + $sql .= ' order by tag'; + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function getIotaWorked($location_list, $postdata) { - $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list . - " and col_iota = thcv.col_iota"; + function getIotaWorked($location_list, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null + and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list . " and col_iota = thcv.col_iota)"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y'))"; - - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $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); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function getIotaConfirmed($location_list, $postdata) { - $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + function getIotaConfirmed($location_list, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null"; + $sql .= $this->genfunctions->addQslToQuery($postdata); 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'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - // Made function instead of repeating this several times - function addContinentsToQuery($postdata) { - $sql = ''; - if ($postdata['Africa'] == NULL) { - $sql .= " and left(tag, 2) <> 'AF'"; - } + // Made function instead of repeating this several times + function addContinentsToQuery($postdata) { + $sql = ''; + if ($postdata['Africa'] == NULL) { + $sql .= " and left(tag, 2) <> 'AF'"; + } - if ($postdata['Europe'] == NULL) { - $sql .= " and left(tag, 2) <> 'EU'"; - } + if ($postdata['Europe'] == NULL) { + $sql .= " and left(tag, 2) <> 'EU'"; + } - if ($postdata['Asia'] == NULL) { - $sql .= " and left(tag, 2) <> 'AS'"; - } + if ($postdata['Asia'] == NULL) { + $sql .= " and left(tag, 2) <> 'AS'"; + } - if ($postdata['SouthAmerica'] == NULL) { - $sql .= " and left(tag, 2) <> 'SA'"; - } + if ($postdata['SouthAmerica'] == NULL) { + $sql .= " and left(tag, 2) <> 'SA'"; + } - if ($postdata['NorthAmerica'] == NULL) { - $sql .= " and left(tag, 2) <> 'NA'"; - } + if ($postdata['NorthAmerica'] == NULL) { + $sql .= " and left(tag, 2) <> 'NA'"; + } - if ($postdata['Oceania'] == NULL) { - $sql .= " and left(tag, 2) <> 'OC'"; - } + if ($postdata['Oceania'] == NULL) { + $sql .= " and left(tag, 2) <> 'OC'"; + } - if ($postdata['Antarctica'] == NULL) { - $sql .= " and left(tag, 2) <> 'AN'"; - } - return $sql; - } + if ($postdata['Antarctica'] == NULL) { + $sql .= " and left(tag, 2) <> 'AN'"; + } + return $sql; + } - /* - * Function gets worked and confirmed summary on each band on the active stationprofile - */ - function get_iota_summary($bands, $postdata) - { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + /* + * Function gets worked and confirmed summary on each band on the active stationprofile + */ + function get_iota_summary($bands, $postdata) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if (!$logbooks_locations_array) { - return null; - } + if (!$logbooks_locations_array) { + return null; + } $location_list = "'".implode("','",$logbooks_locations_array)."'"; - foreach ($bands as $band) { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); - $iotaSummary['worked'][$band] = $worked[0]->count; - $iotaSummary['confirmed'][$band] = $confirmed[0]->count; - } + foreach ($bands as $band) { + $worked = $this->getSummaryByBand($band, $postdata, $location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $iotaSummary['worked'][$band] = $worked[0]->count; + $iotaSummary['confirmed'][$band] = $confirmed[0]->count; + } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); - $iotaSummary['worked']['Total'] = $workedTotal[0]->count; - $iotaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; + $iotaSummary['worked']['Total'] = $workedTotal[0]->count; + $iotaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; - return $iotaSummary; - } - - function getSummaryByBand($band, $postdata, $location_list) - { - $sql = "SELECT count(distinct UPPER(thcv.col_iota)) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= ' join iota on thcv.col_iota = iota.tag'; - - $sql .= " where station_id in (" . $location_list . ")"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - } else if ($band == 'All') { - $this->load->model('bands'); + return $iotaSummary; + } + function getSummaryByBand($band, $postdata, $location_list) { + $sql = "SELECT count(distinct UPPER(thcv.col_iota)) as count FROM " . $this->config->item('table_name') . " thcv"; + $sql .= ' join iota on thcv.col_iota = iota.tag'; + $sql .= " where station_id in (" . $location_list . ")"; + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else if ($band == 'All') { + $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('iota'); - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band ='" . $band . "'"; - } - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + if ($postdata['includedeleted'] == NULL) { + $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); + return $query->result(); + } - $sql .= $this->addContinentsToQuery($postdata); - - $query = $this->db->query($sql); - - return $query->result(); - } - - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { - $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= ' join iota on thcv.col_iota = iota.tag'; - - $sql .= " where station_id in (" . $location_list . ")"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - } else if ($band == 'All') { - $this->load->model('bands'); - + function getSummaryByBandConfirmed($band, $postdata, $location_list) { + $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; + $sql .= ' join iota on thcv.col_iota = iota.tag'; + $sql .= " where station_id in (" . $location_list . ")"; + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else if ($band == 'All') { + $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('iota'); - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band ='" . $band . "'"; - } - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + if ($postdata['includedeleted'] == NULL) { + $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); + $sql .= $this->genfunctions->addQslToQuery($postdata); + log_message("Error",$sql); + $query = $this->db->query($sql); - $sql .= $this->addContinentsToQuery($postdata); - - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; - - $query = $this->db->query($sql); - - return $query->result(); - } + return $query->result(); + } } ?> diff --git a/application/views/awards/iota/index.php b/application/views/awards/iota/index.php index 54f53a851..8654d8467 100644 --- a/application/views/awards/iota/index.php +++ b/application/views/awards/iota/index.php @@ -53,6 +53,33 @@ +
+
+
+
+ input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > + +
+
+ input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > + +
+
+ input->post('eqsl')) echo ' checked="checked"'; ?> > + +
+
+ input->post('qrz')) echo ' checked="checked"'; ?> > + +
+
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
+
+
+ +
Continents
From e4f46473e0d34b787d312f0305233484e46d81a0 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 12:22:36 +0000 Subject: [PATCH 12/15] Taking a break (at IOTA) --- assets/js/sections/iotamap.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/js/sections/iotamap.js b/assets/js/sections/iotamap.js index 683d71d03..7968f2412 100644 --- a/assets/js/sections/iotamap.js +++ b/assets/js/sections/iotamap.js @@ -13,6 +13,9 @@ function load_iota_map() { notworked: +$('#notworked').prop('checked'), qsl: +$('#qsl').prop('checked'), lotw: +$('#lotw').prop('checked'), + eqsl: +$('#eqsl').prop('checked'), + qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), includedeleted: +$('#includedeleted').prop('checked'), Africa: +$('#Africa').prop('checked'), Asia: +$('#Asia').prop('checked'), From 4550b4cd008829fd7b598dd8028046c6d9475e8c Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 14:05:33 +0000 Subject: [PATCH 13/15] Restore old counting (SAT not counted in summary but at band) --- application/models/Waja.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/application/models/Waja.php b/application/models/Waja.php index 900ba50cf..4f31bed8d 100644 --- a/application/models/Waja.php +++ b/application/models/Waja.php @@ -190,7 +190,6 @@ class WAJA extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); $sql .= " and not exists (select 1 from ". $this->config->item('table_name') . @@ -202,13 +201,9 @@ class WAJA extends CI_Model { } $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $sql .= ")"; - $query = $this->db->query($sql); return $query->result(); @@ -227,16 +222,12 @@ class WAJA extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); return $query->result(); } - /* * Function gets worked and confirmed summary on each band on the active stationprofile @@ -272,6 +263,7 @@ class WAJA extends CI_Model { $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -296,12 +288,10 @@ class WAJA extends CI_Model { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('waja'); - $bandslots_list = "'".implode("','",$bandslots)."'"; - $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -312,9 +302,7 @@ class WAJA extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $query = $this->db->query($sql); return $query->result(); From 354391b027e162af8a4cc55b6dae8bbc777bf96a Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 14:09:44 +0000 Subject: [PATCH 14/15] Restore old counting (SAT not counted in summary but at band) --- application/models/Jcc_model.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/application/models/Jcc_model.php b/application/models/Jcc_model.php index 16b0be900..788a5fe90 100644 --- a/application/models/Jcc_model.php +++ b/application/models/Jcc_model.php @@ -991,8 +991,7 @@ class Jcc_model extends CI_Model { if (isset($bandJcc)) { return $bandJcc; - } - else { + } else { return 0; } } @@ -1003,7 +1002,6 @@ class Jcc_model extends CI_Model { select col_dxcc from ".$this->config->item('table_name')." thcv where station_id in (" . $location_list . ") and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($band); if ($postdata['mode'] != 'All') { @@ -1011,7 +1009,6 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= " group by col_dxcc ) x on dxcc_entities.adif = x.col_dxcc"; @@ -1062,9 +1059,7 @@ class Jcc_model extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= " and not exists (select 1 from ". $this->config->item('table_name') . " where station_id in (". $location_list . ")" . " and col_cnty = thcv.col_cnty"; @@ -1074,11 +1069,8 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $sql .= ")"; $query = $this->db->query($sql); @@ -1141,16 +1133,13 @@ class Jcc_model extends CI_Model { function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); - $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . @@ -1173,16 +1162,13 @@ class Jcc_model extends CI_Model { function getSummaryByBandConfirmed($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); - $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . @@ -1197,11 +1183,8 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $query = $this->db->query($sql); - return $query->result(); } From 44b30a9180961052694dc82f56259ade4ff55984 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 27 May 2024 14:15:52 +0000 Subject: [PATCH 15/15] Restore old counting (SAT not counted in summary but at band) --- application/models/Iota.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/models/Iota.php b/application/models/Iota.php index a39e377c0..e2de71761 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -279,6 +279,7 @@ class IOTA extends CI_Model { $bandslots = $this->bands->get_worked_bands('iota'); $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -305,6 +306,7 @@ class IOTA extends CI_Model { $bandslots = $this->bands->get_worked_bands('iota'); $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'";