Gridmaps show confirmed squares from Lotw & Paper (not eqsl), the band gridmaps do not show satellite, repeaters or anything internet related

This commit is contained in:
Peter Goodhall 2019-06-28 17:07:34 +01:00
parent 39158336d7
commit 6de6a8ca29
4 changed files with 131 additions and 3 deletions

View File

@ -35,9 +35,43 @@ class Gridsquares extends CI_Controller {
$array_grid_2char = array();
$array_grid_4char = array();
$array_confirmed_grid_2char = array();
$array_confirmed_grid_4char = array();
$grid_2char = "";
$grid_4char = "";
$grid_2char_confirmed = "";
$grid_4char_confirmed = "";
// Get Confirmed LOTW & Paper Squares (non VUCC)
$query = $this->gridsquares_model->get_confirmed_sat_squares();
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2));
$grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4));
// Check if 2 Char is in array
if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
}
if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){
array_push($array_confirmed_grid_4char, $grid_4char_confirmed);
}
}
}
// Get worked squares
$query = $this->gridsquares_model->get_worked_sat_squares();
if ($query->num_rows() > 0)
@ -88,6 +122,33 @@ class Gridsquares extends CI_Controller {
}
}
// Confirmed Squares
$query_vucc = $this->gridsquares_model->get_confirmed_sat_vucc_squares();
if ($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_confirmed_grid_2char)){
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
}
if(!in_array($grid_2char_confirmed, $array_confirmed_grid_4char)){
array_push($array_confirmed_grid_4char, $grid_2char_confirmed);
}
}
}
}
function js_str($s)
{
@ -101,6 +162,9 @@ class Gridsquares extends CI_Controller {
}
$data['grid_2char_confirmed'] = js_array($array_confirmed_grid_2char);
$data['grid_4char_confirmed'] = js_array($array_confirmed_grid_4char);
$data['grid_2char'] = js_array($array_grid_2char);
$data['grid_4char'] = js_array($array_grid_4char);
@ -118,13 +182,38 @@ class Gridsquares extends CI_Controller {
$data['page_title'] = "Gridsquare Map";
$array_grid_2char = array();
$array_grid_4char = array();
$array_grid_2char_confirmed = array();
$array_grid_4char_confirmed = array();
$grid_2char = "";
$grid_4char = "";
$grid_2char_confirmed = "";
$grid_4char_confirmed = "";
$query = $this->gridsquares_model->get_band_confirmed($band);
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2));
$grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,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);
}
}
}
$query = $this->gridsquares_model->get_band($band);
if ($query->num_rows() > 0)
@ -160,6 +249,8 @@ class Gridsquares extends CI_Controller {
return '[' . implode(',', $temp) . ']';
}
$data['grid_2char_confirmed'] = js_array($array_grid_2char_confirmed);
$data['grid_4char_confirmed'] = js_array($array_grid_4char_confirmed);
$data['grid_2char'] = js_array($array_grid_2char);
$data['grid_4char'] = js_array($array_grid_4char);

View File

@ -1,7 +1,7 @@
<?php
class Gridsquares_model extends CI_Model {
function __construct()
{
// Call the Model constructor
@ -12,6 +12,15 @@ class Gridsquares_model extends CI_Model {
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,4) as SAT_SQUARE, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE COL_GRIDSQUARE != "" AND COL_SAT_NAME != ""');
}
function get_confirmed_sat_squares() {
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,4) as SAT_SQUARE, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")');
}
function get_confirmed_sat_vucc_squares() {
return $this->db->query('SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE 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")');
}
function get_worked_sat_vucc_squares() {
$this->db->select('COL_PRIMARY_KEY, COL_VUCC_GRIDS, COL_SAT_NAME');
$this->db->where('COL_VUCC_GRIDS !=', "");
@ -20,6 +29,23 @@ class Gridsquares_model extends CI_Model {
}
function get_band($band) {
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES, COL_BAND FROM '.$this->config->item('table_name').' WHERE COL_GRIDSQUARE != "" AND COL_BAND = "'.$band.'"');
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES, COL_BAND FROM '.$this->config->item('table_name').'
WHERE COL_GRIDSQUARE != ""
AND COL_BAND = "'.$band.'"
AND COL_PROP_MODE != "SAT"
AND COL_PROP_MODE != "INTERNET"
AND COL_PROP_MODE != "ECH"
AND COL_PROP_MODE != "RPT"
');
}
function get_band_confirmed($band) {
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES, COL_BAND FROM '.$this->config->item('table_name').' WHERE COL_GRIDSQUARE != "" 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_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")
');
}
}

View File

@ -545,6 +545,9 @@ $(document).ready(function(){
var grid_two = <?php echo $grid_2char; ?>;
var grid_four = <?php echo $grid_4char; ?>;
var grid_two_confirmed = <?php echo $grid_2char_confirmed; ?>;
var grid_four_confirmed = <?php echo $grid_4char_confirmed; ?>;
var maidenhead = L.maidenhead().addTo(map);
</script>

View File

@ -57,8 +57,16 @@ L.Maidenhead = L.LayerGroup.extend({
for (var lon = left; lon < right; lon += (unit*2)) {
for (var lat = bottom; lat < top; lat += unit) {
var bounds = [[lat,lon],[lat+unit,lon+(unit*2)]];
if(grid_two.includes(this._getLocator(lon,lat)) || grid_four.includes(this._getLocator(lon,lat))) {
if(grid_two_confirmed.includes(this._getLocator(lon,lat)) || grid_four_confirmed.includes(this._getLocator(lon,lat))) {
this.addLayer(L.rectangle(bounds, {color: 'rgb(144,238,144)', weight: 1, fillOpacity: 0.6, fill:true, interactive: false}));
} else {
this.addLayer(L.rectangle(bounds, {color: this.options.color, weight: 1, fillOpacity: 0.6, fill:true, interactive: false}));
}
} else {
this.addLayer(L.rectangle(bounds, {color: this.options.color, weight: 1, fill:false, interactive: false}));
}