_select) { $this->addFilter(array( 'system' => 'n', 'redirect' => 'n', 'enabled' => 'y', 'isIndexing' => 'y', 'handler' => 'site' )); $language = $this->getLanguage(); $defaultLanguage = Qs_Db_Language::getDefault(); $this->_select = $this->_db->select(); $this->_select->from($this->_getPair($this->_tableAlias), '*'); $this->_select->where("`{$this->_tableAlias}`.`alias` IS NOT NULL"); $where = '`PageContentDefault`.`idPage` = `' . $this->_tableAlias . '`.`id` ' . 'AND `PageContentDefault`.`language` = ' . $this->_db->quote($defaultLanguage); $this->_select->join( $this->_getPair('PageContent', 'PageContentDefault'), $where, array( 'menuTitle' => 'IFNULL(`PageContent`.`menuTitle`, `PageContentDefault`.`menuTitle`)', 'header' => 'IFNULL(`PageContent`.`header`, `PageContentDefault`.`header`)', 'title' => 'IFNULL(`PageContent`.`title`, `PageContentDefault`.`title`)' ) ); $where = '`PageContent`.`idPage` = `' . $this->_tableAlias . '`.`id` ' . 'AND `PageContent`.`language` = ' . $this->_db->quote($language); $this->_select->joinLeft($this->_getPair('PageContent'), $where, array()); $this->_select->joinLeft( $this->_getPair('PageItem'), '`PageItem`.`idPage` = `' . $this->_tableAlias . '`.`id`', array() ); $where = '`HtmlBlockContentDefault`.`idBlock` = `PageItem`.`number` ' . 'AND `HtmlBlockContentDefault`.`language` = ' . $this->_db->quote($defaultLanguage); $this->_select->joinLeft( $this->_getPair('HtmlBlockContent', 'HtmlBlockContentDefault'), $where, array('rawContent' => 'IFNULL(`HtmlBlockContent`.`rawContent`, `HtmlBlockContentDefault`.`rawContent`)') ); $where = '`HtmlBlockContent`.`idBlock` = `PageItem`.`number` ' . 'AND `HtmlBlockContent`.`language` = ' . $this->_db->quote($language); $this->_select->joinLeft($this->_getPair('HtmlBlockContent'), $where, array()); $this->_select->group($this->_tableAlias . '.id'); $this->_filter($this->_select); $this->_applySelectOptions($this->_select, $this->_selectOptions); $this->_select->reset(Zend_Db_Select::ORDER); $this->_select->order('PageContent.menuTitle ASC'); } return $this->_select; } protected function _buildSearchUrl($pattern, array $data) { $dataObj = App_Cms_Obj::getInstance(); $page = $dataObj->getPageById($data['id']); return $page['url']; } protected function _prepareSearchList(array &$list, array $providerOptions) { $filterFields = $this->getFilterFields(); $flatFilterFields = Qs_Array::flatten($filterFields); $titleField = Qs_Array::get($providerOptions, 'titleField', App\Search\View::DEFAULT_TITLE_FIELD); $flatFilterFields = Qs_Array::excludeValue($flatFilterFields, $titleField); $flatFilterFields = Qs_Array::excludeValue($flatFilterFields, 'header'); $this->setFilterFields($flatFilterFields); parent::_prepareSearchList($list, $providerOptions); $query = $this->_filter['query']; foreach ($list as &$item) { if ($item['header']) { $header = Qs_Text_Mark::markSearchWords($item['header'], $query); $header = trim($header, '.'); $item['content'] = '' . $header . '
' . $item['content']; } } $this->setFilterFields($filterFields); return $this; } }