From 2e3990fb2accc60279006065b5cf751c37256939 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 18 Jul 2021 12:42:58 +0200 Subject: [PATCH] [Gridsquare Map] Added support for searching in COL_VUCC_GRIDS when clicking on gridsquares in map. Fixes #1089 --- application/models/Gridsquares_model.php | 23 +++++++++++-------- application/views/interface_assets/footer.php | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/application/models/Gridsquares_model.php b/application/models/Gridsquares_model.php index 1357ce16c..a173da5dc 100644 --- a/application/models/Gridsquares_model.php +++ b/application/models/Gridsquares_model.php @@ -31,7 +31,7 @@ class Gridsquares_model extends CI_Model { $CI =& get_instance(); $CI->load->model('Stations'); $station_id = $CI->Stations->find_active(); - + return $this->db->query('SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_VUCC_GRIDS != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y") AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")'); } @@ -58,7 +58,7 @@ class Gridsquares_model extends CI_Model { .$station_id.'" AND COL_GRIDSQUARE != ""'; if ($band != 'All') { $sql .= ' AND COL_BAND = "' . $band - .'" + .'" AND COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "INTERNET" AND COL_PROP_MODE != "ECH" @@ -80,7 +80,7 @@ class Gridsquares_model extends CI_Model { .$station_id.'" AND COL_GRIDSQUARE != ""'; if ($band != 'All') { $sql .= ' AND COL_BAND = "' . $band - .'" + .'" AND COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "INTERNET" AND COL_PROP_MODE != "ECH" @@ -99,15 +99,14 @@ class Gridsquares_model extends CI_Model { $CI->load->model('Stations'); $station_id = $CI->Stations->find_active(); - $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE FROM ' + $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' .$this->config->item('table_name') - .' WHERE station_id = "' - .$station_id.'" AND COL_GRIDSQUARE LIKE "%' - .$gridsquare.'%"'; + .' WHERE station_id = "' . $station_id . '" ' + . ' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")'; if ($band != 'All') { $sql .= ' AND COL_BAND = "' . $band - .'" + .'" AND COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "INTERNET" AND COL_PROP_MODE != "ECH" @@ -126,7 +125,13 @@ class Gridsquares_model extends CI_Model { $CI->load->model('Stations'); $station_id = $CI->Stations->find_active(); - $result = $this->db->query('SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" AND COL_PROP_MODE = "SAT"'); + $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' . + $this->config->item('table_name'). + ' WHERE station_id = "'.$station_id. '"' . + ' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")'. + ' AND COL_PROP_MODE = "SAT"'; + + $result = $this->db->query($sql); //print_r($result); return json_encode($result->result()); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 799f2d7a8..be8831065 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -827,9 +827,9 @@ $(document).ready(function(){ $.each( data, function( i, item ) { console.log(item.COL_CALL + item.COL_SAT_NAME); if(item.COL_SAT_NAME != undefined) { - items.push( "" + item.COL_TIME_ON + "" + item.COL_CALL + "" + item.COL_MODE + "" + item.COL_SAT_NAME + "" + item.COL_GRIDSQUARE + "" ); + items.push( "" + item.COL_TIME_ON + "" + item.COL_CALL + "" + item.COL_MODE + "" + item.COL_SAT_NAME + "" + item.COL_GRIDSQUARE + item.COL_VUCC_GRIDS + "" ); } else { - items.push( "" + item.COL_TIME_ON + "" + item.COL_CALL + "" + item.COL_MODE + "" + item.COL_BAND + "" + item.COL_GRIDSQUARE + "" ); + items.push( "" + item.COL_TIME_ON + "" + item.COL_CALL + "" + item.COL_MODE + "" + item.COL_BAND + "" + item.COL_GRIDSQUARE + item.COL_VUCC_GRIDS + "" ); } });