diff --git a/application/controllers/Sattimers.php b/application/controllers/Sattimers.php index 66332e392..7de010f91 100644 --- a/application/controllers/Sattimers.php +++ b/application/controllers/Sattimers.php @@ -24,10 +24,22 @@ class Sattimers extends CI_Controller { $this->cache->save('SatTimers'.strtoupper($this->stations->find_gridsquare()), $RawData, (60*1)); } - $json = $RawData; - $data['activations'] = json_decode($json, true)['data']; + $json = $RawData; + $response = json_decode($json, true); + if (array_key_exists('data', $response)) { + $data['activations'] = json_decode($json, true)['data'] ?? []; + } else if (array_key_exists('error', $response)) { + $this->session->set_flashdata('message', 'Error: '.$response['error']); + $data['activations'] = []; + } else { + $data['activations'] = []; + } + $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); + if ($data['gridsquare'] == "0") { + $this->session->set_flashdata('message', lang('dashboard_locations_warning')); + } $data['page_title'] = "Satellite Timers"; diff --git a/application/views/sattimers/index.php b/application/views/sattimers/index.php index 3a05c895d..344b5db89 100644 --- a/application/views/sattimers/index.php +++ b/application/views/sattimers/index.php @@ -2,10 +2,18 @@ var custom_date_format = "";
+ session->flashdata('message')) { ?> + + +

Satellite Timers

-

This data is from https://www.df2et.de/tevel/ calculated for current station location grid .

+ +

This data is from https://www.df2et.de/tevel/ calculated for current station location grid .

+