diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index ffde37ff..7c74fd67 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -4479,6 +4479,64 @@ function lotw_last_qsl_date($user_id) {
}
return false;
}
+
+ // [JSON PLOT] return array for plot qso for map //
+ public function get_plot_array_for_map($qsos_result) {
+ $this->load->library('qra');
+
+ $json["markers"] = array();
+ $plot = array('lat'=>0, 'lng'=>0, 'html'=>'', 'label'=>'', 'confirmed'=>'N');
+
+ foreach ($qsos_result as $row) {
+ $plot['label'] = $row->COL_CALL;
+
+ $plot['html'] = "Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
";
+ $plot['html'] .= ($row->COL_SAT_NAME != null) ? ("SAT: ".$row->COL_SAT_NAME."
") : ("Band: ".$row->COL_BAND."
");
+ $plot['html'] .= "Mode: ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)."
";
+
+ // check if qso is confirmed //
+ if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) {
+ $plot['confirmed'] = "Y";
+ }
+ // check lat / lng (depend info source) //
+ if ($row->COL_GRIDSQUARE != null) {
+ $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
+
+ } 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);
+ }
+ } else {
+ if (isset($row->lat) && isset($row->long)) {
+ $stn_loc = array($row->lat, $row->long);
+ }
+ }
+ list($plot['lat'], $plot['lng']) = $stn_loc;
+ // add plot //
+ $json["markers"][] = $plot;
+ }
+ return $json;
+ }
}
function validateADIFDate($date, $format = 'Ymd')
diff --git a/application/models/Stations.php b/application/models/Stations.php
index 46ae25e3..c26b433d 100644
--- a/application/models/Stations.php
+++ b/application/models/Stations.php
@@ -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();
}
}
diff --git a/assets/js/leaflet/leafembed.js b/assets/js/leaflet/leafembed.js
index cc8a216f..e76678ba 100644
--- a/assets/js/leaflet/leafembed.js
+++ b/assets/js/leaflet/leafembed.js
@@ -59,8 +59,9 @@ function initmap(ShowGrid='No', MapTag='map', options={}) {
function askForPlots(_url_qso, options={}) {
removeMarkers();
+ if (typeof options.dataPost !== "undefined") { _dataPost = options.dataPost; } else { _dataPost = {}; }
$.ajax({
- url: _url_qso, type: 'GET', dataType: 'json',
+ url: _url_qso, type: 'POST', dataType: 'json', data: _dataPost,
error: function() { console.log('[ERROR] ajax askForPlots() function return error.'); },
success: function(plotjson) {
if ((typeof plotjson['markers'] !== "undefined")&&(plotjson['markers'].length>0)) {