kopia lustrzana https://github.com/magicbug/Cloudlog
				
				
				
			
		
			
				
	
	
		
			59 wiersze
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			59 wiersze
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
| <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 | |
| 
 | |
| /*
 | |
| 	Handles Displaying of information for Station Logbooks
 | |
| */
 | |
| 
 | |
| class Logbooks extends CI_Controller {
 | |
| 
 | |
| 	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'); }
 | |
| 	}
 | |
| 
 | |
|     function index() {
 | |
| 		$this->load->model('logbooks_model');
 | |
| 
 | |
| 		$data['my_logbooks'] = $this->logbooks_model->show_all();
 | |
| 
 | |
| 		// Render Page
 | |
| 		$data['page_title'] = "Station Logbooks";
 | |
| 		$this->load->view('interface_assets/header', $data);
 | |
| 		$this->load->view('logbooks/index');
 | |
| 		$this->load->view('interface_assets/footer');
 | |
|     }
 | |
| 
 | |
|     public function create() 
 | |
| 	{
 | |
| 		$this->load->library('form_validation');
 | |
| 
 | |
| 		$this->form_validation->set_rules('stationLogbook_Name', 'Station Logbook Name', 'required');
 | |
| 
 | |
| 		if ($this->form_validation->run() == FALSE)
 | |
| 		{
 | |
| 			$data['page_title'] = "Create Station Logbook";
 | |
| 			$this->load->view('interface_assets/header', $data);
 | |
| 			$this->load->view('logbooks/create');
 | |
| 			$this->load->view('interface_assets/footer');
 | |
| 		}
 | |
| 		else
 | |
| 		{	
 | |
|             $this->load->model('logbooks_model');
 | |
| 			$this->logbooks_model->add();
 | |
| 			
 | |
| 			redirect('logbooks');
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
|     public function delete($id) {
 | |
| 		$this->load->model('logbooks_model');
 | |
| 		$this->logbooks_model->delete($id);
 | |
| 		
 | |
| 		redirect('logbooks');
 | |
| 	}
 | |
| 
 | |
| } |