diff --git a/application/controllers/Map.php b/application/controllers/Map.php index 7484bb53..4abd750c 100644 --- a/application/controllers/Map.php +++ b/application/controllers/Map.php @@ -34,6 +34,26 @@ class Map extends CI_Controller { function custom() { + $this->load->model('dxcc'); + $this->load->model('modes'); + + $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select + $data['modes'] = $this->modes->active(); // Used in the view for mode select + + if ($this->input->post('band') != NULL) { // Band is not set when page first loads. + if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands + $bands = $data['worked_bands']; + } + else { + $bands[] = $this->input->post('band'); + } + } + else { + $bands = $data['worked_bands']; + } + + $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view + // Calculate Lat/Lng from Locator to use on Maps if($this->session->userdata('user_locator')) { $this->load->library('qra'); @@ -83,11 +103,12 @@ class Map extends CI_Controller { function map_data_custom() { $start_date = $this->uri->segment(3); $end_date = $this->uri->segment(4); + $band = $this->uri->segment(5); $this->load->model('logbook_model'); $this->load->library('qra'); - $qsos = $this->logbook_model->map_week_qsos(rawurldecode($start_date), rawurldecode($end_date)); + $qsos = $this->logbook_model->map_custom_qsos(rawurldecode($start_date), rawurldecode($end_date), $band); echo "{\"markers\": ["; $count = 1; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index c4881033..55152119 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1021,7 +1021,7 @@ class Logbook_model extends CI_Model { } /* Return QSOs over a period of days */ - function map_week_qsos($start, $end) { + function map_week_qsos($start, $end, $band) { $CI =& get_instance(); $CI->load->model('Stations'); $station_id = $CI->Stations->find_active(); @@ -1034,6 +1034,30 @@ class Logbook_model extends CI_Model { return $query; } + /* used to return custom qsos requires start, end date plus a band */ + function map_custom_qsos($start, $end, $band) { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'"); + $this->db->where("station_id", $station_id); + + + if($band != "All" && $band != "SAT") { + $this->db->where("COL_BAND", $band); + } + + if ($band == "SAT") { + $this->db->where("COL_PROP_MODE", "SAT"); + } + + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + /* Returns QSOs for the date sent eg 2011-09-30 */ function map_day($date) { $CI =& get_instance(); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 1815ea9e..799f2d7a 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -267,7 +267,7 @@ function getLookupResult() { var q_lng = -32.695312; - var qso_loc = '/'; + var qso_loc = '//input->post('band')); ?>'; var q_zoom = 2; $(document).ready(function(){ diff --git a/application/views/map/custom_date.php b/application/views/map/custom_date.php index cd2ad48e..e7e7f4e5 100644 --- a/application/views/map/custom_date.php +++ b/application/views/map/custom_date.php @@ -1,4 +1,4 @@ -
+

station_profile_name; ?> Station Profile QSOs (Custom Date)

@@ -9,8 +9,8 @@
-

From date:

+
@@ -18,15 +18,31 @@
+ -

To date:

+
+ -
-
+
-
-
+
+
+
+
+ +
+ + +
+