diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index fe87b3f35..abcf4d6d3 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -14,9 +14,6 @@ class Visitor extends CI_Controller { elseif($method == "map") { $this->map($method); } - elseif($method == "radio_display_component") { - $this->radio_display_component($method); - } elseif($method == "satellites") { $this->satellites($method); } @@ -81,8 +78,6 @@ class Visitor extends CI_Controller { $this->load->model('cat'); - $data['radio_status'] = $this->cat->recent_status(); - // Store info $data['todays_qsos'] = $this->logbook_model->todays_qsos($logbooks_locations_array); $data['total_qsos'] = $this->logbook_model->total_qsos($logbooks_locations_array); @@ -133,13 +128,6 @@ class Visitor extends CI_Controller { } } - public function radio_display_component() { - $this->load->model('cat'); - - $data['radio_status'] = $this->cat->recent_status(); - $this->load->view('components/radio_display_table', $data); - } - public function map() { $this->load->model('logbook_model'); @@ -421,6 +409,16 @@ class Visitor extends CI_Controller { public function exportmap() { $slug = $this->security->xss_clean($this->uri->segment(3)); + $lastqso = $this->security->xss_clean($this->uri->segment(4)); + + if ($lastqso === "lastqso") { + $this->load->model('visitor_model'); + $result = $this->visitor_model->getlastqsodate($slug)->row(); + header('Content-Type: application/json'); + echo json_encode($result); + return; + } + $data['slug'] = $slug; $data['page_title'] = "Export Map"; @@ -430,7 +428,7 @@ class Visitor extends CI_Controller { } public function mapqsos() { - $this->load->model('logbook_model'); + $this->load->model('visitor_model'); $this->load->library('qra'); @@ -453,7 +451,7 @@ class Visitor extends CI_Controller { show_404('Unknown Public Page.'); } - $qsos = $this->logbook_model->get_qsos($qsocount, null, $logbooks_locations_array, $band); + $qsos = $this->visitor_model->get_qsos($qsocount, $logbooks_locations_array, $band); $userid = $this->stationsetup_model->public_slug_exists_userid($slug); $user_default_confirmation = $this->get_user_default_confirmation($userid); @@ -519,12 +517,28 @@ class Visitor extends CI_Controller { $this->load->model('user_options_model'); - $result=$this->user_options_model->get_options('map_custom', null, $userid); - $jsonout=[]; + $result = $this->user_options_model->get_options('map_custom', null, $userid); + $jsonout = []; foreach($result->result() as $options) { if ($options->option_name=='icon') $jsonout[$options->option_key]=json_decode($options->option_value,true); else $jsonout[$options->option_name.'_'.$options->option_key]=$options->option_value; } + + if (count($jsonout) == 0) { + $jsonout['qso'] = array( + "icon" => "fas fa-dot-circle", + "color" => "#ff0000" + ); + $jsonout['qsoconfirm'] = array( + "icon" => "fas fa-dot-circle", + "color" => "#00aa00" + ); + $jsonout['station'] = array( + "icon" => "fas fa-broadcast-tower", + "color" => "#0000ff" + ); + } + $jsonout['gridsquare_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'gridsquare_layer','option_key'=>$slug), $userid)->row()->option_value ?? true; $jsonout['path_lines'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'path_lines','option_key'=>$slug), $userid)->row()->option_value ?? true; $jsonout['cqzone_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'cqzone_layer','option_key'=>$slug), $userid)->row()->option_value ?? true; diff --git a/application/models/Visitor_model.php b/application/models/Visitor_model.php new file mode 100644 index 000000000..6a833a327 --- /dev/null +++ b/application/models/Visitor_model.php @@ -0,0 +1,48 @@ +db->select($this->config->item('table_name').'.*, station_profile.*'); + $this->db->from($this->config->item('table_name')); + + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + + if ($band != '') { + if ($band == 'SAT') { + $this->db->where($this->config->item('table_name').'.col_prop_mode', 'SAT'); + } else { + $this->db->where($this->config->item('table_name').'.col_prop_mode !="SAT"'); + $this->db->where($this->config->item('table_name').'.col_band', $band); + } + } + + $this->db->where_in($this->config->item('table_name').'.station_id', $StationLocationsArray); + $this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc"); + + $this->db->limit($num); + + return $this->db->get(); + } + + function getlastqsodate ($slug) { + $this->load->model('stationsetup_model'); + $logbook_id = $this->stationsetup_model->public_slug_exists_logbook_id($slug); + $userid = $this->stationsetup_model->public_slug_exists_userid($slug); + $band = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'band','option_key'=>$slug), $userid)->row()->option_value ?? ''; + + $sql = "select max(col_time_on) lastqso from " . $this->config->item('table_name') . + " join station_profile on station_profile.station_id = " . $this->config->item('table_name') . ".station_id where 1 = 1"; + + if ($band != '') { + if ($band == 'SAT') { + $sql .= " and " . $this->config->item('table_name') . ".col_prop_mode = 'SAT'"; + } else { + $sql .= " and " . $this->config->item('table_name') . ".col_prop_mode != 'SAT'"; + $sql .= " and " . $this->config->item('table_name') . ".col_band = '". $band . "'"; + } + } + + return $this->db->query($sql); + } +} diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index b77c53d8f..6d5f501bf 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -191,7 +191,7 @@ function echo_table_col($row, $name) {
-
+
diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index d1679e93c..379d5e938 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -115,8 +115,6 @@ function echo_table_col($row, $name) {
-
-
diff --git a/application/views/visitor/layout/footer.php b/application/views/visitor/layout/footer.php index ced853ac0..3b37372db 100644 --- a/application/views/visitor/layout/footer.php +++ b/application/views/visitor/layout/footer.php @@ -8,7 +8,6 @@ -