| 
									
										
										
										
											2023-09-12 21:30:28 +08:00
										 |  |  | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | 	Controller to interact with the Clublog API | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Components extends CI_Controller { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	function __construct() { | 
					
						
							|  |  |  | 		parent::__construct(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->model('user_model'); | 
					
						
							|  |  |  | 		if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function index() { | 
					
						
							| 
									
										
										
										
											2023-11-17 20:21:31 +08:00
										 |  |  |         $this->load->model('stations'); | 
					
						
							| 
									
										
										
										
											2024-02-14 20:19:37 +08:00
										 |  |  |         $url = 'https://hams.at/api/alerts/upcoming'; | 
					
						
							| 
									
										
										
										
											2023-09-12 21:30:28 +08:00
										 |  |  |         $json = file_get_contents($url); | 
					
						
							|  |  |  |         $data['rovedata'] = json_decode($json, true); | 
					
						
							| 
									
										
										
										
											2023-11-17 20:21:31 +08:00
										 |  |  |         $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); | 
					
						
							| 
									
										
										
										
											2023-09-12 21:30:28 +08:00
										 |  |  |          | 
					
						
							|  |  |  |         // load view
 | 
					
						
							|  |  |  |         $this->load->view('components/hamsat/table', $data); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-17 20:21:31 +08:00
										 |  |  | } |