[Gridsquare map] Fix for vucc grids on map

这个提交包含在:
Andreas 2022-10-22 21:04:33 +02:00
父节点 322b59d0a3
当前提交 dd4ac6ff24
共有 2 个文件被更改,包括 115 次插入0 次删除

查看文件

@ -295,6 +295,58 @@ class Gridsquares extends CI_Controller {
}
}
$query_vucc = $this->gridsquares_model->get_band_worked_vucc_squares($band);
if ($query && $query_vucc->num_rows() > 0)
{
foreach ($query_vucc->result() as $row)
{
$grids = explode(",", $row->COL_VUCC_GRIDS);
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);
}
if(!in_array($grid_four, $array_grid_4char)){
array_push($array_grid_4char, $grid_four);
}
}
}
}
// Confirmed Squares
$query_vucc = $this->gridsquares_model->get_band_confirmed_vucc_squares($band);
if ($query && $query_vucc->num_rows() > 0)
{
foreach ($query_vucc->result() as $row)
{
$grids = explode(",", $row->COL_VUCC_GRIDS);
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);
}
if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){
array_push($array_grid_4char_confirmed, $grid_4char_confirmed);
}
}
}
}
function js_str($s)
{

查看文件

@ -147,6 +147,69 @@ class Gridsquares_model extends CI_Model {
return $this->db->query($sql);
}
function get_band_worked_vucc_squares($band, $StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
if (!$logbooks_locations_array) {
return null;
}
$this->db->select('distinct COL_VUCC_GRIDS, COL_BAND', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_VUCC_GRIDS !=', '');
if ($band != 'All') {
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', "SAT");
$this->db->where('COL_PROP_MODE !=', "INTERNET");
$this->db->where('COL_PROP_MODE !=', "ECH");
$this->db->where('COL_PROP_MODE !=', "RPT");
$this->db->where('COL_SAT_NAME =', "");
}
return $this->db->get($this->config->item('table_name'));
}
function get_band_confirmed_vucc_squares($band, $StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
if (!$logbooks_locations_array) {
return null;
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM '
.$this->config->item('table_name')
.' WHERE station_id in ('
.$location_list.') AND COL_VUCC_GRIDS != ""';
if ($band != 'All') {
$sql .= ' AND COL_BAND = "' . $band
.'"
AND COL_PROP_MODE != "SAT"
AND COL_PROP_MODE != "INTERNET"
AND COL_PROP_MODE != "ECH"
AND COL_PROP_MODE != "RPT"
AND COL_SAT_NAME = ""';
}
$sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query($sql);
}
function search_band($band, $gridsquare, $StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();