From ee985302dd4396d08e45143fe336fddcf2fe9b01 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:09:19 +0100 Subject: [PATCH] [Search] Added incorrect logged cq zone to search --- application/controllers/Logbook.php | 33 +++++++++++++ application/controllers/Search.php | 12 +++++ application/views/interface_assets/footer.php | 23 +++++++++ application/views/search/cqzones.php | 47 +++++++++++++++++++ application/views/search/cqzones_result.php | 45 ++++++++++++++++++ application/views/search/duplicates.php | 4 ++ application/views/search/filter.php | 4 ++ application/views/search/main.php | 3 ++ 8 files changed, 171 insertions(+) create mode 100644 application/views/search/cqzones.php create mode 100644 application/views/search/cqzones_result.php diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index cbe6aa11..d3f3b850 100755 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -731,6 +731,39 @@ class Logbook extends CI_Controller { $this->load->view('search/duplicates_result.php', $data); } + function search_incorrect_cq_zones($station_id) { + $station_id = $this->security->xss_clean($station_id); + + $this->load->model('user_model'); + + if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } + + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'select * 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 cqzone = col_cqz) + '; + + if ($station_id != 'All') { + $sql .= ' and station_profile.station_id = ' . $station_id; + } + + $query = $this->db->query($sql); + + $data['qsos'] = $query; + + $this->load->view('search/cqzones_result.php', $data); + } + /* * Provide a dxcc search, returning results json encoded */ diff --git a/application/controllers/Search.php b/application/controllers/Search.php index 024abba8..af43c511 100644 --- a/application/controllers/Search.php +++ b/application/controllers/Search.php @@ -68,6 +68,18 @@ class Search extends CI_Controller { $this->load->view('interface_assets/footer'); } + // Searches for incorrect CQ Zones + public function incorrect_cq_zones() { + $this->load->model('stations'); + + $data['station_profile'] = $this->stations->all_of_user(); + $data['page_title'] = "Incorrectly logged CQ zones"; + + $this->load->view('interface_assets/header', $data); + $this->load->view('search/cqzones'); + $this->load->view('interface_assets/footer'); + } + function json_result() { if(isset($_POST['search'])) { $result = $this->fetchQueryResult($_POST['search'], false); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index baed13ac..974e2d7b 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -920,6 +920,29 @@ function findduplicates(){ }); } +function findincorrectcqzones() { + event.preventDefault(); + $('#partial_view').load(base_url+"index.php/logbook/search_incorrect_cq_zones/"+$("#station_id").val(), function() { + $('.qsolist').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "500px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + dom: 'Bfrtip', + buttons: [ + 'csv' + ] + }); + // change color of csv-button if dark mode is chosen + if (isDarkModeTheme()) { + $(".buttons-csv").css("color", "white"); + } + }); +} + function searchButtonPress(){ event.preventDefault() if ($('#callsign').val()) { diff --git a/application/views/search/cqzones.php b/application/views/search/cqzones.php new file mode 100644 index 00000000..309d074a --- /dev/null +++ b/application/views/search/cqzones.php @@ -0,0 +1,47 @@ +
| Date | +Time | +'.$this->lang->line('gen_hamradio_callsign').' | +' . $this->lang->line('gen_hamradio_mode') . ' | +' . $this->lang->line('gen_hamradio_band') . ' | +CQ Zone | +' . $this->lang->line('gen_hamradio_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 ''; + 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 '' . $qso->COL_CQZ . ' | '; + echo '' . $qso->station_callsign . ' | '; + echo '