array('title')); protected $_needAccessTypes = array('resource'); public function getListSelect() { if (null == $this->_select) { $this->_select = parent::getListSelect(); $this->_select->join( $this->_getPair('Committee', 'c'), '`c`.`id` = `d`.`committeeId`', array('committeeTitle' => 'title') ); if (!\App_User_Auth::getInstance()->isLoggedIn()) { $this->_select->where('`d`.`typeId` NOT IN (?)', $this->_needAccessTypes); } else { $this->_select->joinLeft( $this->_getPair('UserCommittee', 'uc'), '`uc`.`committeeId` = `d`.`committeeId`', [] ); $whereUser = '`uc`.`userId` = ' . $this->_db->quote(\App_User_Auth::getInstance()->getData('id'), \Qs_Db::INT_TYPE); $whereDocumentType = '`d`.`typeId` NOT IN (' . $this->_db->quote($this->_needAccessTypes) . ')'; $this->_select->where($whereUser . ' OR ' . $whereDocumentType); } $this->_select->group('d.id'); } return $this->_select; } protected function _prepareSearchList(array &$list, array $providerOptions) { $this->_prepareList($list); if ($list) { $committeeUrl = \App\Committee\View::getPage('url'); $result = array(); $query = $this->_filter['query']; foreach ($list as &$row) { $row['searchUrl'] = \Qs_ImageFs::get($row['fileName']); $row['searchTitle'] = \Qs_Text_Mark::markSearchWords($row['title'], $query); if (!array_key_exists($row['committeeId'], $result)) { $result[$row['committeeId']] = array( 'committeeTitle' => $row['committeeTitle'], 'committeeUrl' => ($committeeUrl) ? $committeeUrl . '/' . $row['committeeId'] : null, 'list' => array() ); } $result[$row['committeeId']]['list'][] = $row; } $list = $result; } return $this; } }