public function execute() { $page_id = $this->__get_item_page_id(); if (empty($page_id) or $this->router()->matched_route() === NULL) { return FALSE; } $this->_page = Model_Page_Front::findById($page_id); }
public function get_page() { $page = NULL; if ($this->page_id >= 1) { $page = Model_Page_Front::findById($this->page_id); } else { if (empty($this->page_id)) { $page = $this->_ctx->get_page(); } } return $page; }
public function execute() { $slug = $this->router()->param('item'); if (empty($slug)) { return; } $item_page_id = $this->settings()->item_page_id; // Если не найдена внутрення страница по SLUG if (($this->_page = Model_Page_Front::find($slug, FALSE, $this->page())) === FALSE) { // Производим поиск страницы которая укзана в настройках типа страницы if (!empty($item_page_id)) { $this->_page = Model_Page_Front::findById($item_page_id); return; } Model_Page_Front::not_found(); } }
/** * * @return array [$total_found, $results, $keyword] */ public function fetch_data() { $keyword = $this->keyword(); $return = array('total_found' => 0, 'results' => array(), 'keyword' => $keyword); if (empty($keyword)) { return $return; } $ids = Search::instance()->find_by_keyword($keyword, FALSE, 'pages', $this->list_size, $this->list_offset); if (empty($ids['pages'])) { return $return; } $pages = array(); foreach ($ids['pages'] as $item) { if (($page = Model_Page_Front::findById($item['id'])) === FALSE) { $this->_total--; continue; } $pages[$item['id']] = $page; } $return['total_found'] = $this->_total; $return['results'] = $pages; return $return; }
/** * * @return Model_Page_Front */ public function get_current_page() { if (!$this->current_page) { $this->current_page = Model_Page_Front::findById($this->get_page_id()); } return $this->current_page; }
public function get_parse_meta() { $page_id = $this->param('page_id', NULL, TRUE); $fields = (array) $this->param('fields', array(), TRUE); $response = array(); $page = Model_Page_Front::findById($page_id); if ($page instanceof Model_Page_Front) { foreach ($fields as $field => $value) { $response[$field] = $page->parse_meta($field, $value); } } $this->response($response); }