_joinCategory($select); return $select; } protected function _joinCategory(Zend_Db_Select $select) { $select->joinLeft( $this->pairFaqCategory, "`FaqCategory`.`id` = `{$this->_tableAlias}`.`idCategory`", array( 'category' => new Zend_Db_Expr("IFNULL(`FaqCategory`.`title`, " . $this->_db->quote(App_Faq_AbstractView::$noCategoryTitle). ")"), 'categorySorter' => 'sorter' ) ); } public function hasCategories() { $this->getCategories4Select(); return empty($this->_categories); } public function getCategories4Select() { if (null === $this->_categories) { $this->_categories = $this->getFaqCategory4Select(); } return $this->_categories; } public function getListSelect($options = array()) { if (isset($options['order']) && is_string($options['order']) && false !== strpos($options['order'], 'sorter')) { $options['order'] = array('categorySorter' . ((false !== strpos($options['order'], 'DESC')) ? ' DESC' : ''), $options['order']); $options['order'] = array($options['order']); } return parent::getListSelect($options); } public function getCategoriesCount() { $select = $this->_db->select(); $select->from($this->pair, new Zend_Db_Expr('COUNT(DISTINCT `Faq`.`idCategory`)')); return (int) $this->_db->fetchOne($select); } protected function _arrayParseUrl2Tag(&$array) { parent::_arrayParseUrl2Tag($array); $array['searchContent'] = strip_tags($array['answer']); return true; } }