| 
									
										
										
										
											2020-12-13 06:03:42 +08:00
										 |  |  | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | 	Handles Displaying of information for station tools. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Options extends CI_Controller { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	function __construct() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		parent::__construct(); | 
					
						
							|  |  |  | 		$this->load->helper(array('form', 'url')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->model('user_model'); | 
					
						
							| 
									
										
										
										
											2020-12-22 20:33:28 +08:00
										 |  |  | 		if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	// Default /options view just gives some text to explain the options area
 | 
					
						
							| 
									
										
										
										
											2020-12-13 06:03:42 +08:00
										 |  |  |     function index() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //echo $this->config->item('option_theme');
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 		//echo $this->optionslib->get_option('theme');
 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		$data['page_title'] = "Cloudlog Options"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							|  |  |  | 		$this->load->view('options/index'); | 
					
						
							|  |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 	// function used to display the /appearance url
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 	function appearance() { | 
					
						
							| 
									
										
										
										
											2021-01-31 21:41:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Get Language Options
 | 
					
						
							|  |  |  | 		$directory = 'application/language'; | 
					
						
							|  |  |  | 		$data['language_options'] = array_diff(scandir($directory), array('..', '.')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 		$data['page_title'] = "Cloudlog Options"; | 
					
						
							|  |  |  | 		$data['sub_heading'] = "Appearance"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->view('interface_assets/header', $data); | 
					
						
							|  |  |  | 		$this->load->view('options/appearance'); | 
					
						
							|  |  |  | 		$this->load->view('interface_assets/footer'); | 
					
						
							| 
									
										
										
										
											2020-12-13 06:03:42 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 	// Handles saving the appreance options to the options system.
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 	function appearance_save() { | 
					
						
							| 
									
										
										
										
											2021-01-31 21:41:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Get Language Options
 | 
					
						
							|  |  |  | 		$directory = 'application/language'; | 
					
						
							|  |  |  | 		$data['language_options'] = array_diff(scandir($directory), array('..', '.')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 		$data['page_title'] = "Cloudlog Options"; | 
					
						
							|  |  |  | 		$data['sub_heading'] = "Appearance"; | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 		$this->load->helper(array('form', 'url')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->load->library('form_validation'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$this->form_validation->set_rules('theme', 'theme', 'required'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ($this->form_validation->run() == FALSE) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			$this->load->view('interface_assets/header', $data); | 
					
						
							|  |  |  | 			$this->load->view('options/appearance'); | 
					
						
							|  |  |  | 			$this->load->view('interface_assets/footer'); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 			// Update theme choice within the options system
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 			$theme_update_status = $this->optionslib->update('theme', $this->input->post('theme')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 			// If theme update is complete set a flashsession with a success note
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 			if($theme_update_status == TRUE) { | 
					
						
							|  |  |  | 				$this->session->set_flashdata('success', 'Theme changed to '.$this->input->post('theme')); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-10 01:46:47 +08:00
										 |  |  | 			// Update theme choice within the options system
 | 
					
						
							|  |  |  | 			$search_update_status = $this->optionslib->update('global_search', $this->input->post('globalSearch')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// If theme update is complete set a flashsession with a success note
 | 
					
						
							|  |  |  | 			if($search_update_status == TRUE) { | 
					
						
							|  |  |  | 				$this->session->set_flashdata('success', 'Global Search changed to '.$this->input->post('globalSearch')); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-31 21:41:46 +08:00
										 |  |  | 			// Update Lang choice within the options system
 | 
					
						
							| 
									
										
										
										
											2021-02-10 18:56:04 +08:00
										 |  |  | 			// $lang_update_status = $this->optionslib->update('language', $this->input->post('language'));
 | 
					
						
							| 
									
										
										
										
											2021-01-31 21:41:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// If Lang update is complete set a flashsession with a success note
 | 
					
						
							| 
									
										
										
										
											2021-02-10 18:56:04 +08:00
										 |  |  | 			// if($lang_update_status == TRUE) {
 | 
					
						
							|  |  |  | 			// 	$this->session->set_flashdata('success', 'Language changed to '.ucfirst($this->input->post('language')));
 | 
					
						
							|  |  |  | 			// }
 | 
					
						
							| 
									
										
										
										
											2021-01-31 21:41:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:59:08 +08:00
										 |  |  | 			// Redirect back to /appearance
 | 
					
						
							| 
									
										
										
										
											2020-12-14 00:55:10 +08:00
										 |  |  | 			redirect('/options/appearance'); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-12-13 06:03:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-10 18:56:04 +08:00
										 |  |  | } |