new function for return json data for map

This commit is contained in:
abarrau
2023-12-12 07:40:12 +01:00
parent 4424868b88
commit 5886ce2dc8
3 changed files with 63 additions and 4 deletions

View File

@@ -513,14 +513,14 @@ class Stations extends CI_Model {
return false;
}
// [MAP Custom] get json structure (for map) about info's station //
public function get_station_json_for_map() {
// [MAP Custom] get array for json structure (for map) about info's station //
public function get_station_array_for_map() {
$_jsonresult = array();
list($station_lat, $station_lng) = array(0,0);
$station_active = $this->profile($this->find_active())->row();
if (!empty($station_active)) { list($station_lat, $station_lng) = $this->qra->qra2latlong($station_active->station_gridsquare); }
if (($station_lat!=0)&&($station_lng!=0)) { $_jsonresult = array('lat'=>$station_lat,'lng'=>$station_lng,'html'=>$station_active->station_gridsquare,'label'=>$station_active->station_profile_name,'icon'=>'stationIcon'); }
return (count($_jsonresult)>0)?("\"station\":".json_encode($_jsonresult)):'';
return (count($_jsonresult)>0)?(array('station'=>$_jsonresult)):array();
}
}