From ce73f6c6001614df1c9528bab1e9ac287344c58d Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 3 Nov 2024 15:09:33 +0100 Subject: [PATCH] Add orbit type to static maps for SAT QSOs --- application/controllers/Staticmap.php | 3 ++- application/models/Visitor_model.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/application/controllers/Staticmap.php b/application/controllers/Staticmap.php index ecdf44b8e..c3f32a9da 100644 --- a/application/controllers/Staticmap.php +++ b/application/controllers/Staticmap.php @@ -27,6 +27,7 @@ class Staticmap extends CI_Controller { // Optional override-parameters $band = $this->input->get('band', TRUE) ?? 'nbf'; + $orbit = $this->input->get('orbit', TRUE) ?? ''; $continent = $this->input->get('continent', TRUE) ?? 'nC'; $thememode = $this->input->get('theme', TRUE) ?? null; $hide_home = $this->input->get('hide_home', TRUE) == 1 ? true : false; @@ -142,7 +143,7 @@ class Staticmap extends CI_Controller { } $centerMap = $this->qra->getCenterLatLng($coordinates); - $qsos = $this->visitor_model->get_qsos($qsocount, $logbooks_locations_array, $band == 'nbf' ? '' : $band, $continent == 'nC' ? '' : $continent); // TODO: Allow 'all' option + $qsos = $this->visitor_model->get_qsos($qsocount, $logbooks_locations_array, $band == 'nbf' ? '' : $band, $continent == 'nC' ? '' : $continent, $orbit); // TODO: Allow 'all' option $image = $this->staticmap_model->render_static_map($qsos, $uid, $centerMap, $coordinates, $filepath, $continent, $thememode, $hide_home, $night_shadow, $pathlines, $cqzones, $ituzones); diff --git a/application/models/Visitor_model.php b/application/models/Visitor_model.php index 50fdaa5db..dd8500018 100644 --- a/application/models/Visitor_model.php +++ b/application/models/Visitor_model.php @@ -2,15 +2,25 @@ class Visitor_model extends CI_Model { - function get_qsos($num, $StationLocationsArray, $band = '', $continent = '') { + function get_qsos($num, $StationLocationsArray, $band = '', $continent = '', $orbit = '') { $this->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 == 'SAT') { + $this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.COL_SAT_NAME', 'left'); + } if ($band != '') { if ($band == 'SAT') { $this->db->where($this->config->item('table_name').'.col_prop_mode', 'SAT'); + if ($orbit == 'LEO') { + $this->db->where('satellite.orbit', 'LEO'); + } else if ($orbit == 'MEO') { + $this->db->where('satellite.orbit', 'MEO'); + } else if ($orbit == 'GEO') { + $this->db->where('satellite.orbit', 'GEO'); + } } else { $this->db->where($this->config->item('table_name').'.col_prop_mode !="SAT"'); $this->db->where($this->config->item('table_name').'.col_band', $band);