From 95e5007d8f61b753fc7a6e5a3e7c98c5f64e25e9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:19:37 +0100 Subject: [PATCH 1/3] Migrate to hams.at native API --- application/controllers/Components.php | 2 +- application/views/components/hamsat/table.php | 50 +++++++++---------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/application/controllers/Components.php b/application/controllers/Components.php index 7fc0e27a..94fdd0f9 100644 --- a/application/controllers/Components.php +++ b/application/controllers/Components.php @@ -15,7 +15,7 @@ class Components extends CI_Controller { public function index() { $this->load->model('stations'); - $url = 'https://oscarwatch.org/scripts/hamsat_json.php'; + $url = 'https://hams.at/api/alerts/upcoming'; $json = file_get_contents($url); $data['rovedata'] = json_decode($json, true); $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index 80dad90b..bc2b7714 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -21,7 +21,7 @@ - + - - + load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $CI->load->model('logbook_model'); $call_worked = $CI->logbook_model->check_if_callsign_worked_in_logbook($rove['callsign'], $logbooks_locations_array, "SAT"); if ($call_worked != 0) { @@ -60,48 +60,46 @@ - + + "> logbook_model->check_if_grid_worked_in_logbook($grid, null, "SAT"); - if ($worked != 0) { - echo " " . $grid . ""; - } else { - echo " " . $grid . ""; - } - } - } else { - $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($rove['gridsquare'], null, "SAT"); + foreach ($rove['grids'] as $grid) { + $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($grid, null, "SAT"); if ($worked != 0) { - echo " " . $rove['gridsquare'] . ""; + echo " " . $grid . ""; } else { - echo " " . $rove['gridsquare'] . ""; + echo " " . $grid . ""; } } ?> - Track + Track - Sked + Sked From ef361e8aa0c01b77cf717f1344c41d2c968fc488 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:44:11 +0100 Subject: [PATCH 2/3] Add mode badges --- application/views/components/hamsat/table.php | 10 +++++++++- assets/css/default/overrides.css | 2 +- assets/css/general.css | 17 ++++++++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index bc2b7714..0d4ec264 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -70,9 +70,17 @@ } else if ($row['mhz_direction'] == 'down') { $direction = '↓'; } + $modeclass = ''; + if ($rove['mode'] == 'SSB') { + $modeclass = 'hamsatBgLin'; + } else if ($rove['mode'] == 'Data') { + $modeclass = 'hamsatBgData'; + } else if ($rove['mode'] == 'FM') { + $modeclass = 'hamsatBgFm'; + } ?> - "> + "> diff --git a/assets/css/default/overrides.css b/assets/css/default/overrides.css index 943d0165..ae07e3e7 100644 --- a/assets/css/default/overrides.css +++ b/assets/css/default/overrides.css @@ -60,4 +60,4 @@ thead > tr > td { .dxccsummaryheader:after { background-image: linear-gradient(to right, black 0, black 12ch, black 12ch, black 100%); -} \ No newline at end of file +} diff --git a/assets/css/general.css b/assets/css/general.css index 1443a1e8..4f17f87b 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -767,4 +767,19 @@ label { .dxccsummaryheaderopened:after { content: "\2796"; /* Unicode character for "minus" sign (-) */ -} \ No newline at end of file +} + +.hamsatBgLin { + background-color: rgb(224 242 254) !important; + --bs-badge-color: rgb(2 132 199) !important; +} + +.hamsatBgData { + background-color: rgb(250 232 255) !important; + --bs-badge-color: rgb(192 38 211) !important; +} + +.hamsatBgFm { + background-color: rgb(254 243 199) !important; + --bs-badge-color: rgb(217 119 6) !important; +} From dee4ce2835242b64ab9c36694bdf40357704a697 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:48:38 +0100 Subject: [PATCH 3/3] Fix typo and also categorize CW as linear mode --- application/views/components/hamsat/table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index 0d4ec264..0a76fade 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -67,11 +67,11 @@ $direction = ''; if ($rove['mhz_direction'] == 'up') { $direction = '↑'; - } else if ($row['mhz_direction'] == 'down') { + } else if ($rove['mhz_direction'] == 'down') { $direction = '↓'; } $modeclass = ''; - if ($rove['mode'] == 'SSB') { + if ($rove['mode'] == 'SSB' || $rove['mode'] == 'CW') { $modeclass = 'hamsatBgLin'; } else if ($rove['mode'] == 'Data') { $modeclass = 'hamsatBgData';