From dd8526811dc09510c3d4465185ead5c06262570b Mon Sep 17 00:00:00 2001 From: HB9HIL <80885850+HB9HIL@users.noreply.github.com> Date: Mon, 5 Feb 2024 10:44:50 +0100 Subject: [PATCH] Dev (#3) * Added Windows, MariaDB and PHP-Versions * Release 1.0 * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay * [eQSL] only locations with a eQSL nickname should be displayed (#74) * only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import * add proper error message * improve usability --------- Co-authored-by: Christoph Kottke * html fixes * show flashdata if no station has eqsl nick * removed openssl check, not required * accumulate stats language * multilanguage support * prettier * Prevent leaking data out of other station_location * moved qrg to first tab * Fix a PHP 8.1 deprecated bug. * [Contesting] Fix for table qso count * Fixed error when data was empty. Also clear table before inserting again. * Refactor to get the table to load * Need to clear datatable when session is deleted * Prevent Racecondition * Fixed a few null-checks which will fail on fresh accounts * Allow for longer gridsquare in station profile * Show IOTA/SOTA ref on station location tab * [LBA] Fixed mapping of selected QSOs --------- Co-authored-by: int2001 Co-authored-by: Joerg (DJ7NT) Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke Co-authored-by: Florian (DF2ET) Co-authored-by: dg0tm --- application/controllers/Accumulated.php | 18 +- application/controllers/Eqsl.php | 6 +- application/controllers/Hrdlog.php | 8 +- application/controllers/Logbookadvanced.php | 2 +- application/controllers/Lotw.php | 20 +- application/controllers/Qrz.php | 7 +- .../language/bulgarian/general_words_lang.php | 4 + .../language/bulgarian/statistics_lang.php | 12 + .../chinese_simplified/general_words_lang.php | 4 + .../chinese_simplified/statistics_lang.php | 12 + .../language/czech/general_words_lang.php | 4 + .../language/czech/statistics_lang.php | 12 + .../language/dutch/general_words_lang.php | 4 + .../language/dutch/statistics_lang.php | 12 + .../language/english/general_words_lang.php | 4 + .../language/english/statistics_lang.php | 12 + .../language/finnish/general_words_lang.php | 4 + .../language/finnish/statistics_lang.php | 12 + .../language/french/general_words_lang.php | 4 + .../language/french/statistics_lang.php | 12 + .../language/german/general_words_lang.php | 4 + .../language/german/statistics_lang.php | 12 + .../language/greek/general_words_lang.php | 4 + .../language/greek/statistics_lang.php | 12 + .../language/italian/general_words_lang.php | 4 + .../language/italian/statistics_lang.php | 12 + .../language/polish/general_words_lang.php | 4 + .../language/polish/statistics_lang.php | 12 + .../language/russian/general_words_lang.php | 4 + .../language/russian/statistics_lang.php | 12 + .../language/spanish/general_words_lang.php | 4 + .../language/spanish/statistics_lang.php | 12 + .../language/swedish/general_words_lang.php | 4 + .../language/swedish/statistics_lang.php | 12 + .../language/turkish/general_words_lang.php | 4 + .../language/turkish/statistics_lang.php | 12 + application/models/Accumulate_model.php | 419 +++++++++--------- application/models/Distances_model.php | 15 +- application/models/Logbook_model.php | 36 +- application/views/accumulate/index.php | 163 +++---- application/views/debug/main.php | 11 - application/views/eqsl/import.php | 17 +- application/views/qso/index.php | 13 +- .../views/search/search_result_ajax.php | 2 +- application/views/view_log/qso.php | 14 + assets/js/sections/accumulatedstatistics.js | 172 ++++--- assets/js/sections/contesting.js | 130 +++--- assets/js/sections/logbookadvanced.js | 3 +- 48 files changed, 806 insertions(+), 490 deletions(-) diff --git a/application/controllers/Accumulated.php b/application/controllers/Accumulated.php index 152d5abff..df442d870 100644 --- a/application/controllers/Accumulated.php +++ b/application/controllers/Accumulated.php @@ -1,20 +1,24 @@ load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if (!$this->user_model->authorize(2)) { + $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + redirect('dashboard'); + } } public function index() { // Render Page - $data['page_title'] = "Accumulated Statistics"; + $data['page_title'] = $this->lang->line('menu_accumulated_statistics'); $this->load->model('bands'); @@ -32,7 +36,8 @@ class Accumulated extends CI_Controller { /* * Used for ajax-call in javascript to fetch the data and insert into table and chart */ - public function get_accumulated_data(){ + public function get_accumulated_data() + { //load model $this->load->model('accumulate_model'); $band = $this->input->post('Band'); @@ -45,5 +50,4 @@ class Accumulated extends CI_Controller { header('Content-Type: application/json'); echo json_encode($data); } - -} \ No newline at end of file +} diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 4138cf22f..b708d6fe5 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -41,8 +41,7 @@ class eqsl extends CI_Controller { $this->load->model('eqslmethods_model'); $eqsl_locations = $this->eqslmethods_model->all_of_user_with_eqsl_nick_defined(); if($eqsl_locations->num_rows() == 0) { - show_error("eQSL Nicknames in Station Profiles aren't defined"); - exit; + $this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!'); } ini_set('memory_limit', '-1'); @@ -131,8 +130,7 @@ class eqsl extends CI_Controller { // Check if eQSL Nicknames have been defined $this->load->model('stations'); if($this->stations->are_eqsl_nicks_defined() == 0) { - show_error('eQSL Nicknames in Station Profiles arent defined'); - exit; + $this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!'); } ini_set('memory_limit', '-1'); diff --git a/application/controllers/Hrdlog.php b/application/controllers/Hrdlog.php index e1544c0ae..934cd1b2e 100644 --- a/application/controllers/Hrdlog.php +++ b/application/controllers/Hrdlog.php @@ -165,10 +165,12 @@ class Hrdlog extends CI_Controller { $this->load->model('logbook_model'); - foreach ($data['qsos']->result() as $qso) + if (isset($data['qsos'])) { + foreach ($data['qsos']->result() as $qso) { - $this->logbook_model->mark_hrdlog_qsos_sent($qso->COL_PRIMARY_KEY); - } + $this->logbook_model->mark_hrdlog_qsos_sent($qso->COL_PRIMARY_KEY); + } + } $this->load->view('interface_assets/header', $data); $this->load->view('hrdlog/mark_hrdlog', $data); diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 9ef90bd40..00663925e 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -256,7 +256,7 @@ class Logbookadvanced extends CI_Controller { 'user_id' => (int)$this->session->userdata('user_id'), 'dateFrom' => '', 'dateTo' => '', - 'de' => '', + 'de' => (int)$this->input->post('de'), 'dx' => '', 'mode' => '', 'band' => '', diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 80859adc4..15a0adbb7 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -717,9 +717,9 @@ class Lotw extends CI_Controller { // Get credentials for LoTW $query = $this->user_model->get_by_id($this->session->userdata('user_id')); - $q = $query->row(); - $data['user_lotw_name'] = urlencode($q->user_lotw_name); - $data['user_lotw_password'] = urlencode($q->user_lotw_password); + $q = $query->row(); + $data['user_lotw_name'] = urlencode($q->user_lotw_name ?? ''); + $data['user_lotw_password'] = urlencode($q->user_lotw_password ?? ''); // Get URL for downloading LoTW $query = $query = $this->db->query('SELECT lotw_download_url FROM config'); @@ -733,15 +733,15 @@ class Lotw extends CI_Controller { $this->session->set_flashdata('warning', 'You have not defined your ARRL LoTW credentials!'); redirect('lotw/import'); } - $customDate = $this->input->post('from'); + $customDate = $this->input->post('from'); if ($customDate != NULL) { - $lotw_last_qsl_date = date($customDate); - } - else { - // Query the logbook to determine when the last LoTW confirmation was - $lotw_last_qsl_date = date('Y-m-d', strtotime($this->logbook_model->lotw_last_qsl_date($this->session->userdata['user_id']))); - } + $lotw_last_qsl_date = date($customDate); + } + else { + // Query the logbook to determine when the last LoTW confirmation was + $lotw_last_qsl_date = date('Y-m-d', strtotime($this->logbook_model->lotw_last_qsl_date($this->session->userdata['user_id']))); + } // Build URL for LoTW report file $lotw_url .= "?"; diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index c2ea63fdc..290df4594 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -170,9 +170,10 @@ class Qrz extends CI_Controller { $this->load->model('logbook_model'); - foreach ($data['qsos']->result() as $qso) - { - $this->logbook_model->mark_qrz_qsos_sent($qso->COL_PRIMARY_KEY); + if (isset($data['qsos'])) { + foreach ($data['qsos']->result() as $qso) { + $this->logbook_model->mark_qrz_qsos_sent($qso->COL_PRIMARY_KEY); + } } $this->load->view('interface_assets/header', $data); diff --git a/application/language/bulgarian/general_words_lang.php b/application/language/bulgarian/general_words_lang.php index 3f6bcd7f4..069f1ce8c 100644 --- a/application/language/bulgarian/general_words_lang.php +++ b/application/language/bulgarian/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Година'; $lang['general_word_month'] = 'Месец'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/bulgarian/statistics_lang.php b/application/language/bulgarian/statistics_lang.php index 97a2f0b93..d83be79c1 100644 --- a/application/language/bulgarian/statistics_lang.php +++ b/application/language/bulgarian/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/chinese_simplified/general_words_lang.php b/application/language/chinese_simplified/general_words_lang.php index 0726eed2c..e2a286e74 100644 --- a/application/language/chinese_simplified/general_words_lang.php +++ b/application/language/chinese_simplified/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = '后一项'; $lang['general_word_previous'] = '前一项'; $lang['general_word_cancel'] = "取消"; $lang['general_word_ok'] = "确认"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "注意"; $lang['general_word_enabled'] = "已启用"; $lang['general_word_disabled'] = "已禁用"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = '年'; $lang['general_word_month'] = '月'; $lang['general_word_day'] = "日"; $lang['general_word_days'] = "天"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "颜色"; $lang['general_word_light'] = "浅色/高光"; diff --git a/application/language/chinese_simplified/statistics_lang.php b/application/language/chinese_simplified/statistics_lang.php index 6e8acf079..607a3256c 100644 --- a/application/language/chinese_simplified/statistics_lang.php +++ b/application/language/chinese_simplified/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "当前连续天数"; $lang['statistics_dwq_make_qso_to_extend_streak'] = "如果你今天进行了QSO,那么就能延长你的连续天数,否则将会被打破清零"; $lang['statistics_dwq_no_current_streak'] = "没有找到连续的天数"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/czech/general_words_lang.php b/application/language/czech/general_words_lang.php index 3be8b5faa..b9e7542ae 100644 --- a/application/language/czech/general_words_lang.php +++ b/application/language/czech/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Rok'; $lang['general_word_month'] = 'Měsíc'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/czech/statistics_lang.php b/application/language/czech/statistics_lang.php index f636a7d14..8ec5bce3b 100644 --- a/application/language/czech/statistics_lang.php +++ b/application/language/czech/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/dutch/general_words_lang.php b/application/language/dutch/general_words_lang.php index 88457f533..725e26bcf 100644 --- a/application/language/dutch/general_words_lang.php +++ b/application/language/dutch/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Jaar'; $lang['general_word_month'] = 'Maand'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/dutch/statistics_lang.php b/application/language/dutch/statistics_lang.php index 62bfe00dd..1251eb082 100644 --- a/application/language/dutch/statistics_lang.php +++ b/application/language/dutch/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index 60340fc9f..36287942b 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Year'; $lang['general_word_month'] = 'Month'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/english/statistics_lang.php b/application/language/english/statistics_lang.php index c995c0f2a..a861bd426 100644 --- a/application/language/english/statistics_lang.php +++ b/application/language/english/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/finnish/general_words_lang.php b/application/language/finnish/general_words_lang.php index 54934250d..0963cfe05 100644 --- a/application/language/finnish/general_words_lang.php +++ b/application/language/finnish/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Vuosi'; $lang['general_word_month'] = 'Kuukausi'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/finnish/statistics_lang.php b/application/language/finnish/statistics_lang.php index c5b611023..37bdd4a71 100644 --- a/application/language/finnish/statistics_lang.php +++ b/application/language/finnish/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/french/general_words_lang.php b/application/language/french/general_words_lang.php index d85e944eb..dc5b2961f 100644 --- a/application/language/french/general_words_lang.php +++ b/application/language/french/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = "Suivant"; $lang['general_word_previous'] = "Précédent"; $lang['general_word_cancel'] = "Annuler"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Activé"; $lang['general_word_disabled'] = "Désactivé"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = "Année"; $lang['general_word_month'] = "Mois"; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Couleurs"; $lang['general_word_light'] = "Lumière/Laser"; diff --git a/application/language/french/statistics_lang.php b/application/language/french/statistics_lang.php index c9631523d..b55004c83 100644 --- a/application/language/french/statistics_lang.php +++ b/application/language/french/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/german/general_words_lang.php b/application/language/german/general_words_lang.php index 58d8c9ba7..0d28c5d5f 100644 --- a/application/language/german/general_words_lang.php +++ b/application/language/german/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Weiter'; $lang['general_word_previous'] = 'Zurück'; $lang['general_word_cancel'] = "Abbrechen"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Anzeigen"; $lang['general_word_attention'] = "Achtung"; $lang['general_word_enabled'] = "Eingeschaltet"; $lang['general_word_disabled'] = "Ausgeschaltet"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Jahr'; $lang['general_word_month'] = 'Monat'; $lang['general_word_day'] = "Tag"; $lang['general_word_days'] = "Tage"; +$lang['general_word_period'] = "Zeitraum"; +$lang['general_word_yearly'] = "jährlich"; +$lang['general_word_monthly'] = "monatlich"; $lang['general_word_colors'] = "Farben"; $lang['general_word_light'] = "Licht/Laser"; diff --git a/application/language/german/statistics_lang.php b/application/language/german/statistics_lang.php index f91e0d988..ba6260892 100644 --- a/application/language/german/statistics_lang.php +++ b/application/language/german/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Aktuelle Serie (fortla $lang['statistics_dwq_make_qso_to_extend_streak'] = "Wenn Sie heute ein QSO machen, können Sie Ihre Serie verlängern... Andernfalls wird Ihre aktuelle Serie unterbrochen!"; $lang['statistics_dwq_no_current_streak'] = "Keine aktuelle Serie gefunden!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Kumulierte Statistik gearbeiteter DXCC"; +$lang['statistics_accumulated_worked_states'] = "Kumulierte Statistik gearbeiteter US Staaten"; +$lang['statistics_accumulated_worked_iota'] = "Kumulierte Statistik gearbeiteter IOTA"; +$lang['statistics_accumulated_worked_cqzone'] = "Kumulierte Statistik gearbeiteter CQ Zonen"; + + diff --git a/application/language/greek/general_words_lang.php b/application/language/greek/general_words_lang.php index d8338ed90..e28c2c380 100644 --- a/application/language/greek/general_words_lang.php +++ b/application/language/greek/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Ετος'; $lang['general_word_month'] = 'Μήνας'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/greek/statistics_lang.php b/application/language/greek/statistics_lang.php index c995c0f2a..a861bd426 100644 --- a/application/language/greek/statistics_lang.php +++ b/application/language/greek/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/italian/general_words_lang.php b/application/language/italian/general_words_lang.php index 95eeba3d6..be073d51d 100644 --- a/application/language/italian/general_words_lang.php +++ b/application/language/italian/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Anno'; $lang['general_word_month'] = 'Mese'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/italian/statistics_lang.php b/application/language/italian/statistics_lang.php index c995c0f2a..a861bd426 100644 --- a/application/language/italian/statistics_lang.php +++ b/application/language/italian/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/polish/general_words_lang.php b/application/language/polish/general_words_lang.php index 9ce44d79c..5c7a0bcf2 100644 --- a/application/language/polish/general_words_lang.php +++ b/application/language/polish/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Rok'; $lang['general_word_month'] = 'Miesiąc'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/polish/statistics_lang.php b/application/language/polish/statistics_lang.php index c995c0f2a..a861bd426 100644 --- a/application/language/polish/statistics_lang.php +++ b/application/language/polish/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/russian/general_words_lang.php b/application/language/russian/general_words_lang.php index b8e58246f..92c5305cb 100644 --- a/application/language/russian/general_words_lang.php +++ b/application/language/russian/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'След.'; $lang['general_word_previous'] = 'Пред.'; $lang['general_word_cancel'] = "Отмена"; $lang['general_word_ok'] = "ОК"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Внимание"; $lang['general_word_enabled'] = "Включено"; $lang['general_word_disabled'] = "Выключено"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Год'; $lang['general_word_month'] = 'Месяц'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Цвета"; $lang['general_word_light'] = "Свет/лазер"; diff --git a/application/language/russian/statistics_lang.php b/application/language/russian/statistics_lang.php index 2e9efab2c..b14a00c8d 100644 --- a/application/language/russian/statistics_lang.php +++ b/application/language/russian/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/spanish/general_words_lang.php b/application/language/spanish/general_words_lang.php index d662499a4..cb326841b 100644 --- a/application/language/spanish/general_words_lang.php +++ b/application/language/spanish/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Siguiente'; $lang['general_word_previous'] = 'Anterior'; $lang['general_word_cancel'] = "Cancelar"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Atención"; $lang['general_word_enabled'] = "Activado"; @@ -51,6 +52,9 @@ $lang['general_word_total'] = 'Total'; $lang['general_word_year'] = 'Año'; $lang['general_word_month'] = 'Mes'; $lang['general_word_day'] = "Day"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_days'] = "Days"; $lang['general_word_colors'] = "Colores"; diff --git a/application/language/spanish/statistics_lang.php b/application/language/spanish/statistics_lang.php index 034e83168..bcb8a5649 100644 --- a/application/language/spanish/statistics_lang.php +++ b/application/language/spanish/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/swedish/general_words_lang.php b/application/language/swedish/general_words_lang.php index 5e90e0d3f..91391f286 100644 --- a/application/language/swedish/general_words_lang.php +++ b/application/language/swedish/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_choose_file'] = 'Välj fil'; $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_not_display'] = "Not display"; +$lang['general_word_show'] = "Show"; $lang['general_word_icon'] = "Icon"; $lang['general_word_cancel'] = "Cancel"; @@ -51,6 +52,9 @@ $lang['general_word_city'] = 'City'; $lang['general_word_total'] = 'Totalt'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_year'] = 'I år'; $lang['general_word_month'] = 'Denna månad'; diff --git a/application/language/swedish/statistics_lang.php b/application/language/swedish/statistics_lang.php index 054191326..936fd6e13 100644 --- a/application/language/swedish/statistics_lang.php +++ b/application/language/swedish/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/language/turkish/general_words_lang.php b/application/language/turkish/general_words_lang.php index bfe432b1d..47f2eee90 100644 --- a/application/language/turkish/general_words_lang.php +++ b/application/language/turkish/general_words_lang.php @@ -17,6 +17,7 @@ $lang['general_word_next'] = 'Next'; $lang['general_word_previous'] = 'Previous'; $lang['general_word_cancel'] = "Cancel"; $lang['general_word_ok'] = "OK"; +$lang['general_word_show'] = "Show"; $lang['general_word_attention'] = "Attention"; $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; @@ -51,6 +52,9 @@ $lang['general_word_year'] = 'Yıl'; $lang['general_word_month'] = 'Ay'; $lang['general_word_day'] = "Day"; $lang['general_word_days'] = "Days"; +$lang['general_word_period'] = "Period"; +$lang['general_word_yearly'] = "Yearly"; +$lang['general_word_monthly'] = "Monthly"; $lang['general_word_colors'] = "Colors"; $lang['general_word_light'] = "Light/Laser"; diff --git a/application/language/turkish/statistics_lang.php b/application/language/turkish/statistics_lang.php index c995c0f2a..a861bd426 100644 --- a/application/language/turkish/statistics_lang.php +++ b/application/language/turkish/statistics_lang.php @@ -58,3 +58,15 @@ $lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (contin $lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; $lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +/* +* +* Accumulated Stats +* +*/ + +$lang['statistics_accumulated_worked_dxcc'] = "Accumulated Number of DXCCs worked"; +$lang['statistics_accumulated_worked_states'] = "Accumulated Number of States worked"; +$lang['statistics_accumulated_worked_iota'] = "Accumulated Number of IOTAs worked"; +$lang['statistics_accumulated_worked_cqzone'] = "Accumulated Number of CQ Zones worked"; + + diff --git a/application/models/Accumulate_model.php b/application/models/Accumulate_model.php index fe4cfca90..63685108a 100644 --- a/application/models/Accumulate_model.php +++ b/application/models/Accumulate_model.php @@ -3,33 +3,41 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); class Accumulate_model extends CI_Model { - function get_accumulated_data($band, $award, $mode, $period) { - $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_accumulated_data($band, $award, $mode, $period) + { + $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 array(); } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; switch ($award) { - case 'dxcc': $result = $this->get_accumulated_dxcc($band, $mode, $period, $location_list); break; - case 'was': $result = $this->get_accumulated_was($band, $mode, $period, $location_list); break; - case 'iota': $result = $this->get_accumulated_iota($band, $mode, $period, $location_list); break; - case 'waz': $result = $this->get_accumulated_waz($band, $mode, $period, $location_list); break; + case 'dxcc': + $result = $this->get_accumulated_dxcc($band, $mode, $period, $location_list); + break; + case 'was': + $result = $this->get_accumulated_was($band, $mode, $period, $location_list); + break; + case 'iota': + $result = $this->get_accumulated_iota($band, $mode, $period, $location_list); + break; + case 'waz': + $result = $this->get_accumulated_waz($band, $mode, $period, $location_list); + break; } return $result; } - function get_accumulated_dxcc($band, $mode, $period, $location_list) { + function get_accumulated_dxcc($band, $mode, $period, $location_list) + { if ($period == "year") { $sql = "select year(thcv.col_time_on) year"; - } - else if ($period == "month") { - $sql = "select date_format(col_time_on, '%Y%m') year"; + } else if ($period == "month") { + $sql = "select date_format(col_time_on, '%Y-%m') year"; } $sql .= ", coalesce(y.tot, 0) tot @@ -40,14 +48,13 @@ class Accumulate_model extends CI_Model if ($period == "year") { $sql .= "year(col_time_on)"; - } - else if ($period == "month") { - $sql .= "date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= "date_format(col_time_on, '%Y-%m')"; } $sql .= " year, col_dxcc - from " . $this->config->item('table_name') . - " where col_dxcc > 0 and station_id in (". $location_list . ")"; + from " . $this->config->item('table_name') . + " where col_dxcc > 0 and station_id in (" . $location_list . ")"; if ($band != 'All') { if ($band == 'SAT') { @@ -58,47 +65,45 @@ class Accumulate_model extends CI_Model } } - if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; - } - - $sql .= " order by year - ) x - where not exists (select 1 from " . $this->config->item('table_name') . " where"; - - if ($period == "year") { - $sql .= " year(col_time_on) < year";; - } - else if ($period == "month") { - $sql .= " date_format(col_time_on, '%Y%m') < year";; - } - - $sql .= " and col_dxcc = x.col_dxcc"; - - 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 ($mode != 'All') { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - $sql .= " and station_id in (". $location_list . ")) + $sql .= " order by year + ) x + where not exists (select 1 from " . $this->config->item('table_name') . " where"; + + if ($period == "year") { + $sql .= " year(col_time_on) < year";; + } else if ($period == "month") { + $sql .= " date_format(col_time_on, '%Y-%m') < year";; + } + + $sql .= " and col_dxcc = x.col_dxcc"; + + 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 ($mode != 'All') { + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + } + + $sql .= " and station_id in (" . $location_list . ")) group by year order by year"; if ($period == "year") { $sql .= " ) y on year(thcv.col_time_on) = y.year"; + } else if ($period == "month") { + $sql .= " ) y on date_format(col_time_on, '%Y-%m') = y.year"; } - else if ($period == "month") { - $sql .= " ) y on date_format(col_time_on, '%Y%m') = y.year"; - } - + $sql .= " where thcv.col_dxcc > 0"; if ($band != 'All') { @@ -111,19 +116,17 @@ class Accumulate_model extends CI_Model } if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - - $sql .= " and station_id in (". $location_list . ")"; + + $sql .= " and station_id in (" . $location_list . ")"; if ($period == "year") { $sql .= " group by year(thcv.col_time_on), y.tot order by year(thcv.col_time_on)"; - } - - else if ($period == "month") { - $sql .= " group by date_format(col_time_on, '%Y%m'), y.tot - order by date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= " group by date_format(col_time_on, '%Y-%m'), y.tot + order by date_format(col_time_on, '%Y-%m')"; } $query = $this->db->query($sql); @@ -131,7 +134,8 @@ class Accumulate_model extends CI_Model return $this->count_and_add_accumulated_total($query->result()); } - function count_and_add_accumulated_total($array) { + function count_and_add_accumulated_total($array) + { $counter = 0; for ($i = 0; $i < count($array); $i++) { $array[$i]->total = $array[$i]->tot + $counter; @@ -140,12 +144,12 @@ class Accumulate_model extends CI_Model return $array; } - function get_accumulated_was($band, $mode, $period, $location_list) { + function get_accumulated_was($band, $mode, $period, $location_list) + { if ($period == "year") { $sql = "select year(thcv.col_time_on) year"; - } - else if ($period == "month") { - $sql = "select date_format(col_time_on, '%Y%m') year"; + } else if ($period == "month") { + $sql = "select date_format(col_time_on, '%Y-%m') year"; } $sql .= ", coalesce(y.tot, 0) tot @@ -156,14 +160,13 @@ class Accumulate_model extends CI_Model if ($period == "year") { $sql .= "year(col_time_on)"; - } - else if ($period == "month") { - $sql .= "date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= "date_format(col_time_on, '%Y-%m')"; } $sql .= " year, col_state - from " . $this->config->item('table_name') . - " where station_id in (". $location_list . ")"; + from " . $this->config->item('table_name') . + " where station_id in (" . $location_list . ")"; if ($band != 'All') { if ($band == 'SAT') { @@ -174,35 +177,6 @@ class Accumulate_model extends CI_Model } } - if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; - } - - $sql .= " and COL_DXCC in ('291', '6', '110')"; - $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; - - $sql .= " order by year - ) x - where not exists (select 1 from " . $this->config->item('table_name') . " where"; - - if ($period == "year") { - $sql .= " year(col_time_on) < year";; - } - else if ($period == "month") { - $sql .= " date_format(col_time_on, '%Y%m') < year";; - } - - $sql .= " and col_state = x.col_state"; - - 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 ($mode != 'All') { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } @@ -210,18 +184,17 @@ class Accumulate_model extends CI_Model $sql .= " and COL_DXCC in ('291', '6', '110')"; $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; - $sql .= " and station_id in (". $location_list . ")) - group by year - order by year"; + $sql .= " order by year + ) x + where not exists (select 1 from " . $this->config->item('table_name') . " where"; if ($period == "year") { - $sql .= " ) y on year(thcv.col_time_on) = y.year"; + $sql .= " year(col_time_on) < year";; + } else if ($period == "month") { + $sql .= " date_format(col_time_on, '%Y-%m') < year";; } - else if ($period == "month") { - $sql .= " ) y on date_format(col_time_on, '%Y%m') = y.year"; - } - - $sql .= " where station_id in (". $location_list . ")"; + + $sql .= " and col_state = x.col_state"; if ($band != 'All') { if ($band == 'SAT') { @@ -233,17 +206,43 @@ class Accumulate_model extends CI_Model } if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - + + $sql .= " and COL_DXCC in ('291', '6', '110')"; + $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; + + $sql .= " and station_id in (" . $location_list . ")) + group by year + order by year"; + + if ($period == "year") { + $sql .= " ) y on year(thcv.col_time_on) = y.year"; + } else if ($period == "month") { + $sql .= " ) y on date_format(col_time_on, '%Y-%m') = y.year"; + } + + $sql .= " where station_id in (" . $location_list . ")"; + + 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 ($mode != 'All') { + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + } + if ($period == "year") { $sql .= " group by year(thcv.col_time_on), y.tot order by year(thcv.col_time_on)"; - } - - else if ($period == "month") { - $sql .= " group by date_format(col_time_on, '%Y%m'), y.tot - order by date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= " group by date_format(col_time_on, '%Y-%m'), y.tot + order by date_format(col_time_on, '%Y-%m')"; } $query = $this->db->query($sql); @@ -251,12 +250,12 @@ class Accumulate_model extends CI_Model return $this->count_and_add_accumulated_total($query->result()); } - function get_accumulated_iota($band, $mode, $period, $location_list) { + function get_accumulated_iota($band, $mode, $period, $location_list) + { if ($period == "year") { $sql = "select year(thcv.col_time_on) year"; - } - else if ($period == "month") { - $sql = "select date_format(col_time_on, '%Y%m') year"; + } else if ($period == "month") { + $sql = "select date_format(col_time_on, '%Y-%m') year"; } $sql .= ", coalesce(y.tot, 0) tot @@ -267,14 +266,13 @@ class Accumulate_model extends CI_Model if ($period == "year") { $sql .= "year(col_time_on)"; - } - else if ($period == "month") { - $sql .= "date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= "date_format(col_time_on, '%Y-%m')"; } $sql .= " year, col_iota - from " . $this->config->item('table_name') . - " where station_id in (". $location_list . ")"; + from " . $this->config->item('table_name') . + " where station_id in (" . $location_list . ")"; if ($band != 'All') { if ($band == 'SAT') { @@ -285,48 +283,21 @@ class Accumulate_model extends CI_Model } } - if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; - } - - $sql .= " order by year - ) x - where not exists (select 1 from " . $this->config->item('table_name') . " where"; - - if ($period == "year") { - $sql .= " year(col_time_on) < year";; - } - else if ($period == "month") { - $sql .= " date_format(col_time_on, '%Y%m') < year";; - } - - $sql .= " and col_iota = x.col_iota"; - - 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 ($mode != 'All') { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - $sql .= " and station_id in (". $location_list . ")) - group by year - order by year"; + $sql .= " order by year + ) x + where not exists (select 1 from " . $this->config->item('table_name') . " where"; if ($period == "year") { - $sql .= " ) y on year(thcv.col_time_on) = y.year"; + $sql .= " year(col_time_on) < year";; + } else if ($period == "month") { + $sql .= " date_format(col_time_on, '%Y-%m') < year";; } - else if ($period == "month") { - $sql .= " ) y on date_format(col_time_on, '%Y%m') = y.year"; - } - - $sql .= " where station_id in (". $location_list . ")"; + + $sql .= " and col_iota = x.col_iota"; if ($band != 'All') { if ($band == 'SAT') { @@ -338,17 +309,40 @@ class Accumulate_model extends CI_Model } if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - + + $sql .= " and station_id in (" . $location_list . ")) + group by year + order by year"; + + if ($period == "year") { + $sql .= " ) y on year(thcv.col_time_on) = y.year"; + } else if ($period == "month") { + $sql .= " ) y on date_format(col_time_on, '%Y-%m') = y.year"; + } + + $sql .= " where station_id in (" . $location_list . ")"; + + 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 ($mode != 'All') { + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + } + if ($period == "year") { $sql .= " group by year(thcv.col_time_on), y.tot order by year(thcv.col_time_on)"; - } - - else if ($period == "month") { - $sql .= " group by date_format(col_time_on, '%Y%m'), y.tot - order by date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= " group by date_format(col_time_on, '%Y-%m'), y.tot + order by date_format(col_time_on, '%Y-%m')"; } $query = $this->db->query($sql); @@ -356,12 +350,12 @@ class Accumulate_model extends CI_Model return $this->count_and_add_accumulated_total($query->result()); } - function get_accumulated_waz($band, $mode, $period, $location_list) { + function get_accumulated_waz($band, $mode, $period, $location_list) + { if ($period == "year") { $sql = "select year(thcv.col_time_on) year"; - } - else if ($period == "month") { - $sql = "select date_format(col_time_on, '%Y%m') year"; + } else if ($period == "month") { + $sql = "select date_format(col_time_on, '%Y-%m') year"; } $sql .= ", coalesce(y.tot, 0) tot @@ -372,14 +366,13 @@ class Accumulate_model extends CI_Model if ($period == "year") { $sql .= "year(col_time_on)"; - } - else if ($period == "month") { - $sql .= "date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= "date_format(col_time_on, '%Y-%m')"; } $sql .= " year, col_cqz - from " . $this->config->item('table_name') . - " where station_id in (". $location_list . ")"; + from " . $this->config->item('table_name') . + " where station_id in (" . $location_list . ")"; if ($band != 'All') { if ($band == 'SAT') { @@ -390,48 +383,21 @@ class Accumulate_model extends CI_Model } } - if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; - } - - $sql .= " order by year - ) x - where not exists (select 1 from " . $this->config->item('table_name') . " where"; - - if ($period == "year") { - $sql .= " year(col_time_on) < year";; - } - else if ($period == "month") { - $sql .= " date_format(col_time_on, '%Y%m') < year";; - } - - $sql .= " and col_cqz = x.col_cqz"; - - 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 ($mode != 'All') { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - $sql .= " and station_id in (". $location_list . ")) - group by year - order by year"; + $sql .= " order by year + ) x + where not exists (select 1 from " . $this->config->item('table_name') . " where"; if ($period == "year") { - $sql .= " ) y on year(thcv.col_time_on) = y.year"; + $sql .= " year(col_time_on) < year";; + } else if ($period == "month") { + $sql .= " date_format(col_time_on, '%Y-%m') < year";; } - else if ($period == "month") { - $sql .= " ) y on date_format(col_time_on, '%Y%m') = y.year"; - } - - $sql .= " where station_id in (". $location_list . ")"; + + $sql .= " and col_cqz = x.col_cqz"; if ($band != 'All') { if ($band == 'SAT') { @@ -443,21 +409,44 @@ class Accumulate_model extends CI_Model } if ($mode != 'All') { - $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - + + $sql .= " and station_id in (" . $location_list . ")) + group by year + order by year"; + + if ($period == "year") { + $sql .= " ) y on year(thcv.col_time_on) = y.year"; + } else if ($period == "month") { + $sql .= " ) y on date_format(col_time_on, '%Y-%m') = y.year"; + } + + $sql .= " where station_id in (" . $location_list . ")"; + + 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 ($mode != 'All') { + $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; + } + if ($period == "year") { $sql .= " group by year(thcv.col_time_on), y.tot order by year(thcv.col_time_on)"; - } - - else if ($period == "month") { - $sql .= " group by date_format(col_time_on, '%Y%m'), y.tot - order by date_format(col_time_on, '%Y%m')"; + } else if ($period == "month") { + $sql .= " group by date_format(col_time_on, '%Y-%m'), y.tot + order by date_format(col_time_on, '%Y-%m')"; } $query = $this->db->query($sql); return $this->count_and_add_accumulated_total($query->result()); } -} \ No newline at end of file +} diff --git a/application/models/Distances_model.php b/application/models/Distances_model.php index 3aa17c0c0..0e66b17cc 100644 --- a/application/models/Distances_model.php +++ b/application/models/Distances_model.php @@ -162,7 +162,7 @@ class Distances_model extends CI_Model 'Callsign' => '', 'Grid' => '', 'Distance' => '', - 'Qsos' => '', + 'Qsos' => 0, 'Grids' => '' ); @@ -171,8 +171,8 @@ class Distances_model extends CI_Model $bearingdistance = $this->qra->distance($stationgrid, $qso['grid'], $measurement_base); if ($bearingdistance != $qso['COL_DISTANCE']) { $data = array('COL_DISTANCE' => $bearingdistance); - $this->db->where('COL_PRIMARY_KEY', $qso['COL_PRIMARY_KEY']); - $this->db->update($this->config->item('table_name'), $data); + $this->db->where('COL_PRIMARY_KEY', $qso['COL_PRIMARY_KEY']); + $this->db->update($this->config->item('table_name'), $data); } $arrayplacement = (int)($bearingdistance / 50); // Resolution is 50, calculates where to put result in array if ($bearingdistance > $qrb['Distance']) { // Saves the longest QSO @@ -205,8 +205,11 @@ class Distances_model extends CI_Model * Returns: bool */ function valid_locator ($loc) { - $regex = '^[A-R]{2}[0-9]{2}[A-X]{2}$'; - if (preg_match("%{$regex}%i", $loc)) { + $loc = strtoupper($loc); + if (strlen($loc) == 4) $loc .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed + if (strlen($loc) == 6) $loc .= "55"; // Only 6 Chars? Fill with center "55" + if (strlen($loc) == 8) $loc .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed + if (preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $loc)) { return true; } else { @@ -214,7 +217,7 @@ class Distances_model extends CI_Model } } - /* + /* * Used to fetch QSOs from the logbook in the awards */ public function qso_details($distance, $band, $sat){ diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 1f3615fdf..a9636cde7 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -292,7 +292,7 @@ class Logbook_model extends CI_Model { $data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign'])); $data['COL_MY_DXCC'] = strtoupper(trim($station['station_dxcc'])); - $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'])); + $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'] ?? '')); $data['COL_MY_CNTY'] = strtoupper(trim($station['station_cnty'])); $data['COL_MY_CQ_ZONE'] = strtoupper(trim($station['station_cq'])); $data['COL_MY_ITU_ZONE'] = strtoupper(trim($station['station_itu'])); @@ -547,24 +547,30 @@ class Logbook_model extends CI_Model { return $this->db->get($this->config->item('table_name')); } - public function get_callsigns($callsign){ - $this->db->select('COL_CALL'); - $this->db->distinct(); - $this->db->like('COL_CALL', $callsign); + public function get_callsigns($callsign){ + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->select('COL_CALL'); + $this->db->distinct(); + $this->db->like('COL_CALL', $callsign); + $this->db->where_in('station_id', $logbooks_locations_array); - return $this->db->get($this->config->item('table_name')); + return $this->db->get($this->config->item('table_name')); - } + } - public function get_dok($callsign){ - $this->db->select('COL_DARC_DOK'); - $this->db->where('COL_CALL', $callsign); - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); + public function get_dok($callsign){ + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->select('COL_DARC_DOK'); + $this->db->where('COL_CALL', $callsign); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); - return $this->db->get($this->config->item('table_name')); + return $this->db->get($this->config->item('table_name')); - } + } function add_qso($data, $skipexport = false, $batchmode = false) { @@ -4268,7 +4274,7 @@ function lotw_last_qsl_date($user_id) { return ''; } - + public function check_missing_dxcc_id($all){ // get all records with no COL_DXCC $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); diff --git a/application/views/accumulate/index.php b/application/views/accumulate/index.php index 151361700..bdada2cde 100644 --- a/application/views/accumulate/index.php +++ b/application/views/accumulate/index.php @@ -1,99 +1,108 @@ +

- -
- -
- -
+ +
+ +
+ +
- -
- + + result() as $mode) { + if ($mode->submode == null) { + printf("", $mode->mode, $mode->mode); + } else { + printf("", $mode->submode, $mode->submode); } - ?> - + } + ?> + +
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+ +
+
+ + +
+
+ +
+
- -
-
- -
+ +
+
+
+
- -
+ +
-
- +
\ No newline at end of file diff --git a/application/views/debug/main.php b/application/views/debug/main.php index 96a847344..592038655 100644 --- a/application/views/debug/main.php +++ b/application/views/debug/main.php @@ -165,17 +165,6 @@ - - - openssl - - - Installed - - Not Installed - - -
diff --git a/application/views/eqsl/import.php b/application/views/eqsl/import.php index c6e6c76dc..96a470f77 100644 --- a/application/views/eqsl/import.php +++ b/application/views/eqsl/import.php @@ -31,20 +31,18 @@

Upload the Exported ADIF file from eQSL from the Download Inbox page, to mark QSOs as confirmed on eQSL.

-

Important Log files must have the file type .adi

- -

Choose Station(location) eQSL File belongs to:

+

ImportantLog files must have the file type .adi

+
- -

- +
@@ -58,8 +56,7 @@
- -
+
diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 0b23caefd..bd060c8fc 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -131,7 +131,7 @@
-
+
@@ -164,6 +164,10 @@ ?>
+
+ + +
@@ -236,11 +240,6 @@
-
- - -
-
diff --git a/application/views/search/search_result_ajax.php b/application/views/search/search_result_ajax.php index 639fe95ea..18cce9d8b 100644 --- a/application/views/search/search_result_ajax.php +++ b/application/views/search/search_result_ajax.php @@ -192,7 +192,7 @@ $ci =& get_instance(); case 'SOTA': echo '' . ($row->COL_SOTA_REF); break; case 'WWFF': echo '' . ($row->COL_WWFF_REF); break; case 'POTA': echo '' . ($row->COL_POTA_REF); break; - case 'Grid': echo ''; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; + case 'Grid': echo ''; echo strlen($row->COL_GRIDSQUARE ?? '')==0?$row->COL_VUCC_GRIDS ?? '':$row->COL_GRIDSQUARE; break; case 'Distance':echo '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : ''); break; case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; case 'State': echo '' . ($row->COL_STATE); break; diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index c189433c9..ea8016c50 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -504,6 +504,20 @@ + COL_MY_IOTA) { ?> + + + COL_MY_IOTA; ?> + + + + COL_MY_SOTA_REF) { ?> + + + COL_MY_SOTA_REF; ?> + + + COL_MY_WWFF_REF) { ?> diff --git a/assets/js/sections/accumulatedstatistics.js b/assets/js/sections/accumulatedstatistics.js index 12c464aed..06d15a643 100644 --- a/assets/js/sections/accumulatedstatistics.js +++ b/assets/js/sections/accumulatedstatistics.js @@ -1,64 +1,90 @@ function accumulatePlot(form) { - $(".ld-ext-right").addClass('running'); - $(".ld-ext-right").prop('disabled', true); + $(".ld-ext-right").addClass("running"); + $(".ld-ext-right").prop("disabled", true); // using this to change color of legend and label according to background color - var color = ifDarkModeThemeReturn('white', 'grey'); + var color = ifDarkModeThemeReturn("white", "grey"); var award = form.awardradio.value; var mode = form.mode.value; var period = form.periodradio.value; $.ajax({ - url: base_url + 'index.php/accumulated/get_accumulated_data', - type: 'post', - data: { 'Band': form.band.value, 'Award': award, 'Mode': mode, 'Period': period }, + url: base_url + "index.php/accumulated/get_accumulated_data", + type: "post", + data: { + Band: form.band.value, + Award: award, + Mode: mode, + Period: period, + }, success: function (data) { if (!$.trim(data)) { $("#accumulateContainer").empty(); - $("#accumulateContainer").append(''); - $(".ld-ext-right").removeClass('running'); - $(".ld-ext-right").prop('disabled', false); - } - else { + $("#accumulateContainer").append( + '' + ); + $(".ld-ext-right").removeClass("running"); + $(".ld-ext-right").prop("disabled", false); + } else { // used for switching award text in the table and the chart switch (award) { - case 'dxcc': var awardtext = "DXCC\'s"; break; - case 'was': var awardtext = "states"; break; - case 'iota': var awardtext = "IOTA\'s"; break; - case 'waz': var awardtext = "CQ zones"; break; + case "dxcc": + var awardtext = lang_statistics_accumulated_worked_dxcc; + break; + case "was": + var awardtext = + lang_statistics_accumulated_worked_states; + break; + case "iota": + var awardtext = lang_statistics_accumulated_worked_iota; + break; + case "waz": + var awardtext = + lang_statistics_accumulated_worked_cqzone; + break; } - var periodtext = 'Year'; - if (period == 'month') { - periodtext += ' + month'; + var periodtext = lang_general_word_year; + if (period == "month") { + periodtext = + lang_general_word_year + + " + " + + lang_general_word_month; } // removing the old chart so that it will not interfere when loading chart again $("#accumulateContainer").empty(); - $("#accumulateContainer").append("
"); + $("#accumulateContainer").append( + '
' + ); // appending table to hold the data - $("#accumulateTable").append('' + - '' + - '' + - '' + - '' + - '' + - '' + - '
#' + periodtext + 'Accumulated # of ' + awardtext + ' worked
'); + $("#accumulateTable").append( + '' + + "" + + "" + + "" + + "" + + "" + + "" + + "
#" + + periodtext + + "" + + awardtext + + "
" + ); var labels = []; var dataDxcc = []; - var $myTable = $('.accutable'); + var $myTable = $(".accutable"); var i = 1; // building the rows in the table var rowElements = data.map(function (row) { + var $row = $(""); - var $row = $(''); - - var $iterator = $('').html(i++); - var $type = $('').html(row.year); - var $content = $('').html(row.total); + var $iterator = $("").html(i++); + var $type = $("").html(row.year); + var $content = $("").html(row.total); $row.append($iterator, $type, $content); @@ -73,68 +99,78 @@ function accumulatePlot(form) { dataDxcc.push(this.total); }); - var ctx = document.getElementById("myChartAccumulate").getContext('2d'); + var ctx = document + .getElementById("myChartAccumulate") + .getContext("2d"); + var headerperiod; + if (period == "year") { + headerperiod = lang_general_word_yearly; + } else if (period == "month") { + headerperiod = lang_general_word_monthly; + } else { + headerperiod = "n/a"; + } var myChart = new Chart(ctx, { - type: 'bar', + type: "bar", data: { labels: labels, - datasets: [{ - label: 'Accumulated number of ' + awardtext + ' worked each ' + period, - data: dataDxcc, - backgroundColor: 'rgba(54, 162, 235, 0.2)', - borderColor: 'rgba(54, 162, 235, 1)', - borderWidth: 2, - color: color - }] + datasets: [ + { + label: awardtext + " (" + headerperiod + ")", + data: dataDxcc, + backgroundColor: "rgba(54, 162, 235, 0.2)", + borderColor: "rgba(54, 162, 235, 1)", + borderWidth: 2, + color: color, + }, + ], }, options: { scales: { y: { ticks: { beginAtZero: true, - color: color - } + color: color, + }, }, x: { ticks: { - color: color - } - } + color: color, + }, + }, }, plugins: { legend: { labels: { - color: color - } - } - } - } + color: color, + }, + }, + }, + }, }); - $(".ld-ext-right").removeClass('running'); - $(".ld-ext-right").prop('disabled', false); - $('.accutable').DataTable({ + $(".ld-ext-right").removeClass("running"); + $(".ld-ext-right").prop("disabled", false); + $(".accutable").DataTable({ responsive: false, ordering: false, - "scrollY": "400px", - "scrollCollapse": true, - "paging": false, - "scrollX": true, - "language": { + scrollY: "400px", + scrollCollapse: true, + paging: false, + scrollX: true, + language: { url: getDataTablesLanguageUrl(), }, - dom: 'Bfrtip', - buttons: [ - 'csv' - ] + dom: "Bfrtip", + buttons: ["csv"], }); // using this to change color of csv-button if dark mode is chosen - var background = $('body').css("background-color"); + var background = $("body").css("background-color"); - if (background != ('rgb(255, 255, 255)')) { + if (background != "rgb(255, 255, 255)") { $(".buttons-csv").css("color", "white"); } } - } + }, }); } diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index 4eea49de1..bd8931d29 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -36,6 +36,39 @@ async function reset_contest_session() { $(".contest_qso_table_contents").empty(); $('#copyexchangetodok').prop('checked', false); + if (!$.fn.DataTable.isDataTable('.qsotable')) { + $.fn.dataTable.moment('DD-MM-YYYY HH:mm:ss'); + $('.qsotable').DataTable({ + "stateSave": true, + "pageLength": 25, + responsive: false, + "scrollY": "400px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + "language": { + url: getDataTablesLanguageUrl(), + }, + order: [0, 'desc'], + "columnDefs": [ + { + "render": function ( data, type, row ) { + return pad(row[8],3); + }, + "targets" : 8 + }, + { + "render": function ( data, type, row ) { + return pad(row[9],3); + }, + "targets" : 9 + } + ] + }); + } + var table = $('.qsotable').DataTable(); + table.clear(); + } // Storing the contestid in contest session @@ -111,6 +144,7 @@ document.onkeyup = function (e) { reset_log_fields(); // CTRL-Enter logs QSO } else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) { + $("#callsign").blur(); logQso(); // Enter in received exchange logs QSO } else if ((e.which == 13) && ( @@ -203,9 +237,9 @@ $('#start_date').change(function() { }); // On Key up check and suggest callsigns -$("#callsign").keyup(function () { +$("#callsign").keyup(async function (e) { var call = $(this).val(); - if (call.length >= 3) { + if ((!((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey))) && (call.length >= 3)) { // prevent checking again when pressing CTRL-Enter $.ajax({ url: 'lookup/scp', @@ -219,7 +253,7 @@ $("#callsign").keyup(function () { } }); - checkIfWorkedBefore(); + await checkIfWorkedBefore(); var qTable = $('.qsotable').DataTable(); qTable.search(call).draw(); } @@ -228,7 +262,7 @@ $("#callsign").keyup(function () { } }); -function checkIfWorkedBefore() { +async function checkIfWorkedBefore() { var call = $("#callsign").val(); if (call.length >= 3) { $('#callsign_info').text(""); @@ -400,14 +434,14 @@ function logQso() { serials = $("#exch_serial_s").val(); serialr = $("#exch_serial_r").val(); break; - + case 'Serialexchange': exchsent = $("#exch_sent").val(); exchrcvd = $("#exch_rcvd").val(); serials = $("#exch_serial_s").val(); serialr = $("#exch_serial_r").val(); break; - + case 'Serialgridsquare': gridr = gridsquare; vuccr = vucc; @@ -416,21 +450,6 @@ function logQso() { break; } - var data = [[ - $("#start_date").val() + ' ' + $("#start_time").val(), - $("#callsign").val().toUpperCase(), - $("#band").val(), - $("#mode").val(), - $("#rst_sent").val(), - $("#rst_rcvd").val(), - exchsent, - exchrcvd, - serials, - serialr, - gridr, - vuccr, - ]]; - var formdata = new FormData(document.getElementById("qso_input")); $.ajax({ url: base_url + 'index.php/qso/saveqso', @@ -447,7 +466,7 @@ function logQso() { } $('#name').val(""); - + $('#callsign').val(""); $('#comment').val(""); $('#exch_rcvd').val(""); @@ -455,7 +474,7 @@ function logQso() { $('#exch_serial_r').val(""); $("#callsign").focus(); await setSession(formdata); - + await refresh_qso_table(sessiondata); var qTable = $('.qsotable').DataTable(); qTable.search('').order([0, 'desc']).draw(); @@ -471,23 +490,23 @@ async function getSession() { type: 'post', }); } - + async function restoreContestSession(data) { if (data) { if (data.copytodok == "1") { $('#copyexchangetodok').prop('checked', true); } - + if (data.contestid != "") { $("#contestname").val(data.contestid); } - + if (data.exchangetype != "") { $("#exchangetype").val(data.exchangetype); setExchangetype(data.exchangetype); setSerial(data); } - + if (data.exchangesent != "") { $("#exch_sent").val(data.exchangesent); } @@ -507,30 +526,6 @@ async function refresh_qso_table(data) { type: 'post', data: { 'qso': data.qso, }, success: function (html) { - var mode = ''; - $(".contest_qso_table_contents").empty(); - $.each(html, function () { - if (this.col_submode == null || this.col_submode == '') { - mode = this.col_mode; - } else { - mode = this.col_submode; - } - - $(".qsotable tbody").prepend('' + - '' + this.col_time_on + '' + - '' + this.col_call + '' + - '' + this.col_band + '' + - '' + mode + '' + - '' + this.col_rst_sent + '' + - '' + this.col_rst_rcvd + '' + - '' + this.col_stx_string + '' + - '' + this.col_srx_string + '' + - '' + this.col_stx + '' + - '' + this.col_srx + '' + - '' + this.col_gridsquare + '' + - '' + this.col_vucc_grids + '' + - ''); - }); if (!$.fn.DataTable.isDataTable('.qsotable')) { $.fn.dataTable.moment('DD-MM-YYYY HH:mm:ss'); $('.qsotable').DataTable({ @@ -561,6 +556,39 @@ async function refresh_qso_table(data) { ] }); } + var table = $('.qsotable').DataTable(); + table.clear(); + + var mode = ''; + var data; + $.each(html, function () { + if (this.col_submode == null || this.col_submode == '') { + mode = this.col_mode; + } else { + mode = this.col_submode; + } + + data = [[ + this.col_time_on, + this.col_call, + this.col_band, + mode, + this.col_rst_sent, + this.col_rst_rcvd, + this.col_stx_string, + this.col_srx_string, + this.col_stx, + this.col_srx, + this.col_gridsquare, + this.col_vucc_grids + ]]; + + if (data.length > 0) { + table.rows.add(data).draw(); + } + + }); + } }); } diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index df5d8bda5..02b60ee66 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -854,7 +854,8 @@ function mapQsos(form) { url: base_url + 'index.php/logbookadvanced/mapSelectedQsos', type: 'post', data: { - ids: id_list + ids: id_list, + de: form.de.value }, success: function(data) { loadMap(data);