From 78f11d62c6f47b7f9a11d597ce3ecc51061bdc66 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 29 Jul 2021 10:38:27 +0200 Subject: [PATCH] [Quick lookup] Added clickable links so that you can see the qso information that lies behind the W/C in quick lookup. --- application/controllers/Awards.php | 8 +++++++ application/controllers/Lookup.php | 22 +++++++++--------- application/models/Logbook_model.php | 10 ++++++++ application/views/lookup/result.php | 34 +++++++++++++++++++++++----- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 1130810c..4fa7d2ec 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -195,6 +195,14 @@ class Awards extends CI_Controller { $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type); + // This is done because we have two different ways to get dxcc info in Cloudlog. Once is using the name (in awards), and the other one is using the ADIF DXCC. + // We replace the values to make it look a bit nicer + if ($type == 'DXCC2') { + $type = 'DXCC'; + $dxccname = $this->logbook_model->get_entity($searchphrase); + $searchphrase = $dxccname['name']; + } + // Render Page $data['page_title'] = "Log View - " . $type; $data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode; diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index e2247d16..587fb7da 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -35,18 +35,18 @@ class Lookup extends CI_Controller { $data['bands'] = $this->lookup_model->get_Worked_Bands($station_id); - $queryinfo['type'] = xss_clean($this->input->post('type')); - $queryinfo['dxcc'] = xss_clean($this->input->post('dxcc')); - $queryinfo['was'] = xss_clean($this->input->post('was')); - $queryinfo['sota'] = xss_clean($this->input->post('sota')); - $queryinfo['grid'] = xss_clean($this->input->post('grid')); - $queryinfo['iota'] = xss_clean($this->input->post('iota')); - $queryinfo['cqz'] = xss_clean($this->input->post('cqz')); - $queryinfo['wwff'] = xss_clean($this->input->post('wwff')); - $queryinfo['station_id'] = $station_id; - $queryinfo['bands'] = $data['bands']; + $data['type'] = xss_clean($this->input->post('type')); + $data['dxcc'] = xss_clean($this->input->post('dxcc')); + $data['was'] = xss_clean($this->input->post('was')); + $data['sota'] = xss_clean($this->input->post('sota')); + $data['grid'] = xss_clean($this->input->post('grid')); + $data['iota'] = xss_clean($this->input->post('iota')); + $data['cqz'] = xss_clean($this->input->post('cqz')); + $data['wwff'] = xss_clean($this->input->post('wwff')); + $data['station_id'] = $station_id; + + $data['result'] = $this->lookup_model->getSearchResult($data); - $data['result'] = $this->lookup_model->getSearchResult($queryinfo); $this->load->view('lookup/result', $data); } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f6d773c2..2a52ba5b 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -244,6 +244,9 @@ class Logbook_model extends CI_Model { case 'DXCC': $this->db->where('COL_COUNTRY', $searchphrase); break; + case 'DXCC2': + $this->db->where('COL_DXCC', $searchphrase); + break; case 'IOTA': $this->db->where('COL_IOTA', $searchphrase); break; @@ -257,6 +260,13 @@ class Logbook_model extends CI_Model { $this->db->where('COL_STATE', $searchphrase); $this->db->where_in('COL_DXCC', ['291', '6', '110']); break; + case 'SOTA': + $this->db->where('COL_SOTA_REF', $searchphrase); + break; + case 'WWFF': + $this->db->where('COL_SIG', 'WWFF'); + $this->db->where('COL_SIG_INFO', $searchphrase); + break; } $this->db->where('station_id', $station_id); diff --git a/application/views/lookup/result.php b/application/views/lookup/result.php index fba7869a..3212e305 100644 --- a/application/views/lookup/result.php +++ b/application/views/lookup/result.php @@ -13,15 +13,37 @@ echo ' foreach ($result as $mode => $value) { echo ' '. strtoupper($mode) .''; - foreach ($value as $key) { - if ($key == 'W') { - echo '
' . $key . '
'; + foreach ($value as $key => $val) { + if ($val == 'W') { + $info = '
'; + switch($type) { + case 'dxcc': $info .= 'W'; break; + case 'iota': $info .= 'W'; break; + case 'grid': $info .= 'W'; break; + case 'cqz': $info .= 'W'; break; + case 'was': $info .= 'W'; break; + case 'sota': $info .= 'W'; break; + case 'wwff': $info .= 'W'; break; + } + $info .= '
'; + echo $info; } - else if ($key == 'C') { - echo '
' . $key . '
'; + else if ($val == 'C') { + $info = '
'; + switch($type) { + case 'dxcc': $info .= 'C'; break; + case 'iota': $info .= 'C'; break; + case 'grid': $info .= 'C'; break; + case 'cqz': $info .= 'C'; break; + case 'was': $info .= 'C'; break; + case 'sota': $info .= 'C'; break; + case 'wwff': $info .= 'C'; break; + } + $info .= '
'; + echo $info; } else { - echo '' . $key . ''; + echo '' . $val . ''; } } echo '';