<?php
class Secure_area extends CI_Controller 
{
    function __construct($module_id=null)
    {
        parent::__construct();
        
        if(!$this->Employee->is_logged_in())
        {
            redirect('login');
        }
        
        $logged_in_employee_info = $this->Employee->get_logged_in_employee_info();
        
        if($logged_in_employee_info && !$this->Employee->has_permission($module_id, $logged_in_employee_info->person_id))
        {
            redirect('no_access/'.$module_id);
        }
        
        $data['allowed_modules'] = $this->Module->get_allowed_modules($logged_in_employee_info->person_id);
        $data['user_info'] = $logged_in_employee_info;
        $this->load->vars($data);
    }
}
?>