| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | 	Handles Displaying of information for awards. | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	These are taken from comments fields or ADIF fields  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Station extends CI_Controller { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 06:54:29 +08:00
										 |  |  | 	function __construct() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		parent::__construct(); | 
					
						
							|  |  |  | 		$this->load->helper(array('form', 'url')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$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'); } | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | 	public function index() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		$this->load->model('stations'); | 
					
						
							|  |  |  | 		$data['stations'] = $this->stations->all(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Render Page
 | 
					
						
							|  |  |  | 		$data['page_title'] = "Station Profiles"; | 
					
						
							| 
									
										
										
										
											2019-01-09 23:18:46 +08:00
										 |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | 		$this->load->view('station_profile/index'); | 
					
						
							| 
									
										
										
										
											2019-01-09 23:18:46 +08:00
										 |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	public function create()  | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		$this->load->model('stations'); | 
					
						
							|  |  |  | 		$this->load->model('dxcc'); | 
					
						
							|  |  |  | 		$data['dxcc_list'] = $this->dxcc->list(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->library('form_validation'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ($this->form_validation->run() == FALSE) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			$data['page_title'] = "Create Station Profile"; | 
					
						
							| 
									
										
										
										
											2019-01-09 23:18:46 +08:00
										 |  |  | 			$this->load->view('interface_assets/header', $data); | 
					
						
							| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | 			$this->load->view('station_profile/create'); | 
					
						
							| 
									
										
										
										
											2019-01-09 23:18:46 +08:00
										 |  |  | 			$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2019-01-02 03:14:25 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 		{	 | 
					
						
							|  |  |  | 			$this->stations->add(); | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			redirect('station'); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	public function edit() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	public function delete($id) { | 
					
						
							|  |  |  | 		$this->load->model('stations'); | 
					
						
							|  |  |  | 		$this->stations->delete($id); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		redirect('station'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |