| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Backup extends CI_Controller { | 
					
						
							| 
									
										
										
										
											2019-10-06 02:35:55 +08:00
										 |  |  | 	function __construct() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		parent::__construct(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 	/* User Facing Links to Backup URLs */ | 
					
						
							|  |  |  | 	public function index() | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2020-08-11 06:26:02 +08:00
										 |  |  | 		$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'); } | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-05 01:32:03 +08:00
										 |  |  | 		$data['page_title'] = "Backup"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 		$this->load->view('backup/main'); | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-02 02:35:23 +08:00
										 |  |  | 	/* Gets all QSOs and Dumps them to logbook.adi */ | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 	public function adif(){  | 
					
						
							|  |  |  | 		$this->load->helper('file'); | 
					
						
							|  |  |  | 		// Set memory limit to unlimited to allow heavy usage
 | 
					
						
							|  |  |  | 		ini_set('memory_limit', '-1'); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		$this->load->model('adif_data'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$data['qsos'] = $this->adif_data->export_all(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ( ! write_file('backup/logbook.adi', $this->load->view('backup/exportall', $data, true))) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 		     $data['status'] = false; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 		      $data['status'] = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-05 01:32:03 +08:00
										 |  |  | 		$data['page_title'] = "ADIF - Backup"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							| 
									
										
										
										
											2011-11-05 01:32:03 +08:00
										 |  |  | 		$this->load->view('backup/adif_view'); | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-10-02 02:35:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Export the notes to XML */ | 
					
						
							|  |  |  | 	public function notes() { | 
					
						
							|  |  |  | 		$this->load->helper('file'); | 
					
						
							|  |  |  | 		$this->load->model('note'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$data['list_note'] = $this->note->list_all(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ( ! write_file('backup/notes.xml', $this->load->view('backup/notes', $data, true))) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 		     $data['status'] = false; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 		      $data['status'] = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-05 01:32:03 +08:00
										 |  |  | 		$data['page_title'] = "Notes - Backup"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							| 
									
										
										
										
											2011-11-05 01:32:03 +08:00
										 |  |  | 		$this->load->view('backup/notes_view'); | 
					
						
							| 
									
										
										
										
											2019-01-15 00:29:06 +08:00
										 |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2011-10-02 02:35:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-10-01 05:27:18 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* End of file Backup.php */ |