diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php
index c627c4311..5d994e27b 100644
--- a/application/controllers/Dashboard.php
+++ b/application/controllers/Dashboard.php
@@ -140,103 +140,5 @@ class Dashboard extends CI_Controller {
$this->load->view('components/radio_display_table', $data);
}
- function map() {
- $this->load->model('logbook_model');
-
- $this->load->library('qra');
-
- $qsos = $this->logbook_model->get_last_qsos('18');
-
- echo "{\"markers\": [";
- $count = 1;
- foreach ($qsos->result() as $row) {
- // check if qso is confirmed //
- if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) { $row->_is_confirmed = 'Y'; } else { $row->_is_confirmed = 'N'; }
- //print_r($row);
- if($row->COL_GRIDSQUARE != null) {
- $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
- 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $count++;
- } else {
- if($count != 1) {
- echo ",";
- }
-
- if(isset($row->lat) && isset($row->long)) {
- $lat = $row->lat;
- $lng = $row->long;
- }
- echo "{\"lat\":\"".$lat."\",\"lng\":\"".$lng."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- $count++;
- }
-
- }
- echo "]";
-
- // [MAP Custom] ADD Station //
- $this->load->model('Stations');
- $station_json = $this->Stations->get_station_json_for_map();
- echo (!empty($station_json))?', '.$station_json:'';
-
- echo "}";
-
- }
-
}
diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php
index 3bf881aab..99a5efc1f 100644
--- a/application/controllers/Logbook.php
+++ b/application/controllers/Logbook.php
@@ -589,109 +589,6 @@ class Logbook extends CI_Controller {
}
}
-
- /* Used to generate maps for displaying on /logbook/ */
- function qso_map() {
- header('Content-Type: application/json; charset=utf-8');
- $this->load->model('logbook_model');
-
- $this->load->library('qra');
-
- $data['qsos'] = $this->logbook_model->get_qsos($this->uri->segment(3),$this->uri->segment(4));
-
- echo "{\"markers\": [";
- $count = 1;
- foreach ($data['qsos']->result() as $row) {
- // check if qso is confirmed //
- if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) { $row->_is_confirmed = 'Y'; } else { $row->_is_confirmed = 'N'; }
-
- if($row->COL_GRIDSQUARE != null) {
- $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
- 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $count++;
-
- } else {
- if($count != 1) {
- echo ",";
- }
-
- $result = $this->logbook_model->dxcc_lookup($row->COL_CALL, $row->COL_TIME_ON);
-
- if(isset($result)) {
- $lat = $result['lat'];
- $lng = $result['long'];
- }
- echo "{\"lat\":\"".$lat."\",\"lng\":\"".$lng."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- $count++;
- }
-
- }
- echo "]";
-
- // [MAP Custom] ADD Station //
- $this->load->model('Stations');
- $station_json = $this->Stations->get_station_json_for_map();
- echo (!empty($station_json))?', '.$station_json:'';
-
- echo "}";
- }
-
function view($id) {
$this->load->library('DxccFlag');
diff --git a/application/controllers/Map.php b/application/controllers/Map.php
index a7b5757e5..456b23cb9 100644
--- a/application/controllers/Map.php
+++ b/application/controllers/Map.php
@@ -3,32 +3,8 @@
class Map extends CI_Controller {
- function index()
- {
-
- // Calculate Lat/Lng from Locator to use on Maps
- if($this->session->userdata('user_locator')) {
- $this->load->library('qra');
-
- $qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
- $data['qra'] = "set";
- $data['qra_lat'] = $qra_position[0];
- $data['qra_lng'] = $qra_position[1];
- } else {
- $data['qra'] = "none";
- }
-
- $this->load->model('Stations');
- $station_id = $this->Stations->find_active();
- $station_data = $this->Stations->profile_clean($station_id);
-
- // load the view
- $data['station_profile'] = $station_data;
- $data['page_title'] = "Map QSOs";
-
- $this->load->view('interface_assets/header', $data);
- $this->load->view('map/qsos');
- $this->load->view('interface_assets/footer');
+ function index() {
+ redirect('map/custom');
}
function custom()
@@ -79,221 +55,38 @@ class Map extends CI_Controller {
$data['logbook_name'] = $logbook_name;
$data['page_title'] = "Map QSOs";
- if ($this->input->post('from')) {
- $from = $this->input->post('from');
- $footer_data['date_from'] = $from;
- } else {
- $footer_data['date_from'] = date('Y-m-d H:i:00');
- }
- if ($this->input->post('to')) {
- $to = $this->input->post('to');
- $footer_data['date_to'] = $to;
- } else {
- $temp_to = new DateTime('tomorrow');
- $footer_data['date_to'] = $temp_to->format('Y-m-d H:i:00');
- }
+ $data['date_from'] = $data['date_to'] = date('Y-m-d');
$this->load->view('interface_assets/header', $data);
$this->load->view('map/custom_date');
- $this->load->view('interface_assets/footer',$footer_data);
+ $this->load->view('interface_assets/footer');
}
-
- function map_data_custom() {
- $start_date = $this->uri->segment(3);
- $end_date = $this->uri->segment(4);
- $band = $this->uri->segment(5);
- $mode = $this->uri->segment(6);
- $propagation = $this->uri->segment(7);
+ // Generic fonction for return Json for MAP //
+ public function map_plot_json() {
+ $this->load->model('Stations');
$this->load->model('logbook_model');
-
- $this->load->library('qra');
-
- $qsos = $this->logbook_model->map_custom_qsos(rawurldecode($start_date), rawurldecode($end_date), $band, rawurldecode($mode), rawurldecode($propagation));
+
+ // set informations //
+ if ($this->input->post('isCustom') == true) {
+ $date_from = xss_clean($this->input->post('date_from'));
+ $date_to = xss_clean($this->input->post('date_to'));
+ $band = xss_clean($this->input->post('band'));
+ $mode = xss_clean($this->input->post('mode'));
+ $prop_mode = xss_clean($this->input->post('prop_mode'));
+ $qsos = $this->logbook_model->map_custom_qsos($date_from, $date_to, $band, $mode, $prop_mode);
+ } else {
+ $nb_qso = (intval($this->input->post('nb_qso'))>0)?xss_clean($this->input->post('nb_qso')):18;
+ $offset = (intval($this->input->post('offset'))>0)?xss_clean($this->input->post('offset')):null;
+ $qsos = $this->logbook_model->get_qsos($nb_qso, $offset);
+ }
+ // [PLOT] ADD plot //
+ $plot_array = $this->logbook_model->get_plot_array_for_map($qsos->result());
+ // [MAP Custom] ADD Station //
+ $station_array = $this->Stations->get_station_array_for_map();
+
header('Content-Type: application/json; charset=utf-8');
- echo "{\"markers\": [";
- $count = 1;
- if ($qsos) {
- foreach ($qsos->result() as $row) {
- // check if qso is confirmed //
- if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) { $row->_is_confirmed = 'Y'; } else { $row->_is_confirmed = 'N'; }
-
- //print_r($row);
- if($row->COL_GRIDSQUARE != null) {
- $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
- 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $count++;
- } else {
- if($count != 1) {
- echo ",";
- }
-
- if(isset($row->lat) && isset($row->long)) {
- $lat = $row->lat;
- $lng = $row->long;
- }
-
- echo "{\"lat\":\"".$lat."\",\"lng\":\"".$lng."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- $count++;
- }
- }
-
- }
- echo "]";
-
- // [MAP Custom] ADD Station //
- $this->load->model('Stations');
- $station_json = $this->Stations->get_station_json_for_map();
- echo (!empty($station_json))?', '.$station_json:'';
-
- echo "}";
-
+ echo json_encode(array_merge($plot_array, $station_array));
}
- function map_data() {
- $this->load->model('logbook_model');
-
- $this->load->library('qra');
-
- //echo date('Y-m-d')
- $raw = strtotime('Monday last week');
-
- $mon = date('Y-m-d', $raw);
- $sun = date('Y-m-d', strtotime('Monday next week'));
-
- $qsos = $this->logbook_model->map_all_qsos_for_active_station_profile();
-
- echo "{\"markers\": [";
- $count = 1;
- foreach ($qsos->result() as $row) {
- // check if qso is confirmed //
- if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) { $row->_is_confirmed = 'Y'; } else { $row->_is_confirmed = 'N'; }
-
- //print_r($row);
- if($row->COL_GRIDSQUARE != null) {
- $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
- 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- } 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."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- }
-
- $count++;
- } else {
- $query = $this->db->query('
- SELECT *
- FROM dxcc_entities
- WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
- ORDER BY LENGTH( prefix ) DESC
- LIMIT 1
- ');
-
- foreach ($query->result() as $dxcc) {
- if($count != 1) {
- echo ",";
- }
- echo "{\"lat\":\"".$dxcc->lat."\",\"lng\":\"".$dxcc->long."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\", \"confirmed\":\"".$row->_is_confirmed."\"}";
- $count++;
- }
- }
-
- }
- echo "]";
-
- // [MAP Custom] ADD Station //
- $this->load->model('Stations');
- $station_json = $this->Stations->get_station_json_for_map();
- echo (!empty($station_json))?', '.$station_json:'';
-
- echo "}";
-
- }
}
diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php
index 8895280b9..92fe41d30 100644
--- a/application/controllers/Visitor.php
+++ b/application/controllers/Visitor.php
@@ -161,92 +161,12 @@ class Visitor extends CI_Controller {
show_404('Unknown Public Page.');
}
- $qsos = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array);
- header('Content-Type: application/json; charset=utf-8');
- echo "{\"markers\": [";
- $count = 1;
- foreach ($qsos->result() as $row) {
- //print_r($row);
- $begindate=date('d/m/y', strtotime($row->COL_TIME_ON));
- if($row->COL_GRIDSQUARE != null) {
- $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
- 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: ".$begindate."
SAT: ".$row->COL_SAT_NAME."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\"}";
- } else {
- echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date: ".$begindate."
Band: ".$row->COL_BAND."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\"}";
- }
-
- $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: ".$begindate."
SAT: ".$row->COL_SAT_NAME."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\"}";
- } else {
- echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date: ".$begindate."
Band: ".$row->COL_BAND."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\"}";
- }
-
- $count++;
-
- } else {
- if($count != 1) {
- echo ",";
- }
-
- if(isset($row->lat) && isset($row->long)) {
- $lat = $row->lat;
- $lng = $row->long;
- }
-
- echo "{\"lat\":\"".$lat."\",\"lng\":\"".$lng."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date: ".$begindate."
Band: ".$row->COL_BAND."
Mode: ";
- echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
- echo "\",\"label\":\"".$row->COL_CALL."\"}";
- $count++;
- }
-
- }
- echo "]";
- echo "}";
-
+ $qsos = $this->logbook_model->get_qsos('18', null, $logbooks_locations_array);
+ // [PLOT] ADD plot //
+ $plot_array = $this->logbook_model->get_plot_array_for_map($qsos->result());
+
+ header('Content-Type: application/json; charset=utf-8');
+ echo json_encode($plot_array);
}
public function satellites()
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 6a6336c76..c7b67846d 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -2129,7 +2129,7 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
}
$this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left');
- $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
+ $this->db->where("COL_TIME_ON BETWEEN '".$start." 00:00:00' AND '".$end." 23:59:59'");
$this->db->where_in("station_id", $logbooks_locations_array);
if($band != "All" && $band != "SAT") {
@@ -2223,20 +2223,6 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
}
}
- /* Return QSOs for the year for the active profile */
- function map_all_qsos_for_active_station_profile() {
- $CI =& get_instance();
- $CI->load->model('stations');
- $station_id = $CI->stations->find_active();
-
- $this->db->where("station_id", $station_id);
- $this->db->order_by("COL_TIME_ON", "ASC");
- $query = $this->db->get($this->config->item('table_name'));
-
- return $query;
- }
-
-
/* Return QSOs made during the current Year */
function year_qsos($StationLocationsArray = null, $api_key = null) {
@@ -4511,6 +4497,67 @@ 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, $isVisitor=false) {
+ $this->load->library('qra');
+
+ $json["markers"] = array();
+
+ foreach ($qsos_result as $row) {
+ $plot = array('lat'=>0, 'lng'=>0, 'html'=>'', 'label'=>'', 'confirmed'=>'N');
+
+ $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 (!$isVisitor) {
+ 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 28bcb691b..4c78ec377 100644
--- a/application/models/Stations.php
+++ b/application/models/Stations.php
@@ -515,14 +515,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/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index 5c163a5b1..021e71069 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -728,7 +728,7 @@ function showActivatorsMap(call, count, grids) {
var q_lng = -32.695312;
- var qso_loc = '//input->post('band')); ?>/input->post('mode')); ?>/input->post('prop_mode')); ?>';
+ var qso_loc = '';
var q_zoom = 3;
$(document).ready(function(){
@@ -737,38 +737,26 @@ function showActivatorsMap(call, count, grids) {
var grid = "No";
- initmap(grid, 'custommap');
+ initmap(grid, 'custommap', {'initmap_only':true});
+ // Check and change date if to < from //
+ $('.custom-map-QSOs input[name="to"]').off('change').on('change', function() {
+ if ($('.custom-map-QSOs input[name="to"]').val().replaceAll('-','') < $('.custom-map-QSOs input[name="from"]').val().replaceAll('-','')) {
+ $('.custom-map-QSOs input[name="from"]').val($('.custom-map-QSOs input[name="to"]').val());
+ }
+ });
+ $('.custom-map-QSOs input[name="from"]').off('change').on('change', function() {
+ if ($('.custom-map-QSOs input[name="from"]').val().replaceAll('-','') > $('.custom-map-QSOs input[name="to"]').val().replaceAll('-','')) {
+ $('.custom-map-QSOs input[name="to"]').val($('.custom-map-QSOs input[name="from"]').val());
+ }
+ });
+ // Form "submit" //
+ $('.custom-map-QSOs .btn_submit_map_custom').off('click').on('click',function() {
+ var customdata = {'dataPost':{'date_from': $('.custom-map-QSOs input[name="from"]').val(), 'date_to': $('.custom-map-QSOs input[name="to"]').val(),
+ 'band': $('.custom-map-QSOs select[name="band"]').val(), 'mode': $('.custom-map-QSOs select[name="mode"]').val(),
+ 'prop_mode': $('.custom-map-QSOs select[name="prop_mode"]').val(), 'isCustom':true }, 'map_id':'#custommap'};
+ initplot(qso_loc, customdata);
+ })
- });
-
-
-
-uri->segment(1) == "map" && $this->uri->segment(2) == "") { ?>
-
-
-
@@ -791,7 +779,7 @@ function showActivatorsMap(call, count, grids) {
var q_lng = -32.695312;
- var qso_loc = '';
+ var qso_loc = '';
var q_zoom = 3;
$(document).ready(function(){
@@ -800,7 +788,7 @@ function showActivatorsMap(call, count, grids) {
var grid = "No";
- initmap(grid);
+ initmap(grid,'map',{'dataPost':{'nb_qso':'18'}});
});
@@ -990,7 +978,7 @@ $($('#callsign')).on('keypress',function(e) {
var q_lng = -32.695312;
- var qso_loc = 'uri->segment(3)); ?>';
+ var qso_loc = '';
var q_zoom = 3;
config->item('map_gridsquares') != FALSE) { ?>
@@ -998,7 +986,7 @@ $($('#callsign')).on('keypress',function(e) {
var grid = "No";
- initmap(grid);
+ initmap(grid,'map',{'dataPost':{'nb_qso':'25','offset':'uri->segment(3); ?>'}});
diff --git a/application/views/map/custom_date.php b/application/views/map/custom_date.php
index ead97d0f7..ecc255df2 100644
--- a/application/views/map/custom_date.php
+++ b/application/views/map/custom_date.php
@@ -12,12 +12,12 @@