Пример #1
0
 public function before()
 {
     $page = strtolower(substr(get_class($this), 11));
     Model_Navigation::init(Kohana::$config->load('sitemap')->as_array());
     parent::before();
     $navigation = Model_Navigation::get();
     $this->page = Model_Navigation::$current;
     if ($this->auto_render !== TRUE) {
         return;
     }
     $this->template->set_global(array('page_body_id' => $this->get_path(), 'page_name' => $page, 'page' => $this->page));
     if ($this->request->is_iframe()) {
         $navigation = NULL;
         $this->template->footer = NULL;
         $this->template->breadcrumbs = NULL;
         Config::set('site', 'profiling', 'no');
         $this->query_params = array('type' => 'iframe');
     } else {
         $this->template->breadcrumbs = Config::get('site', 'breadcrumbs') == Config::YES ? $this->breadcrumbs : NULL;
         $this->template->footer = View::factory('system/blocks/footer');
     }
     $this->template->theme = 'theme-' . Model_User_Meta::get('admin_theme', Config::get('global', 'default_theme'));
     $this->template->bind_global('navigation', $navigation);
     Observer::notify('controller_before_' . $this->get_path());
 }
Пример #2
0
 public function before()
 {
     $this->navigation = Navigation::instance('sitemap');
     // Ищем текущую страницу в карте сайта по текущему URL
     $this->page = $this->navigation->pages()->findOneByUri(Request::current()->uri());
     // Если найдена, то рендерим шаблон для нее
     if ($this->page) {
         $this->auto_render = TRUE;
         // Указываем, нужна ли авторизация и для каких ролей доступен
         // контроллер
         $this->auth_required = $this->page->getRoles();
     }
     parent::before();
     if (!$this->page and $this->request->is_ajax() === TRUE) {
         return;
     }
     if ($this->page) {
         if (!isset($this->page->title)) {
             $this->page->title = $this->page->label;
         }
         if (!isset($this->page->meta_keywords)) {
             $this->page->meta_keywords = $this->config['view']['keywords'];
         }
         if (!isset($this->page->meta_description)) {
             $this->page->meta_description = $this->config['view']['description'];
         }
     }
     if ($this->auto_render === TRUE) {
         $this->template->content = View::factory($this->_get_uri());
     }
 }
Пример #3
0
 public function before()
 {
     parent::before();
     if ($this->auto_render === TRUE) {
         Assets::js('jquery', ADMIN_RESOURCES . 'libs/jquery.min.js');
         Assets::package(array('jquery-ui', 'backbone', 'notify', 'underscore', 'select2', 'core', 'bootstrap'));
     }
 }
Пример #4
0
 public function before()
 {
     parent::before();
     $uri = URL::site(rawurldecode(Request::$initial->uri()));
     $message = 'Критическая ошибка';
     //$this->template->content->page = $uri;
     if (Request::$initial !== Request::$current) {
         if ($message = rawurldecode($this->request->param('message'))) {
             //$this->template->content->message = $message;
             $this->template->content = $message;
         }
     }
     //$this->template->content->action = $this->request->action();
 }
Пример #5
0
 public function before()
 {
     parent::before();
     Assets::package(array('jquery', 'elfinder', 'jquery-ui', 'backbone', 'core', 'underscore'));
 }
Пример #6
0
 public function before()
 {
     parent::before();
     $this->template->scripts[] = 'public/js/install.js';
 }