diff --git a/application/controllers/Map.php b/application/controllers/Map.php
new file mode 100644
index 00000000..121f1576
--- /dev/null
+++ b/application/controllers/Map.php
@@ -0,0 +1,88 @@
+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 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) {
+ //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."\"}";
+ } 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 *
+ 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."\"}";
+ $count++;
+ }
+ }
+
+ }
+ echo "]";
+ echo "}";
+
+ }
+}
\ No newline at end of file
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 30608c47..13086dcf 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -986,6 +986,20 @@ class Logbook_model extends CI_Model {
}
}
+ /* 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() {
diff --git a/application/models/Stations.php b/application/models/Stations.php
index d7945260..d179bb00 100644
--- a/application/models/Stations.php
+++ b/application/models/Stations.php
@@ -24,10 +24,21 @@ class Stations extends CI_Model {
function profile($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
+ $this->db->where('station_id', $clean_id);
+ return $this->db->get('station_profile');
+ }
+
+ function profile_clean($id) {
+ // Clean ID
+ $clean_id = $this->security->xss_clean($id);
$this->db->where('station_id', $clean_id);
- return $this->db->get('station_profile');
+ $query = $this->db->get('station_profile');
+
+ $row = $query->row();
+
+ return $row;
}
/*
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index bde98017..5b6bde7f 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -142,6 +142,37 @@ $('[data-fancybox]').fancybox({
+uri->segment(1) == "map") { ?>
+
+
+
+
+
uri->segment(1) == "" || $this->uri->segment(1) == "dashboard" ) { ?>
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 9f8902ea..01c88fe1 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -94,6 +94,8 @@
Accumulated statistics