public function on_page_load() { parent::on_page_load(); if (Request::current()->method() == Request::POST) { return $this->_check_password(); } }
public function set_values(array $data) { if (empty($data['exclude'])) { $this->exclude = array(); } return parent::set_values($data); }
/** * Метод запускается после того, как страница была найдена, виджеты * проинициализированы, до вывода шаблона страницы. * * @see Context::init_widgets() */ public function on_page_load() { parent::on_page_load(); //.... // В этот момент можно например произвести изменения в странице, передать // // $page = $this->_ctx->get_page(); // $page->... }
public function set_values(array $data) { if (empty($data['exclude'])) { $this->exclude = array(); } parent::set_values($data); $this->match_all_paths = (bool) Arr::get($data, 'match_all_paths'); $this->include_hidden = (bool) Arr::get($data, 'include_hidden'); return $this; }
public function on_page_load() { parent::on_page_load(); $this->widget = $this->_ctx->get_widget($this->related_widget_id); $this->pagination = Pagination::factory(); if (!$this->widget instanceof Model_Widget_Decorator) { return FALSE; } $this->pagination->setup(array('items_per_page' => $this->widget->list_size, 'total_items' => $this->widget->count_total(), 'current_page' => array('source' => 'query_string', 'key' => $this->query_key))); $this->widget->list_offset = (int) $this->pagination->offset; }
public function on_page_load() { parent::on_page_load(); $user = $this->get_user(); if (!$user->loaded() and $this->throw_404 === TRUE) { $this->_ctx->throw_404('Profile not found'); } $page = $this->_ctx->get_page(); $page->meta_params(array('profile_username' => $user->username)); $this->_ctx->set('widget_profile_id', $user->id); $this->_ctx->set('widget_profile_username', $user->username); }
/** * Обновление виджета * При обновлении виджета происходит вызов метода clear_cache() * для очистки кеша у виджета * * @param Widget_Decorator $widget * @return integer * @throws HTTP_Exception_404 */ public static function update(Model_Widget_Decorator $widget) { $orm_widget = ORM::factory('widget', $widget->id)->values(array('type' => $widget->type(), 'name' => $widget->name, 'template' => $widget->template, 'description' => $widget->description, 'code' => Kohana::serialize($widget)))->update(); $widget->clear_cache(); return $orm_widget->id; }
protected function _serialize_vars() { $vars = parent::_serialize_vars(); unset($vars['_update_settings_page'], $vars['_multiple'], $vars['crumbs'], $vars['roles'], $vars['media'], $vars['throw_404'], $vars['caching'], $vars['cache_lifetime'], $vars['cache_tags']); return $vars; }
public function on_page_load() { parent::on_page_load(); $doc = $this->get_document(); if (empty($doc) and $this->throw_404) { $this->_ctx->throw_404(); } if ($this->seo_information === TRUE) { $page = $this->_ctx->get_page(); $page->meta_params('document_header', $doc['header'], 'title'); $page->meta_params('document_meta_title', $doc['meta_title'], 'meta_title'); $page->meta_params('document_meta_keywords', $doc['meta_keywords'], 'meta_keywords'); $page->meta_params('document_meta_description', $doc['meta_description'], 'meta_description'); } }
public function fetch_backend_content() { return View::factory('widgets/backend/pagination_decorator', array('content' => parent::fetch_backend_content(), 'widget' => $this)); }
protected function _edit(Model_Widget_Decorator $widget) { $data = $this->request->post(); try { if (!ACL::check('widget.roles') and !empty($data['roles'])) { $data['roles'] = array(); } if (ACL::check('widgets.cache')) { $widget->set_cache_settings($data); } $widget->set_values($data); Widget_Manager::update($widget); Observer::notify('widget_after_edit', $widget->id); } catch (Validation_Exception $e) { Flash::set('post_data', $data); Messages::errors($e->errors('validation')); $this->go_back(); } // save and quit or save and continue editing? if ($this->request->post('commit') !== NULL) { $this->go(); } else { $this->go(array('controller' => 'widgets', 'action' => 'edit', 'id' => $widget->id)); } }