mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Adjusted cache-times and added SatTimers to cache (10minutes)
This commit is contained in:
@@ -9,41 +9,50 @@ class Sattimers extends CI_Controller {
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->load->model('stations');
|
||||
$footerData = [];
|
||||
$footerData['scripts'] = [
|
||||
'assets/js/sections/sattimers.js?'
|
||||
];
|
||||
$url = 'https://www.df2et.de/tevel/api2.php?grid='.strtoupper($this->stations->find_gridsquare());
|
||||
$json = file_get_contents($url);
|
||||
$data['activations'] = json_decode($json, true)['data'];
|
||||
$data['gridsquare'] = strtoupper($this->stations->find_gridsquare());
|
||||
public function index() {
|
||||
$this->load->model('stations');
|
||||
$footerData = [];
|
||||
$footerData['scripts'] = [
|
||||
'assets/js/sections/sattimers.js?'
|
||||
];
|
||||
|
||||
$data['page_title'] = "Satellite Timers";
|
||||
$url = 'https://www.df2et.de/tevel/api2.php?grid='.strtoupper($this->stations->find_gridsquare());
|
||||
|
||||
$CI =& get_instance();
|
||||
if($CI->session->userdata('user_date_format')) {
|
||||
$data['custom_date_format'] = $CI->session->userdata('user_date_format');
|
||||
} else {
|
||||
$data['custom_date_format'] = $CI->config->item('qso_date_format');
|
||||
}
|
||||
$this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file'));
|
||||
if (!$RawData = $this->cache->get('SatTimers'.strtoupper($this->stations->find_gridsquare()))) {
|
||||
$RawData = file_get_contents($url, true);
|
||||
$this->cache->save('SatTimers'.strtoupper($this->stations->find_gridsquare()), $RawData, (60*10));
|
||||
}
|
||||
|
||||
switch ($data['custom_date_format']) {
|
||||
case "d/m/y": $data['custom_date_format'] = 'DD/MM/YY'; break;
|
||||
case "d/m/Y": $data['custom_date_format'] = 'DD/MM/YYYY'; break;
|
||||
case "m/d/y": $data['custom_date_format'] = 'MM/DD/YY'; break;
|
||||
case "m/d/Y": $data['custom_date_format'] = 'MM/DD/YYYY'; break;
|
||||
case "d.m.Y": $data['custom_date_format'] = 'DD.MM.YYYY'; break;
|
||||
case "y/m/d": $data['custom_date_format'] = 'YY/MM/DD'; break;
|
||||
case "Y-m-d": $data['custom_date_format'] = 'YYYY-MM-DD'; break;
|
||||
case "M d, Y": $data['custom_date_format'] = 'MMM DD, YYYY'; break;
|
||||
case "M d, y": $data['custom_date_format'] = 'MMM DD, YY'; break;
|
||||
default: $data['custom_date_format'] = 'DD/MM/YYYY';
|
||||
}
|
||||
$json = $RawData;
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('/sattimers/index', $data);
|
||||
$this->load->view('interface_assets/footer', $footerData);
|
||||
}
|
||||
$data['activations'] = json_decode($json, true)['data'];
|
||||
$data['gridsquare'] = strtoupper($this->stations->find_gridsquare());
|
||||
|
||||
$data['page_title'] = "Satellite Timers";
|
||||
|
||||
$CI =& get_instance();
|
||||
if($CI->session->userdata('user_date_format')) {
|
||||
$data['custom_date_format'] = $CI->session->userdata('user_date_format');
|
||||
} else {
|
||||
$data['custom_date_format'] = $CI->config->item('qso_date_format');
|
||||
}
|
||||
|
||||
switch ($data['custom_date_format']) {
|
||||
case "d/m/y": $data['custom_date_format'] = 'DD/MM/YY'; break;
|
||||
case "d/m/Y": $data['custom_date_format'] = 'DD/MM/YYYY'; break;
|
||||
case "m/d/y": $data['custom_date_format'] = 'MM/DD/YY'; break;
|
||||
case "m/d/Y": $data['custom_date_format'] = 'MM/DD/YYYY'; break;
|
||||
case "d.m.Y": $data['custom_date_format'] = 'DD.MM.YYYY'; break;
|
||||
case "y/m/d": $data['custom_date_format'] = 'YY/MM/DD'; break;
|
||||
case "Y-m-d": $data['custom_date_format'] = 'YYYY-MM-DD'; break;
|
||||
case "M d, Y": $data['custom_date_format'] = 'MMM DD, YYYY'; break;
|
||||
case "M d, y": $data['custom_date_format'] = 'MMM DD, YY'; break;
|
||||
default: $data['custom_date_format'] = 'DD/MM/YYYY';
|
||||
}
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('/sattimers/index', $data);
|
||||
$this->load->view('interface_assets/footer', $footerData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user