diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 8a2d61c68..f04f34f60 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -27,10 +27,10 @@ class Logbook extends CI_Controller { $config['cur_tag_close'] = ''; $this->pagination->initialize($config); - + //load the model and get results $data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3)); - + $data['user_map_custom'] = $this->optionslib->get_map_custom(); if(!$data['results']) { @@ -1089,6 +1089,45 @@ class Logbook extends CI_Controller { $this->load->view('search/cqzones_result.php', $data); } + function search_incorrect_itu_zones($station_id) { + $clean_station_id = $this->security->xss_clean($station_id); + + if (!is_numeric($clean_station_id) && $clean_station_id !== 'All') { + show_404(); + } + + $this->load->model('user_model'); + + if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } + + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = "select *, (select group_concat(distinct ituzone order by ituzone) from dxcc_master where countrycode = thcv.col_dxcc and ituzone <> '' order by ituzone asc) as correctituzone from " . $this->config->item('table_name') . + " thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in (". $location_list . ") + and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and ituzone = col_ituz) and col_dxcc > 0 + "; + + $params = []; + + if ($clean_station_id != 'All') { + $sql .= ' and station_profile.station_id = ?'; + $params[] = $clean_station_id; + } + + $query = $this->db->query($sql, $params); + + $data['qsos'] = $query; + + $this->load->view('search/ituzones_result.php', $data); + } + /* * Provide a dxcc search, returning results json encoded */ diff --git a/application/controllers/Search.php b/application/controllers/Search.php index 614bd6ae2..624e2a491 100644 --- a/application/controllers/Search.php +++ b/application/controllers/Search.php @@ -62,6 +62,18 @@ class Search extends CI_Controller { $this->load->view('interface_assets/footer'); } + // Searches for incorrect ITU Zones + public function incorrect_itu_zones() { + $this->load->model('stations'); + + $data['station_profile'] = $this->stations->all_of_user(); + $data['page_title'] = __("Incorrectly logged ITU zones"); + + $this->load->view('interface_assets/header', $data); + $this->load->view('search/ituzones'); + $this->load->view('interface_assets/footer'); + } + // Searches for unconfirmed Lotw QSOs where QSO partner has uploaded to LoTW after the QSO date public function lotw_unconfirmed() { $this->load->model('stations'); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index fa56065b7..d5e36db39 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -850,6 +850,32 @@ function findincorrectcqzones() { }); } +function findincorrectituzones() { + event.preventDefault(); + $('#partial_view').load(base_url+"index.php/logbook/search_incorrect_itu_zones/"+$("#station_id").val(), function() { + $('.qsolist').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "500px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + "language": { + url: getDataTablesLanguageUrl(), + }, + dom: 'Bfrtip', + buttons: [ + 'csv' + ] + }); + // change color of csv-button if dark mode is chosen + if (isDarkModeTheme()) { + $(".buttons-csv").css("color", "white"); + } + }); +} + function searchButtonPress() { if (event) { event.preventDefault(); } if ($('#callsign').val()) { diff --git a/application/views/search/cqzones.php b/application/views/search/cqzones.php index 23afcccb9..31988ffd3 100644 --- a/application/views/search/cqzones.php +++ b/application/views/search/cqzones.php @@ -16,6 +16,9 @@
| ' . __("Date") . ' | +' . __("Time") . ' | +' . __("Callsign") . ' | +' . __("Mode") . ' | +' . __("Band") . ' | +' . __("Gridsquare") . ' | +' . __("ITU Zone") . ' | +' . __("DXCC ITU Zone") . ' | +' . __("DXCC") . ' | +' . __("Station") . ' | +
|---|---|---|---|---|---|---|---|---|---|
| '; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ' | '; + echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo ' | '; + echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ' | '; + echo ''; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo ' | '; + echo ''; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo ' | '; + echo ''; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo ' | '; + echo '' . $qso->COL_ITUZ . ' | '; + echo '' . $qso->correctituzone . ' | '; + echo '' . ucwords(strtolower($qso->COL_COUNTRY), "- (/") . ' | '; + echo '' . $qso->station_callsign . ' | '; + echo '