From 1023ffafab4fc34e71ba55dcac958364048fecdb Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 22 Nov 2023 06:04:58 +0000 Subject: [PATCH 01/11] Splitted VUCC into real VUCC and SAT-VUCC at Dashboard --- application/controllers/Dashboard.php | 1 + application/models/Vucc.php | 77 ++++++++++++++------------- application/views/dashboard/index.php | 9 ++-- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index 6f4f1b36..8a238d6f 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -110,6 +110,7 @@ class Dashboard extends CI_Controller { $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array); $data['vucc'] = $this->vucc->fetchVuccSummary(); + $data['vuccSAT'] = $this->vucc->fetchVuccSummary('SAT'); $data['page_title'] = "Dashboard"; diff --git a/application/models/Vucc.php b/application/models/Vucc.php index 148feb60..feb4da43 100644 --- a/application/models/Vucc.php +++ b/application/models/Vucc.php @@ -144,43 +144,44 @@ class VUCC extends CI_Model * $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed */ function get_vucc_summary($band, $confirmationMethod) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $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; - } + if (!$logbooks_locations_array) { + return null; + } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $sql = "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare - from " . $this->config->item('table_name') . - " where station_id in (" . $location_list . ")" . - " and col_gridsquare <> ''"; + $sql = "select distinct upper(substring(log.col_gridsquare, 1, 4)) gridsquare + from " . $this->config->item('table_name') . " log". + " inner join bands b on (b.band = log.col_band) ". + " where log.station_id in (" . $location_list . ")" . + " and log.col_gridsquare <> ''". + " and b.bandgroup in ('vhf','uhf','shf','sat')"; - if ($confirmationMethod == 'both') { - $sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')"; - } - else if ($confirmationMethod == 'qsl') { - $sql .= " and col_qsl_rcvd='Y'"; - } - else if ($confirmationMethod == 'lotw') { - $sql .= " and col_lotw_qsl_rcvd='Y'"; - } + if ($confirmationMethod == 'both') { + $sql .= " and (log.col_qsl_rcvd='Y' or log.col_lotw_qsl_rcvd='Y')"; + } else if ($confirmationMethod == 'qsl') { + $sql .= " and log.col_qsl_rcvd='Y'"; + } else if ($confirmationMethod == 'lotw') { + $sql .= " and log.col_lotw_qsl_rcvd='Y'"; + } - if ($band != 'All') { - if ($band == 'SAT') { - $sql .= " and col_prop_mode ='" . $band . "'"; - } else { - $sql .= " and col_prop_mode !='SAT'"; - $sql .= " and col_band ='" . $band . "'"; - } - } + if ($band != 'All') { + if ($band == 'SAT') { + $sql .= " and log.col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and log.col_prop_mode !='SAT'"; + $sql .= " and log.col_band ='" . $band . "'"; + } + } else { + $sql .= " and log.col_prop_mode !='SAT'"; + } + $query = $this->db->query($sql); - $query = $this->db->query($sql); - - return $query->result_array(); + return $query->result_array(); } /* @@ -333,12 +334,12 @@ class VUCC extends CI_Model /* * Builds the array to display worked/confirmed vucc on dashboard page */ - function fetchVuccSummary() { + function fetchVuccSummary($band = 'All') { $totalGridConfirmed = array(); $totalGridWorked = array(); // Getting all the worked grids - $col_gridsquare_worked = $this->get_vucc_summary('All', 'none'); + $col_gridsquare_worked = $this->get_vucc_summary($band, 'none'); $workedGridArray = array(); if ($col_gridsquare_worked != null) { @@ -350,7 +351,7 @@ class VUCC extends CI_Model } } - $col_vucc_grids_worked = $this->get_vucc_summary_col_vucc('All', 'none'); + $col_vucc_grids_worked = $this->get_vucc_summary_col_vucc($band, 'none'); if ($col_vucc_grids_worked != null) { foreach ($col_vucc_grids_worked as $gridSplit) { @@ -370,7 +371,7 @@ class VUCC extends CI_Model } // Getting all the confirmed grids - $col_gridsquare_confirmed = $this->get_vucc_summary('All', 'both'); + $col_gridsquare_confirmed = $this->get_vucc_summary($band, 'both'); if ($col_gridsquare_confirmed != null) { $confirmedGridArray = array(); @@ -382,7 +383,7 @@ class VUCC extends CI_Model } } - $col_vucc_grids_confirmed = $this->get_vucc_summary_col_vucc('All', 'both'); + $col_vucc_grids_confirmed = $this->get_vucc_summary_col_vucc($band, 'both'); if ($col_vucc_grids_confirmed != null) { foreach ($col_vucc_grids_confirmed as $gridSplit) { @@ -401,8 +402,8 @@ class VUCC extends CI_Model } } - $vuccArray['All']['worked'] = count($totalGridWorked); - $vuccArray['All']['confirmed'] = count($totalGridConfirmed); + $vuccArray[$band]['worked'] = count($totalGridWorked); + $vuccArray[$band]['confirmed'] = count($totalGridConfirmed); return $vuccArray; } diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 2e66e543..21a5593a 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -308,17 +308,20 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE)) { ?> - + + - + + - + +
VHF/UHF Century Club (VUCC) VUCC-GridsSAT
From b674dd21fda45232d7f2e22f8ae5463c8f791b9a Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 22 Nov 2023 06:40:19 +0000 Subject: [PATCH 02/11] Suppress Bands without QSOs (since the SQL doesn't deliver them) --- application/views/awards/vucc/index.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/application/views/awards/vucc/index.php b/application/views/awards/vucc/index.php index cf3b8f3e..02773306 100644 --- a/application/views/awards/vucc/index.php +++ b/application/views/awards/vucc/index.php @@ -25,11 +25,13 @@ $vucc) { - echo ''; - echo ''. $band .''; - echo ''. $vucc['worked'] .''; - echo ''. $vucc['confirmed'] .''; - echo ''; + if ($vucc['worked'] > 0) { + echo ''; + echo ''. $band .''; + echo ''. $vucc['worked'] .''; + echo ''. $vucc['confirmed'] .''; + echo ''; + } } ?> @@ -38,4 +40,4 @@ ×Nothing found!'; } ?> - \ No newline at end of file + From 71c884ee54766f7331f510c04d9bb07baff1c511 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Wed, 22 Nov 2023 07:53:38 +0100 Subject: [PATCH 03/11] fix vucc link --- application/language/bulgarian/awards_lang.php | 2 +- application/language/chinese_simplified/awards_lang.php | 2 +- application/language/czech/awards_lang.php | 2 +- application/language/dutch/awards_lang.php | 2 +- application/language/english/awards_lang.php | 2 +- application/language/finnish/awards_lang.php | 2 +- application/language/french/awards_lang.php | 2 +- application/language/greek/awards_lang.php | 2 +- application/language/italian/awards_lang.php | 2 +- application/language/polish/awards_lang.php | 2 +- application/language/russian/awards_lang.php | 2 +- application/language/spanish/awards_lang.php | 2 +- application/language/swedish/awards_lang.php | 2 +- application/language/turkish/awards_lang.php | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/language/bulgarian/awards_lang.php b/application/language/bulgarian/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/bulgarian/awards_lang.php +++ b/application/language/bulgarian/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/chinese_simplified/awards_lang.php b/application/language/chinese_simplified/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/chinese_simplified/awards_lang.php +++ b/application/language/chinese_simplified/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/czech/awards_lang.php b/application/language/czech/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/czech/awards_lang.php +++ b/application/language/czech/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/dutch/awards_lang.php b/application/language/dutch/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/dutch/awards_lang.php +++ b/application/language/dutch/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/english/awards_lang.php b/application/language/english/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/english/awards_lang.php +++ b/application/language/english/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/finnish/awards_lang.php b/application/language/finnish/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/finnish/awards_lang.php +++ b/application/language/finnish/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/french/awards_lang.php b/application/language/french/awards_lang.php index 6da125f3..ed0b29d5 100644 --- a/application/language/french/awards_lang.php +++ b/application/language/french/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/greek/awards_lang.php b/application/language/greek/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/greek/awards_lang.php +++ b/application/language/greek/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/italian/awards_lang.php b/application/language/italian/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/italian/awards_lang.php +++ b/application/language/italian/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/polish/awards_lang.php b/application/language/polish/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/polish/awards_lang.php +++ b/application/language/polish/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/russian/awards_lang.php b/application/language/russian/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/russian/awards_lang.php +++ b/application/language/russian/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/spanish/awards_lang.php b/application/language/spanish/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/spanish/awards_lang.php +++ b/application/language/spanish/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/swedish/awards_lang.php b/application/language/swedish/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/swedish/awards_lang.php +++ b/application/language/swedish/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; diff --git a/application/language/turkish/awards_lang.php b/application/language/turkish/awards_lang.php index 611ee016..00bf3286 100644 --- a/application/language/turkish/awards_lang.php +++ b/application/language/turkish/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "The VHF/UHF Century Club Award is given for a minimum number of worked and confirmed gridsquares on a desired band."; -$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; +$lang['awards_vucc_description_ln3'] = "Official information and the rules can be found in this document: Click here."; $lang['awards_vucc_description_ln4'] = "Only VHF/UHF bands are relevant."; From 8b1646f4309d0138667ade3df0d925876a3a2d0d Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 22 Nov 2023 06:56:19 +0000 Subject: [PATCH 04/11] Display HF too at VUCC-Awards-page --- application/models/Vucc.php | 7 +++++-- application/views/awards/vucc/index.php | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application/models/Vucc.php b/application/models/Vucc.php index feb4da43..8aba12a1 100644 --- a/application/models/Vucc.php +++ b/application/models/Vucc.php @@ -158,8 +158,11 @@ class VUCC extends CI_Model from " . $this->config->item('table_name') . " log". " inner join bands b on (b.band = log.col_band) ". " where log.station_id in (" . $location_list . ")" . - " and log.col_gridsquare <> ''". - " and b.bandgroup in ('vhf','uhf','shf','sat')"; + " and log.col_gridsquare <> ''"; + + if (($band == 'SAT') || ($band == 'All')) { + $sql.=" and b.bandgroup in ('vhf','uhf','shf','sat')"; + } if ($confirmationMethod == 'both') { $sql .= " and (log.col_qsl_rcvd='Y' or log.col_lotw_qsl_rcvd='Y')"; diff --git a/application/views/awards/vucc/index.php b/application/views/awards/vucc/index.php index 02773306..df02817f 100644 --- a/application/views/awards/vucc/index.php +++ b/application/views/awards/vucc/index.php @@ -25,13 +25,11 @@ $vucc) { - if ($vucc['worked'] > 0) { echo ''; echo ''. $band .''; echo ''. $vucc['worked'] .''; echo ''. $vucc['confirmed'] .''; echo ''; - } } ?> From 42adc9027d374dae222d62de826b92bc9109df85 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Wed, 22 Nov 2023 20:26:44 +0100 Subject: [PATCH 05/11] vucc link fix --- application/language/german/awards_lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/language/german/awards_lang.php b/application/language/german/awards_lang.php index 8c70fe17..ea70866a 100644 --- a/application/language/german/awards_lang.php +++ b/application/language/german/awards_lang.php @@ -156,7 +156,7 @@ ________________________________________________________________________________ $lang['awards_vucc_description_ln1'] = "VUCC - VHF/UHF Century Club Award"; $lang['awards_vucc_description_ln2'] = "Der VHF/UHF Century Club Award wird für eine Mindestanzahl von gearbeiteten und bestätigten Gitterquadraten auf einem gewünschten Band verliehen."; -$lang['awards_vucc_description_ln3'] = "Offizielle Informationen und Regeln finden Sie in diesem Dokument: Klick hier.."; +$lang['awards_vucc_description_ln3'] = "Offizielle Informationen und Regeln finden Sie in diesem Dokument: Klick hier.."; $lang['awards_vucc_description_ln4'] = "Nur VHF/UHF-Bänder sind relevant."; From ae2bd9ee94222703478f3870a7c493270072e67e Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:14:37 +0100 Subject: [PATCH 06/11] Added support for custom js --- .gitignore | 1 + application/views/interface_assets/header.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ca591b75..39d9a71b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /images/eqsl_card_images/*.jpg /updates/clublog_scp.txt /assets/qslcard/* +/assets/js/sections/custom.js .idea/* .DS_Store sync.sh diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 3bc9bab9..fc639de1 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -9,7 +9,7 @@ - + optionslib->get_theme()) { ?> @@ -54,6 +54,10 @@ echo ''; } ?> + '; + } ?> + <?php if (isset($page_title)) { @@ -416,4 +420,4 @@ </div> </div> - </nav> \ No newline at end of file + </nav> From 43c44bdd02b4da2aa22443d44606e11d2f323552 Mon Sep 17 00:00:00 2001 From: Peter Goodhall <peter@magicbug.co.uk> Date: Thu, 23 Nov 2023 14:19:10 +0000 Subject: [PATCH 07/11] [DXpedition] Create a dxpedition table Creates a dxpedition table this will be used to store upcoming dxpedition data from external sources. --- application/config/migration.php | 2 +- .../154_create_dxpedition_table.php | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 application/migrations/154_create_dxpedition_table.php diff --git a/application/config/migration.php b/application/config/migration.php index 4a7774a3..98fd0f82 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 153; +$config['migration_version'] = 154; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/154_create_dxpedition_table.php b/application/migrations/154_create_dxpedition_table.php new file mode 100644 index 00000000..55974079 --- /dev/null +++ b/application/migrations/154_create_dxpedition_table.php @@ -0,0 +1,59 @@ +<?php + +defined('BASEPATH') or exit('No direct script access allowed'); + +/* +* Create a dxpedition table +*/ + +class Migration_create_dxpedition_table extends CI_Migration +{ + + public function up() + { + /* check if the dxpedition table exists if not create dxpedition table */ + if (!$this->db->table_exists('dxpedition')) { + + $this->dbforge->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 6, + 'unsigned' => TRUE, + 'auto_increment' => TRUE + ), + 'start_date' => array( + 'type' => 'DATE', + 'null' => TRUE, + ), + 'end_date' => array( + 'type' => 'DATE', + 'null' => TRUE, + ), + 'callsign' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE, + ), + 'country' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE, + ), + 'notes' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE, + ), + )); + $this->dbforge->add_key('id', TRUE); + $this->dbforge->add_key('callsign', TRUE); + + $this->dbforge->create_table('dxpedition'); + } + } + + public function down() + { + $this->dbforge->drop_table('dxpedition'); + } +} From b9941891ea8b72e61e94e95f4f350a0d2713af47 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:36:58 +0100 Subject: [PATCH 08/11] [Advanced Logbook] Removed reset on dupesearch. Reset triggers a search, and can't use filters --- assets/js/sections/logbookadvanced.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index b1366489..4c7e7579 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -594,7 +594,6 @@ $(document).ready(function () { }); function dupeSearch() { - $('#searchForm').trigger("reset"); $("#dupes").val("Y"); $('#searchForm').submit(); } From a2f1e4f603b0691f00eb8de27741a2c554d4fe4b Mon Sep 17 00:00:00 2001 From: phl0 <github@florian-wolters.de> Date: Thu, 23 Nov 2023 20:43:45 +0100 Subject: [PATCH 09/11] Concat QSO IDs in PHP rather than SQL --- application/models/Logbookadvanced_model.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 321dd3d8..b89c7f8c 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -8,14 +8,15 @@ class Logbookadvanced_model extends CI_Model { $binding = [$searchCriteria['user_id']]; if ((isset($searchCriteria['dupes'])) && ($searchCriteria['dupes'] !== '')) { - $id_sql="select group_concat(x.qsoids separator ',') as QSO_IDs from ( - select GROUP_CONCAT(col_primary_key separator ',') as qsoids, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, min(col_time_on) Mintime, max(col_time_on) Maxtime from " . $this->config->item('table_name') . " + $id_sql="select GROUP_CONCAT(col_primary_key separator ',') as qsoids, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, min(col_time_on) Mintime, max(col_time_on) Maxtime from " . $this->config->item('table_name') . " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id where station_profile.user_id=? - group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000) x"; + group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000"; $id_query = $this->db->query($id_sql, $searchCriteria['user_id']); + $ids2fetch = ''; foreach ($id_query->result() as $id) { - $ids2fetch=$id->QSO_IDs; + $ids2fetch .= ','.$id->qsoids; } + $ids2fetch = ltrim($ids2fetch, ','); if ($ids2fetch ?? '' !== '') { $conditions[] = "qsos.COL_PRIMARY_KEY in (".$ids2fetch.")"; } else { @@ -23,8 +24,8 @@ class Logbookadvanced_model extends CI_Model { } } - if ($searchCriteria['dateFrom'] !== '') { - $from = DateTime::createFromFormat('d/m/Y', $searchCriteria['dateFrom']); + if ($searchCriteria['dateFrom'] !== '') { + $from = DateTime::createFromFormat('d/m/Y', $searchCriteria['dateFrom']); $from = $from->format('Y-m-d'); $conditions[] = "date(COL_TIME_ON) >= ?"; $binding[] = $from; From c3b847b9a30e1034fbcbbcc11cf78d1d24955739 Mon Sep 17 00:00:00 2001 From: phl0 <github@florian-wolters.de> Date: Fri, 24 Nov 2023 07:44:46 +0100 Subject: [PATCH 10/11] Fix SQL errors on migration --- application/migrations/154_create_dxpedition_table.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/migrations/154_create_dxpedition_table.php b/application/migrations/154_create_dxpedition_table.php index 55974079..a10562ea 100644 --- a/application/migrations/154_create_dxpedition_table.php +++ b/application/migrations/154_create_dxpedition_table.php @@ -19,7 +19,8 @@ class Migration_create_dxpedition_table extends CI_Migration 'type' => 'INT', 'constraint' => 6, 'unsigned' => TRUE, - 'auto_increment' => TRUE + 'auto_increment' => TRUE, + 'null' => FALSE ), 'start_date' => array( 'type' => 'DATE', @@ -32,7 +33,7 @@ class Migration_create_dxpedition_table extends CI_Migration 'callsign' => array( 'type' => 'VARCHAR', 'constraint' => '255', - 'null' => TRUE, + 'null' => FALSE, ), 'country' => array( 'type' => 'VARCHAR', From 882b8fd0da5ee0c3e468b6e232e3574a02738ae7 Mon Sep 17 00:00:00 2001 From: phl0 <github@florian-wolters.de> Date: Fri, 24 Nov 2023 08:25:49 +0100 Subject: [PATCH 11/11] Use Ymd as file name to make sorting easier --- application/views/adif/data/exportall.php | 2 +- application/views/adif/data/exportsat.php | 2 +- application/views/cabrillo/export.php | 4 ++-- application/views/csv/data/export.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/views/adif/data/exportall.php b/application/views/adif/data/exportall.php index 76dd8413..7c8b58da 100644 --- a/application/views/adif/data/exportall.php +++ b/application/views/adif/data/exportall.php @@ -1,6 +1,6 @@ <?php header('Content-Type: text/plain; charset=utf-8'); - header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-'.date('dmY-Hi').'.adi"') + header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-'.date('Ymd-Hi').'.adi"') ?> Cloudlog ADIF export <ADIF_VER:5>3.1.4 diff --git a/application/views/adif/data/exportsat.php b/application/views/adif/data/exportsat.php index 76dd8413..7c8b58da 100644 --- a/application/views/adif/data/exportsat.php +++ b/application/views/adif/data/exportsat.php @@ -1,6 +1,6 @@ <?php header('Content-Type: text/plain; charset=utf-8'); - header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-'.date('dmY-Hi').'.adi"') + header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-'.date('Ymd-Hi').'.adi"') ?> Cloudlog ADIF export <ADIF_VER:5>3.1.4 diff --git a/application/views/cabrillo/export.php b/application/views/cabrillo/export.php index 5b189564..64136eea 100644 --- a/application/views/cabrillo/export.php +++ b/application/views/cabrillo/export.php @@ -1,6 +1,6 @@ <?php header('Content-Type: text/plain; charset=utf-8'); -header('Content-Disposition: attachment; filename="'.$callsign.'-'.$contest_id.'-'.date('dmY-Hi').'.cbr"'); +header('Content-Disposition: attachment; filename="'.$callsign.'-'.$contest_id.'-'.date('Ymd-Hi').'.cbr"'); $CI =& get_instance(); $CI->load->library('Cabrilloformat'); @@ -11,4 +11,4 @@ echo $CI->cabrilloformat->header($contest_id, $callsign, $claimed_score, foreach ($qsos->result() as $row) { echo $CI->cabrilloformat->qso($row); } -echo $CI->cabrilloformat->footer(); \ No newline at end of file +echo $CI->cabrilloformat->footer(); diff --git a/application/views/csv/data/export.php b/application/views/csv/data/export.php index d6b1df2f..24b952ab 100644 --- a/application/views/csv/data/export.php +++ b/application/views/csv/data/export.php @@ -1,6 +1,6 @@ <?php header('Content-Type: text/plain; charset=utf-8'); - header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-SOTA-'.date('dmY-Hi').'.csv"'); + header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-SOTA-'.date('Ymd-Hi').'.csv"'); $CI =& get_instance(); $bands = array( "2190m" => "VLF",