Example #1
0
 public function before()
 {
     $session = Session::instance();
     $session->set('auth_redirect', $_SERVER['REQUEST_URI']);
     $auth = Auth::instance();
     if ($auth->logged_in('admin') == 0) {
         Controller::redirect('auth');
     }
     // Выполняем функцию родительского класса
     parent::before();
     $myuser = new Model_Myuser();
     $config = Kohana::$config->load('main')->admin;
     $base = new Model_Base();
     $options = $base->getOptions();
     $this->template->styles = $config['styles'];
     $this->template->scripts = $config['scripts'];
     $this->user = $auth->get_user()->as_array();
     $this->user['role'] = $myuser->get_role($this->user['id']);
     $this->template->sitename = $options['sitename'];
     $this->template->user = $this->user;
     $this->template->title = 'Панель управления';
 }