diff --git a/application/controllers/Activated_gridmap.php b/application/controllers/Activated_gridmap.php index f3d93c5bc..8c59248ac 100644 --- a/application/controllers/Activated_gridmap.php +++ b/application/controllers/Activated_gridmap.php @@ -33,13 +33,18 @@ class Activated_gridmap extends CI_Controller { $data['gridsquares_gridsquares_not_confirmed'] = __("Gridsquares not confirmed"); $data['gridsquares_gridsquares_total_activated'] = __("Total gridsquares activated"); + $data['gridsquares_fields'] = __("Fields"); + $data['gridsquares_fields_confirmed'] = __("Fields confirmed"); + $data['gridsquares_fields_not_confirmed'] = __("Fields not confirmed"); + $data['gridsquares_fields_total_worked'] = __("Total fields worked"); + $footerData = []; $footerData['scripts'] = [ 'assets/js/leaflet/geocoding.js', 'assets/js/leaflet/L.MaidenheadColouredGridMap.js', 'assets/js/sections/gridmap.js?' ]; - + $this->load->view('interface_assets/header', $data); $this->load->view('activated_gridmap/index'); $this->load->view('interface_assets/footer', $footerData); @@ -87,16 +92,16 @@ class Activated_gridmap extends CI_Controller { // Check if 2 Char is in array if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); + array_push($array_grid_2char_confirmed, $grid_2char_confirmed); } if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); + array_push($array_grid_4char_confirmed, $grid_4char_confirmed); } if ($this->config->item('map_6digit_grids')) { if(!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)){ - array_push($array_grid_6char_confirmed, $grid_6char_confirmed); + array_push($array_grid_6char_confirmed, $grid_6char_confirmed); } } } @@ -118,16 +123,16 @@ class Activated_gridmap extends CI_Controller { // Check if 2 Char is in array if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + array_push($array_grid_2char, $grid_two); } if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + array_push($array_grid_4char, $grid_four); } if ($this->config->item('map_6digit_grids')) { if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); + array_push($array_grid_6char, $grid_six); } } } @@ -140,18 +145,18 @@ class Activated_gridmap extends CI_Controller { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { + foreach($grids as $key) { $grid_two = strtoupper(substr($key,0,2)); $grid_four = strtoupper(substr($key,0,4)); // Check if 2 Char is in array if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + array_push($array_grid_2char, $grid_two); } if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + array_push($array_grid_4char, $grid_four); } } } @@ -165,18 +170,18 @@ class Activated_gridmap extends CI_Controller { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { + foreach($grids as $key) { $grid_2char_confirmed = strtoupper(substr($key,0,2)); $grid_4char_confirmed = strtoupper(substr($key,0,4)); // Check if 2 Char is in array if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); + array_push($array_grid_2char_confirmed, $grid_2char_confirmed); } if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); + array_push($array_grid_4char_confirmed, $grid_4char_confirmed); } } } diff --git a/application/controllers/Statistics.php b/application/controllers/Statistics.php index 072c13713..7b1ad08c2 100644 --- a/application/controllers/Statistics.php +++ b/application/controllers/Statistics.php @@ -8,24 +8,24 @@ class Statistics extends CI_Controller { } - public function index() - { - $this->load->model('user_model'); - $this->load->model('bands'); + public function index() { + $this->load->model('user_model'); + $this->load->model('bands'); - if(!$this->user_model->authorize($this->config->item('auth_mode'))) { - if($this->user_model->validate_session()) { - $this->user_model->clear_session(); - show_error('Access denied

Click here to log in as another user', 403); - } else { - redirect('user/login'); - } - } + if(!$this->user_model->authorize($this->config->item('auth_mode'))) { + if($this->user_model->validate_session()) { + $this->user_model->clear_session(); + show_error('Access denied

Click here to log in as another user', 403); + } else { + redirect('user/login'); + } + } // Render User Interface // Set Page Title $data['page_title'] = __("Statistics"); $data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true); + $data['years'] = $this->get_years(); // Load Views $this->load->view('interface_assets/header', $data); @@ -77,6 +77,18 @@ class Statistics extends CI_Controller { } + function get_years() { + $this->load->model('logbook_model'); + $totals_year = $this->logbook_model->totals_year(); + $years=[]; + if ($totals_year) { + foreach($totals_year->result() as $years_obj) { + $years[] = $years_obj->year; + } + } + return $years; + } + public function get_year() { $this->load->model('logbook_model'); @@ -99,18 +111,19 @@ class Statistics extends CI_Controller { public function get_mode() { $this->load->model('logbook_model'); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; $modestats = array(); $i = 0; $modestats[$i]['mode'] = 'ssb'; - $modestats[$i++]['total'] = $this->logbook_model->total_ssb(); + $modestats[$i++]['total'] = $this->logbook_model->total_ssb($yr); $modestats[$i]['mode'] = 'cw'; - $modestats[$i++]['total'] = $this->logbook_model->total_cw(); + $modestats[$i++]['total'] = $this->logbook_model->total_cw($yr); $modestats[$i]['mode'] = 'fm'; - $modestats[$i++]['total'] = $this->logbook_model->total_fm(); + $modestats[$i++]['total'] = $this->logbook_model->total_fm($yr); $modestats[$i]['mode'] = 'digi'; - $modestats[$i]['total'] = $this->logbook_model->total_digi(); + $modestats[$i]['total'] = $this->logbook_model->total_digi($yr); usort($modestats, fn($a, $b) => $b['total'] <=> $a['total']); header('Content-Type: application/json'); @@ -123,7 +136,8 @@ class Statistics extends CI_Controller { $bandstats = array(); - $total_bands = $this->logbook_model->total_bands(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $total_bands = $this->logbook_model->total_bands($yr); $i = 0; @@ -143,7 +157,8 @@ class Statistics extends CI_Controller { $satstats = array(); - $total_sat = $this->logbook_model->total_sat(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $total_sat = $this->logbook_model->total_sat($yr); $i = 0; if ($total_sat) { @@ -162,13 +177,14 @@ class Statistics extends CI_Controller { $total_qsos = array(); - $result = $this->stats->unique_sat_callsigns(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $result = $this->stats->unique_sat_callsigns($yr); $total_qsos['qsoarray'] = $result['qsoView']; $total_qsos['satunique'] = $result['satunique']; $total_qsos['modeunique'] = $result['modeunique']; $total_qsos['total'] = $result['total']; - $total_qsos['sats'] = $this->stats->get_sats(); - $total_qsos['modes'] = $this->stats->get_sat_modes(); + $total_qsos['sats'] = $this->stats->get_sats($yr); + $total_qsos['modes'] = $this->stats->get_sat_modes($yr); $this->load->view('statistics/satuniquetable', $total_qsos); } @@ -178,12 +194,13 @@ class Statistics extends CI_Controller { $total_qsos = array(); - $result = $this->stats->unique_callsigns(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $result = $this->stats->unique_callsigns($yr); $total_qsos['qsoarray'] = $result['qsoView']; $total_qsos['bandunique'] = $result['bandunique']; $total_qsos['modeunique'] = $result['modeunique']; $total_qsos['total'] = $result['total']; - $total_qsos['bands'] = $this->stats->get_bands(); + $total_qsos['bands'] = $this->stats->get_bands($yr); $this->load->view('statistics/uniquetable', $total_qsos); } @@ -193,12 +210,13 @@ class Statistics extends CI_Controller { $total_qsos = array(); - $result = $this->stats->total_sat_qsos(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $result = $this->stats->total_sat_qsos($yr); $total_qsos['qsoarray'] = $result['qsoView']; $total_qsos['sattotal'] = $result['sattotal']; $total_qsos['modetotal'] = $result['modetotal']; $total_qsos['modes'] = $result['modes']; - $total_qsos['sats'] = $this->stats->get_sats(); + $total_qsos['sats'] = $this->stats->get_sats($yr); $this->load->view('statistics/satqsotable', $total_qsos); } @@ -208,11 +226,12 @@ class Statistics extends CI_Controller { $total_qsos = array(); - $result = $this->stats->total_qsos(); + $yr = xss_clean($this->input->post('yr')) ?? 'All'; + $result = $this->stats->total_qsos($yr); $total_qsos['qsoarray'] = $result['qsoView']; $total_qsos['bandtotal'] = $result['bandtotal']; $total_qsos['modetotal'] = $result['modetotal']; - $total_qsos['bands'] = $this->stats->get_bands(); + $total_qsos['bands'] = $this->stats->get_bands($yr); $this->load->view('statistics/qsotable', $total_qsos); } diff --git a/application/locale/bg_BG/LC_MESSAGES/messages.po b/application/locale/bg_BG/LC_MESSAGES/messages.po index 3afcb1030..5211109a6 100644 --- a/application/locale/bg_BG/LC_MESSAGES/messages.po +++ b/application/locale/bg_BG/LC_MESSAGES/messages.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@wavelog.org\n" -"POT-Creation-Date: 2024-11-30 21:52+0000\n" +"POT-Creation-Date: 2024-12-02 12:47+0000\n" "PO-Revision-Date: 2024-11-01 08:53+0000\n" "Last-Translator: Plamen Panteleev \n" "Language-Team: Bulgarian \n" "Language-Team: Bosnian \n" "Language-Team: Montenegrin \n" "Language-Team: Czech \n" "Language-Team: German \n" "Language-Team: Greek \n" "Language-Team: Spanish \n" "Language-Team: Estonian \n" "Language-Team: Finnish \n" "Language-Team: French \n" "Language-Team: Croatian \n" "Language-Team: Italian \n" "Language-Team: Lithuanian \n" "Language-Team: Latvian \n" "Language-Team: Dutch \n" "Language-Team: Polish \n" "Language-Team: Portuguese (Portugal) \n" @@ -152,6 +152,26 @@ msgstr "Gridsquares não confirmadas" msgid "Total gridsquares activated" msgstr "Total de gridsquares activadas" +#: application/controllers/Activated_gridmap.php:36 +#: application/controllers/Gridmap.php:36 +msgid "Fields" +msgstr "Campos" + +#: application/controllers/Activated_gridmap.php:37 +#: application/controllers/Gridmap.php:37 +msgid "Fields confirmed" +msgstr "Campos confirmados" + +#: application/controllers/Activated_gridmap.php:38 +#: application/controllers/Gridmap.php:38 +msgid "Fields not confirmed" +msgstr "Campos não confirmados" + +#: application/controllers/Activated_gridmap.php:39 +#: application/controllers/Gridmap.php:39 +msgid "Total fields worked" +msgstr "Total de campos trabalhados" + #: application/controllers/Activators.php:20 #: application/views/activators/index.php:5 #: application/views/interface_assets/header.php:144 @@ -513,7 +533,7 @@ msgstr "Notas - Backup" #: application/views/bands/index.php:32 #: application/views/interface_assets/header.php:385 #: application/views/statistics/index.php:16 -#: application/views/statistics/index.php:56 +#: application/views/statistics/index.php:65 msgid "Bands" msgstr "Bandas" @@ -799,22 +819,6 @@ msgstr "Mapa Gridsquare" msgid "Total gridsquares worked" msgstr "Total de gridsquares trabalhadas" -#: application/controllers/Gridmap.php:36 -msgid "Fields" -msgstr "" - -#: application/controllers/Gridmap.php:37 -msgid "Fields confirmed" -msgstr "" - -#: application/controllers/Gridmap.php:38 -msgid "Fields not confirmed" -msgstr "" - -#: application/controllers/Gridmap.php:39 -msgid "Total fields worked" -msgstr "" - #: application/controllers/Hamsat.php:59 msgid "Hamsat - Satellite Roving" msgstr "Hamsat - Satélite Roving" @@ -1162,7 +1166,7 @@ msgstr "Clublog" #: application/views/statistics/custom_result.php:88 #: application/views/statistics/index.php:15 #: application/views/statistics/index.php:20 -#: application/views/statistics/index.php:53 +#: application/views/statistics/index.php:62 #: application/views/timeline/index.php:19 application/views/user/edit.php:229 #: application/views/user/edit.php:251 application/views/user/edit.php:273 #: application/views/user/edit.php:295 application/views/user/edit.php:318 @@ -2016,7 +2020,7 @@ msgstr "" #: application/controllers/Simplefle.php:90 #: application/controllers/Simplefle.php:93 -#: application/models/Logbook_model.php:4453 +#: application/models/Logbook_model.php:4466 #: application/views/simplefle/index.php:40 msgid "Duplicate for" msgstr "Duplicado para" @@ -2232,7 +2236,7 @@ msgstr "Por favor, selecione um" msgid "Edit Export Map options" msgstr "Editar opções do mapa de exportação" -#: application/controllers/Statistics.php:27 +#: application/controllers/Statistics.php:26 #: application/views/interface_assets/header.php:134 msgid "Statistics" msgstr "Estatísticas" @@ -2241,13 +2245,13 @@ msgstr "Estatísticas" msgid "Custom Statistics" msgstr "Estatísticas personalizadas" -#: application/controllers/Statistics.php:232 +#: application/controllers/Statistics.php:251 #: application/views/interface_assets/header.php:138 #: application/views/statistics/qsltable.php:5 msgid "QSL Statistics" msgstr "Estatísticas de QSL" -#: application/controllers/Statistics.php:247 +#: application/controllers/Statistics.php:266 #: application/views/interface_assets/header.php:136 #: application/views/statistics/antennaanalytics.php:3 msgid "Antenna Analytics" @@ -2589,22 +2593,22 @@ msgid "HRDlog: No station profiles with HRDlog Credentials found." msgstr "" "HRDlog: Não foram encontrados perfis de estação com credenciais do HRDlog." -#: application/models/Logbook_model.php:3773 +#: application/models/Logbook_model.php:3786 #, php-format msgid "Wrong station callsign %s while importing QSO with %s for %s: SKIPPED" msgstr "" "Indicativo de estação errado %s ao importar QSO com %s para %s: IGNORADO" -#: application/models/Logbook_model.php:3774 +#: application/models/Logbook_model.php:3787 #, php-format msgid "Check %s for hints about errors in ADIF files." msgstr "Verifica %s para dicas sobre erros em ficheiros ADIF." -#: application/models/Logbook_model.php:3786 +#: application/models/Logbook_model.php:3799 msgid "QSO on" msgstr "Contacto em" -#: application/models/Logbook_model.php:3786 +#: application/models/Logbook_model.php:3799 msgid "" "You tried to import a QSO without any given CALL. This QSO wasn't imported. " "It's invalid" @@ -2612,51 +2616,51 @@ msgstr "" "Tentou importar um contacto sem nenhum CALL dado. Este contacto não foi " "importado. É inválido." -#: application/models/Logbook_model.php:4085 +#: application/models/Logbook_model.php:4098 msgid "the qslrdate is invalid (YYYYMMDD)" msgstr "o qslrdate está inválido (AAAAMMDD)" -#: application/models/Logbook_model.php:4096 +#: application/models/Logbook_model.php:4109 msgid "the qslsdate is invalid (YYYYMMDD)" msgstr "o qslsdate está inválido (AAAAMMDD)" -#: application/models/Logbook_model.php:4149 +#: application/models/Logbook_model.php:4162 msgid "the clublog_qso_upload_date is invalid (YYYYMMDD)" msgstr "o clublog_qso_upload_date está inválido (AAAAMMDD)" -#: application/models/Logbook_model.php:4169 +#: application/models/Logbook_model.php:4182 msgid "the lotw_qslrdate is invalid (YYYYMMDD)" msgstr "o lotw_qslrdate está inválido (AAAAMMDD)" -#: application/models/Logbook_model.php:4190 +#: application/models/Logbook_model.php:4203 msgid "the lotw_qslsdate is invalid (YYYYMMDD)" msgstr "o lotw_qslsdate está inválido (AAAAMMDD)" -#: application/models/Logbook_model.php:4514 +#: application/models/Logbook_model.php:4527 msgid "QSO could not be matched" msgstr "Não há correspondência de contactos" -#: application/models/Logbook_model.php:4520 +#: application/models/Logbook_model.php:4533 msgid "confirmed by LoTW/Clublog/eQSL/Contest" msgstr "confirmado por LoTW/Clublog/eQSL/Contest" -#: application/models/Logbook_model.php:4525 +#: application/models/Logbook_model.php:4538 msgid "confirmed by award manager" msgstr "confirmado pelo gestor do diploma" -#: application/models/Logbook_model.php:4528 +#: application/models/Logbook_model.php:4541 msgid "confirmed by cross-check of DCL data" msgstr "confirmado pelo controlo cruzado dos dados da DCL" -#: application/models/Logbook_model.php:4531 +#: application/models/Logbook_model.php:4544 msgid "confirmation pending" msgstr "confirmação pendente" -#: application/models/Logbook_model.php:4534 +#: application/models/Logbook_model.php:4547 msgid "unconfirmed" msgstr "não confirmado" -#: application/models/Logbook_model.php:4537 +#: application/models/Logbook_model.php:4550 #: application/views/view_log/qso.php:290 msgid "unknown" msgstr "desconhecido" @@ -2697,6 +2701,7 @@ msgstr "Número acumulado de WAJA contactados" #: application/views/dashboard/index.php:245 #: application/views/dayswithqso/index.php:38 #: application/views/statistics/index.php:18 +#: application/views/statistics/index.php:36 #: application/views/visitor/index.php:250 msgid "Year" msgstr "Ano" @@ -3143,7 +3148,7 @@ msgstr "Mostrar" #: application/views/satellite/flightpath.php:34 #: application/views/satellite/passtable.php:5 #: application/views/sattimers/index.php:38 -#: application/views/statistics/index.php:112 +#: application/views/statistics/index.php:22 msgid "Satellite" msgstr "Satélite" @@ -6087,7 +6092,6 @@ msgstr "Gridsquare VUCC" #: application/views/continents/index.php:63 #: application/views/statistics/index.php:19 -#: application/views/statistics/index.php:113 msgid "# of QSO's worked" msgstr "# of contactos feitos" @@ -7865,8 +7869,8 @@ msgstr "Opções Globais" #: application/views/satellite/pass.php:495 #: application/views/statistics/custom.php:20 #: application/views/statistics/custom_result.php:21 -#: application/views/statistics/index.php:39 -#: application/views/statistics/index.php:93 +#: application/views/statistics/index.php:48 +#: application/views/statistics/index.php:102 msgid "Satellites" msgstr "Satélites" @@ -8177,8 +8181,8 @@ msgid "Label types" msgstr "Tipos de etiquetas" #: application/views/labels/index.php:81 -#: application/views/statistics/index.php:59 -#: application/views/statistics/index.php:96 +#: application/views/statistics/index.php:68 +#: application/views/statistics/index.php:105 #: application/views/widgets/qsos.php:3 msgid "QSOs" msgstr "Contactos" @@ -9035,7 +9039,7 @@ msgstr "Categoria" #: application/views/qso/index.php:31 #: application/views/statistics/custom.php:17 #: application/views/statistics/custom_result.php:18 -#: application/views/statistics/index.php:35 +#: application/views/statistics/index.php:44 #: application/views/user/edit.php:154 msgid "General" msgstr "Geral" @@ -11576,7 +11580,7 @@ msgstr "Elevação" #: application/views/statistics/custom.php:12 #: application/views/statistics/custom_result.php:12 -#: application/views/statistics/index.php:28 +#: application/views/statistics/index.php:29 msgid "Explore the logbook." msgstr "Explorar o logbook." @@ -11605,7 +11609,7 @@ msgid "Rcvd" msgstr "Recebido" #: application/views/statistics/index.php:14 -#: application/views/statistics/index.php:50 +#: application/views/statistics/index.php:59 msgid "Years" msgstr "Anos" @@ -11613,8 +11617,12 @@ msgstr "Anos" msgid "Number of QSOs worked each year" msgstr "Número de contactos feitos em cada ano" -#: application/views/statistics/index.php:62 -#: application/views/statistics/index.php:99 +#: application/views/statistics/index.php:33 +msgid "All Years" +msgstr "" + +#: application/views/statistics/index.php:71 +#: application/views/statistics/index.php:108 msgid "Unique callsigns" msgstr "Indicativos únicos" diff --git a/application/locale/ru_RU/LC_MESSAGES/messages.po b/application/locale/ru_RU/LC_MESSAGES/messages.po index 6cedaaadb..4cd9d2318 100644 --- a/application/locale/ru_RU/LC_MESSAGES/messages.po +++ b/application/locale/ru_RU/LC_MESSAGES/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@wavelog.org\n" -"POT-Creation-Date: 2024-11-30 21:52+0000\n" +"POT-Creation-Date: 2024-12-02 12:47+0000\n" "PO-Revision-Date: 2024-11-26 02:16+0000\n" "Last-Translator: Michael Skolsky \n" "Language-Team: Russian \n" "Language-Team: Albanian \n" "Language-Team: Serbian \n" "Language-Team: Swedish \n" "Language-Team: Turkish \n" "Language-Team: Chinese (Simplified Han script) db->select('*, satellite.displayname AS sat_displayname'); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.COL_SAT_NAME'); + $this->db->join('dxcc_entities', $this->config->item('table_name') . '.col_dxcc = dxcc_entities.adif', 'left outer'); $this->db->where('COL_SAT_NAME', $sat); $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); $this->db->order_by("COL_DISTANCE", "desc"); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 5ce7528a2..cfa1519fe 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2882,8 +2882,17 @@ class Logbook_model extends CI_Model { } } + private function where_year($yr) { + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } + } + /* Return total amount of SSB QSOs logged */ - function total_ssb() { + function total_ssb($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -2898,7 +2907,7 @@ class Logbook_model extends CI_Model { $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('COL_MODE', $mode); - + $this->where_year($yr); $query = $this->db->get($this->config->item('table_name')); if ($query->num_rows() > 0) { @@ -2909,7 +2918,7 @@ class Logbook_model extends CI_Model { } /* Return total number of satellite QSOs */ - function total_sat() { + function total_sat($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -2923,6 +2932,7 @@ class Logbook_model extends CI_Model { $this->db->where('COL_SAT_NAME is not null'); $this->db->where('COL_SAT_NAME !=', ''); $this->db->where('COL_PROP_MODE', 'SAT'); + $this->where_year($yr); $this->db->order_by('count DESC'); $this->db->group_by('COL_SAT_NAME'); $query = $this->db->get($this->config->item('table_name')); @@ -2969,7 +2979,7 @@ class Logbook_model extends CI_Model { } /* Return total number of CW QSOs */ - function total_cw() { + function total_cw($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -2981,6 +2991,7 @@ class Logbook_model extends CI_Model { $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE', 'CW'); + $this->where_year($yr); $query = $this->db->get($this->config->item('table_name')); if ($query->num_rows() > 0) { @@ -2991,7 +3002,7 @@ class Logbook_model extends CI_Model { } /* Return total number of FM QSOs */ - function total_fm() { + function total_fm($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -3003,6 +3014,7 @@ class Logbook_model extends CI_Model { $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE', 'FM'); + $this->where_year($yr); $query = $this->db->get($this->config->item('table_name')); if ($query->num_rows() > 0) { @@ -3013,7 +3025,7 @@ class Logbook_model extends CI_Model { } /* Return total number of Digital QSOs */ - function total_digi() { + function total_digi($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -3030,7 +3042,7 @@ class Logbook_model extends CI_Model { $this->db->where('COL_MODE !=', 'CW'); $this->db->where('COL_MODE !=', 'FM'); $this->db->where('COL_MODE !=', 'AM'); - + $this->where_year($yr); $query = $this->db->get($this->config->item('table_name')); if ($query->num_rows() > 0) { @@ -3047,7 +3059,7 @@ class Logbook_model extends CI_Model { } /* Return total number of QSOs per band */ - function total_bands() { + function total_bands($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -3057,6 +3069,7 @@ class Logbook_model extends CI_Model { $this->db->select('COL_BAND AS band, count( * ) AS count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); + $this->where_year($yr); $this->db->group_by('band'); $this->db->order_by('count', 'DESC'); diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 421ce7495..a285c94fe 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -488,44 +488,46 @@ class Logbookadvanced_model extends CI_Model { if(!$this->user_model->authorize(2)) { return array('message' => 'Error'); } else { - if ($method != '') { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => $sent, - 'COL_QSL_SENT_VIA' => $method - ); - } else { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => $sent, - ); - } - $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; - $this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true)); - $this->db->update($this->config->item('table_name'), $data); + $sql = "UPDATE " . $this->config->item('table_name') ." + SET + COL_QSLRDATE = CURRENT_TIMESTAMP, + COL_QSL_SENT = ?, + COL_QSL_SENT_VIA = ?, + COL_QRZCOM_QSO_UPLOAD_STATUS = CASE + WHEN COL_QRZCOM_QSO_UPLOAD_STATUS IN ('Y', 'I') THEN 'M' + ELSE COL_QRZCOM_QSO_UPLOAD_STATUS + END + WHERE COL_PRIMARY_KEY IN (".implode(',',json_decode($ids, true)).")"; + $binding[] = $sent; + $binding[] = $method; + $this->db->query($sql, $binding); return array('message' => 'OK'); } } public function updateQslReceived($ids, $user_id, $method, $sent) { - $this->load->model('user_model'); + $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { - return array('message' => 'Error'); - } else { - $data = array( - 'COL_QSLRDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_RCVD' => $sent, - 'COL_QSL_RCVD_VIA' => $method - ); - $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; - $this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true)); - $this->db->update($this->config->item('table_name'), $data); - - return array('message' => 'OK'); - } - } + if(!$this->user_model->authorize(2)) { + return array('message' => 'Error'); + } else { + $sql = "UPDATE " . $this->config->item('table_name') ." + SET + COL_QSLRDATE = CURRENT_TIMESTAMP, + COL_QSL_RCVD = ?, + COL_QSL_RCVD_VIA = ?, + COL_QRZCOM_QSO_UPLOAD_STATUS = CASE + WHEN COL_QRZCOM_QSO_UPLOAD_STATUS IN ('Y', 'I') THEN 'M' + ELSE COL_QRZCOM_QSO_UPLOAD_STATUS + END + WHERE COL_PRIMARY_KEY IN (".implode(',',json_decode($ids, true)).")"; + $binding[] = $sent; + $binding[] = $method; + $this->db->query($sql, $binding); + return array('message' => 'OK'); + } + } public function updateQsoWithCallbookInfo($qsoID, $qso, $callbook) { $updatedData = array(); diff --git a/application/models/Stats.php b/application/models/Stats.php index 6aa4d9589..0023bd43a 100644 --- a/application/models/Stats.php +++ b/application/models/Stats.php @@ -71,14 +71,14 @@ return $this->db->get($this->config->item('table_name')); } - function unique_sat_callsigns() { + function unique_sat_callsigns($yr = 'All') { $qsoView = array(); - $sats = $this->get_sats(); - $modes = $this->get_sat_modes(); + $sats = $this->get_sats($yr); + $modes = $this->get_sat_modes($yr); - $satunique = $this->getUniqueSatCallsignsSat(); - $modeunique = $this->getUniqueSatCallsignsModes(); + $satunique = $this->getUniqueSatCallsignsSat($yr); + $modeunique = $this->getUniqueSatCallsignsModes($yr); // Generating the band/mode table foreach ($sats as $sat) { @@ -102,7 +102,7 @@ } // Populating array with worked - $workedQso = $this->getUniqueSatCallsigns(); + $workedQso = $this->getUniqueSatCallsigns($yr); foreach ($workedQso as $line) { //if ($line->col_submode == null) { @@ -114,22 +114,22 @@ } $result['qsoView'] = $qsoView; - $result['satunique'] = $satcalls; - $result['modeunique'] = $modecalls; - $result['total'] = $this->getUniqueSatCallsignsTotal(); + $result['satunique'] = $satcalls ?? ''; + $result['modeunique'] = $modecalls ?? ''; + $result['total'] = $this->getUniqueSatCallsignsTotal($yr); return $result; } - function unique_callsigns() { + function unique_callsigns($yr = 'All') { $qsoView = array(); - $bands = $this->get_bands(); - $modes = $this->get_modes(); + $bands = $this->get_bands($yr); + $modes = $this->get_modes($yr); - $bandunique = $this->getUniqueCallsignsBands(); - $modeunique = $this->getUniqueCallsignsModes(); + $bandunique = $this->getUniqueCallsignsBands($yr); + $modeunique = $this->getUniqueCallsignsModes($yr); $modecalls=[]; $bandcalls=[]; @@ -156,7 +156,7 @@ } // Populating array with worked - $workedQso = $this->getUniqueCallsigns(); + $workedQso = $this->getUniqueCallsigns($yr); foreach ($workedQso as $line) { //if ($line->col_submode == null) { @@ -170,12 +170,12 @@ $result['qsoView'] = $qsoView; $result['bandunique'] = $bandcalls; $result['modeunique'] = $modecalls; - $result['total'] = $this->getUniqueCallsignsTotal(); + $result['total'] = $this->getUniqueCallsignsTotal($yr); return $result; } - function getUniqueSatCallsignsSat() { + function getUniqueSatCallsignsSat($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -188,6 +188,12 @@ $this->db->select('count(distinct col_call) as calls, upper(col_sat_name) as sat', FALSE); $this->db->where('col_prop_mode', 'SAT'); $this->db->where('coalesce(col_sat_name,"") != ""'); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('upper(col_sat_name)'); @@ -196,7 +202,7 @@ return $query->result(); } - function getUniqueSatCallsigns() { + function getUniqueSatCallsigns($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -209,6 +215,12 @@ $this->db->select('count(distinct col_call) as calls, upper(col_sat_name) as sat, col_mode, coalesce(col_submode, "") col_submode', FALSE); $this->db->where('col_prop_mode', 'SAT'); $this->db->where('coalesce(col_sat_name,"") != ""'); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('upper(col_sat_name), col_mode, coalesce(col_submode, "")'); @@ -217,7 +229,7 @@ return $query->result(); } - function getUniqueCallsigns() { + function getUniqueCallsigns($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -228,6 +240,12 @@ $bands = array(); $this->db->select('count(distinct col_call) as calls, lower(col_band) as band, col_mode, coalesce(col_submode, "") col_submode', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('lower(col_band), col_mode, coalesce(col_submode, "")'); @@ -236,7 +254,7 @@ return $query->result(); } - function getUniqueCallsignsModes() { + function getUniqueCallsignsModes($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -247,6 +265,12 @@ $bands = array(); $this->db->select('count(distinct col_call) as calls, col_mode, coalesce(col_submode, "") col_submode', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('col_mode, coalesce(col_submode, "")'); @@ -255,7 +279,7 @@ return $query->result(); } - function getUniqueSatCallsignsModes() { + function getUniqueSatCallsignsModes($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -268,6 +292,12 @@ $this->db->select('count(distinct col_call) as calls, col_mode, coalesce(col_submode, "") col_submode', FALSE); $this->db->where('coalesce(col_sat_name,"") != ""'); $this->db->where('col_prop_mode', 'SAT'); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('col_mode, coalesce(col_submode, "")'); @@ -276,7 +306,7 @@ return $query->result(); } - function getUniqueCallsignsBands() { + function getUniqueCallsignsBands($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -287,6 +317,12 @@ $bands = array(); $this->db->select('count(distinct col_call) as calls, col_band as band', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('col_band'); @@ -295,7 +331,7 @@ return $query->result(); } - function getUniqueSatCallsignsTotal() { + function getUniqueSatCallsignsTotal($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -306,6 +342,12 @@ $bands = array(); $this->db->select('count(distinct col_call) as calls', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where('coalesce(col_sat_name,"") != ""'); $this->db->where('col_prop_mode', 'SAT'); $this->db->where_in('station_id', $logbooks_locations_array); @@ -315,7 +357,7 @@ return $query->row(); } - function getUniqueCallsignsTotal() { + function getUniqueCallsignsTotal($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -326,6 +368,12 @@ $bands = array(); $this->db->select('count(distinct col_call) as calls', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $query = $this->db->get($this->config->item('table_name')); @@ -333,11 +381,11 @@ return $query->row(); } - function total_sat_qsos() { + function total_sat_qsos($yr = 'All') { $qsoView = array(); - $sats = $this->get_sats(); - $modes = $this->get_sat_modes(); + $sats = $this->get_sats($yr); + $modes = $this->get_sat_modes($yr); $sattotal = array(); $modetotal = array(); @@ -351,7 +399,7 @@ } // Populating array with worked - $workedQso = $this->modeSatQso(); + $workedQso = $this->modeSatQso($yr); foreach ($workedQso as $line) { if ($line->col_submode == null || $line->col_submode == "") { $qsoView [$line->sat] [$line->col_mode] = $line->count; @@ -371,11 +419,11 @@ return $result; } - function total_qsos() { + function total_qsos($yr = 'All') { $qsoView = array(); - $bands = $this->get_bands(); - $modes = $this->get_modes(); + $bands = $this->get_bands($yr); + $modes = $this->get_modes($yr); $bandtotal = array(); $modetotal = array(); @@ -389,7 +437,7 @@ } // Populating array with worked - $workedQso = $this->modeBandQso(); + $workedQso = $this->modeBandQso($yr); foreach ($workedQso as $line) { if ($line->col_submode == null || $line->col_submode == "") { $qsoView [$line->col_mode] [$line->band] = $line->count; @@ -408,15 +456,15 @@ return $result; } - function total_qsls() { + function total_qsls($yr = 'All') { $qsoView = array(); $qsoSatView = array(); - $bands = $this->get_bands(); - $modes = $this->get_modes(); + $bands = $this->get_bands($yr); + $modes = $this->get_modes($yr); - $sats = $this->get_sats(); - $satmodes = $this->get_sat_modes(); + $sats = $this->get_sats($yr); + $satmodes = $this->get_sat_modes($yr); // Generating the band/mode table foreach ($bands as $band) { @@ -431,7 +479,7 @@ } // Populating array with numbers - $workedQso = $this->modeBandQsl(); + $workedQso = $this->modeBandQsl($yr); foreach ($workedQso as $line) { if ($line->col_submode == null || $line->col_submode == "") { $qsoView [$line->col_mode] [$line->band] ['qso'] = $line->qsos; @@ -463,7 +511,7 @@ } // Populating array with numbers - $workedSatQso = $this->modeSatQsl(); + $workedSatQso = $this->modeSatQsl($yr); foreach ($workedSatQso as $line) { if ($line->col_submode == null || $line->col_submode == "") { $qsoSatView [$line->col_mode] [$line->sat] ['qso'] = $line->qsos; @@ -488,56 +536,70 @@ return $result; } - function modeBandQsl() { + function modeBandQsl($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - + $binding=[]; if (!$logbooks_locations_array) { return null; } $sql = "select lower(col_band) as band, col_mode, coalesce(col_submode, '') col_submode, - count(*) qsos, + count(1) qsos, count(case when COL_QSL_RCVD='Y' then 1 end) qsl, count(case when COL_EQSL_QSL_RCVD='Y' then 1 end) eqsl, count(case when COL_LOTW_QSL_RCVD='Y' then 1 end) lotw, count(case when COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' then 1 end) qrz, count(case when COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y' then 1 end) clublog from " . $this->config->item('table_name') . " - where station_id in (". implode(',', $logbooks_locations_array) .") - and col_prop_mode <> 'SAT' + where station_id in (". implode(',', $logbooks_locations_array) .")"; + if ($yr != 'All') { + $sql.=" and COL_TIME_ON >= ? and COL_TIME_ON <= ? "; + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $binding[]=$syr; + $binding[]=$eyr; + } + $sql.=" and col_prop_mode <> 'SAT' group by lower(col_band), col_mode, coalesce(col_submode, '')"; - $result = $this->db->query($sql); + $result = $this->db->query($sql,$binding); return $result->result(); } - function modeSatQsl() { + function modeSatQsl($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - + $binding=[]; if (!$logbooks_locations_array) { return null; } $sql = "select upper(col_sat_name) as sat, col_mode, coalesce(col_submode, '') col_submode, - count(*) qsos, + count(1) qsos, count(case when COL_QSL_RCVD='Y' then 1 end) qsl, count(case when COL_EQSL_QSL_RCVD='Y' then 1 end) eqsl, count(case when COL_LOTW_QSL_RCVD='Y' then 1 end) lotw, count(case when COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' then 1 end) qrz, count(case when COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y' then 1 end) clublog from " . $this->config->item('table_name') . " - where station_id in (". implode(',', $logbooks_locations_array) .") - and col_prop_mode = 'SAT' + where station_id in (". implode(',', $logbooks_locations_array) .")"; + if ($yr != 'All') { + $sql.=" and COL_TIME_ON >= ? and COL_TIME_ON <= ? "; + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $binding[]=$syr; + $binding[]=$eyr; + } + $sql.=" and col_prop_mode = 'SAT' and coalesce(col_sat_name, '') <> '' group by upper(col_sat_name), col_mode, coalesce(col_submode, '')"; - $result = $this->db->query($sql); + $result = $this->db->query($sql,$binding); return $result->result(); } - function modeSatQso() { + function modeSatQso($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -547,9 +609,15 @@ $bands = array(); - $this->db->select('count(*) as count, upper(col_sat_name) as sat, col_mode, coalesce(col_submode, "") col_submode', FALSE); + $this->db->select('count(1) as count, upper(col_sat_name) as sat, col_mode, coalesce(col_submode, "") col_submode', FALSE); $this->db->where('coalesce(col_sat_name,"") != ""'); $this->db->where('col_prop_mode', 'SAT'); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('upper(col_sat_name), col_mode, coalesce(col_submode, "")'); @@ -558,7 +626,7 @@ return $query->result(); } - function modeBandQso() { + function modeBandQso($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -567,6 +635,12 @@ } $this->db->select('count(*) as count, lower(col_band) as band, col_mode, coalesce(col_submode, "") col_submode', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('lower(col_band), col_mode, coalesce(col_submode, "")'); @@ -575,7 +649,7 @@ return $query->result(); } - function get_sats() { + function get_sats($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -586,6 +660,12 @@ $sats = array(); $this->db->select('distinct col_sat_name as satsort, upper(col_sat_name) as sat', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where('coalesce(col_sat_name,"") != ""'); $this->db->where('col_prop_mode', 'SAT'); $this->db->where_in('station_id', $logbooks_locations_array); @@ -599,7 +679,7 @@ return $sats; } - function get_bands() { + function get_bands($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -610,6 +690,12 @@ $bands = array(); $this->db->select('distinct col_band+0 as bandsort, lower(col_band) as band', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by('bandsort', 'desc'); @@ -634,7 +720,7 @@ return $bands; } - function get_sat_modes() { + function get_sat_modes($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -645,6 +731,12 @@ $modes = array(); $this->db->select('distinct col_mode, coalesce(col_submode, "") col_submode', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where('coalesce(col_sat_name,"") != ""'); $this->db->where('col_prop_mode', 'SAT'); $this->db->where_in('station_id', $logbooks_locations_array); @@ -663,7 +755,7 @@ return $modes; } - function get_modes() { + function get_modes($yr = 'All') { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -674,6 +766,12 @@ $modes = array(); $this->db->select('distinct col_mode, coalesce(col_submode, "") col_submode', FALSE); + if ($yr != 'All') { + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $this->db->where('COL_TIME_ON >=', $syr); + $this->db->where('COL_TIME_ON <=', $eyr); + } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by('col_mode, col_submode', 'ASC'); @@ -690,7 +788,7 @@ return $modes; } - function elevationdata($sat, $orbit) { + function elevationdata($sat, $orbit, $yr = 'All') { $conditions = []; $binding = []; @@ -720,8 +818,15 @@ $sql = "SELECT count(*) qsos, round(COL_ANT_EL) elevation FROM ".$this->config->item('table_name')." LEFT JOIN satellite ON satellite.name = ".$this->config->item('table_name').".COL_SAT_NAME - where station_id in (" . implode(',',$logbooks_locations_array) . ") and coalesce(col_ant_el, '') <> '' - $where + where station_id in (" . implode(',',$logbooks_locations_array) . ") and coalesce(col_ant_el, '') <> ''"; + if ($yr != 'All') { + $sql.=" and COL_TIME_ON >= ? and COL_TIME_ON <= ? "; + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $binding[]=$syr; + $binding[]=$eyr; + } + $sql.=" $where group by round(col_ant_el) order by elevation asc"; @@ -729,7 +834,7 @@ return $result->result(); } - function azimuthdata($band, $mode, $sat, $orbit) { + function azimuthdata($band, $mode, $sat, $orbit, $yr = 'All') { $conditions = []; $binding = []; @@ -773,8 +878,15 @@ FROM ".$this->config->item('table_name')." LEFT JOIN satellite ON satellite.name = ".$this->config->item('table_name').".COL_SAT_NAME where station_id in (" . implode(',',$logbooks_locations_array) . ") - and coalesce(col_ant_az, '') <> '' - $where + and coalesce(col_ant_az, '') <> ''"; + if ($yr != 'All') { + $sql.=" and COL_TIME_ON >= ? and COL_TIME_ON <= ? "; + $syr = date($yr.'-01-01 00:00:00'); + $eyr = date($yr.'-12-31 23:59:59'); + $binding[]=$syr; + $binding[]=$eyr; + } + $sql.=" $where group by round(col_ant_az) order by azimuth asc"; diff --git a/application/views/activated_gridmap/index.php b/application/views/activated_gridmap/index.php index 62e031180..7323f6e35 100644 --- a/application/views/activated_gridmap/index.php +++ b/application/views/activated_gridmap/index.php @@ -127,5 +127,9 @@ var visitor = false; echo 'var gridsquares_gridsquares_confirmed = "' . $gridsquares_gridsquares_confirmed . '";'; echo 'var gridsquares_gridsquares_not_confirmed = "' . $gridsquares_gridsquares_not_confirmed . '";'; echo 'var gridsquares_gridsquares_total_worked = "' . $gridsquares_gridsquares_total_activated . '";'; + echo "var gridsquares_fields = \"" . $gridsquares_fields . "\";\n"; + echo "var gridsquares_fields_confirmed = \"" . $gridsquares_fields_confirmed . "\";\n"; + echo "var gridsquares_fields_not_confirmed = \"" . $gridsquares_fields_not_confirmed . "\";\n"; + echo "var gridsquares_fields_total_worked = \"" . $gridsquares_fields_total_worked . "\";\n"; ?> diff --git a/application/views/statistics/index.php b/application/views/statistics/index.php index d9d287f00..568b9eae2 100644 --- a/application/views/statistics/index.php +++ b/application/views/statistics/index.php @@ -19,6 +19,7 @@ var lang_statistics_number_of_qso_worked = ""; var lang_gen_hamradio_mode = ""; var lang_gen_hamradio_band = ""; + var lang_gen_satellite = "";

@@ -27,7 +28,15 @@ - +
+