From ea829cb1f37b71baff32c479d926fab81605f7cf Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 4 Apr 2022 15:24:47 +0100 Subject: [PATCH] [Visitor] Adds improved code for multigrid markers --- application/controllers/Visitor.php | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index ffdae54e..fca564b6 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -156,7 +156,44 @@ class Visitor extends CI_Controller { } $count++; + } elseif($row->COL_VUCC_GRIDS != null) { + $grids = explode(",", $row->COL_VUCC_GRIDS); + if (count($grids) == 2) { + $grid1 = $this->qra->qra2latlong(trim($grids[0])); + $grid2 = $this->qra->qra2latlong(trim($grids[1])); + + $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); + $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); + + $stn_loc = $this->qra->get_midpoint($coords); + } + if (count($grids) == 4) { + $grid1 = $this->qra->qra2latlong(trim($grids[0])); + $grid2 = $this->qra->qra2latlong(trim($grids[1])); + $grid3 = $this->qra->qra2latlong(trim($grids[2])); + $grid4 = $this->qra->qra2latlong(trim($grids[3])); + + $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); + $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); + $coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]); + $coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]); + + $stn_loc = $this->qra->get_midpoint($coords); + } + + if($count != 1) { + echo ","; + } + + if($row->COL_SAT_NAME != null) { + echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
SAT: ".$row->COL_SAT_NAME."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}"; + } else { + echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}"; + } + + $count++; + } else { $query = $this->db->query(' SELECT *