where('`' . $this->_getTableAlias() . '`.`enabled` = "y"'); return $this; } protected function _prepareSearchList(array &$list, array $providerOptions) { $this->_prepareList($list); if (!empty($list)) { $query = $this->_filter['query']; $sitemapUrl = ''; if (($selector = Qs_Array::get($providerOptions, 'sitemapSelector'))) { if (!is_array($selector)) { $selector = array($selector); } else { $paramsCount = count($selector); if ($paramsCount < 3) { $selector = array_merge($selector, array_fill(0, (3 - $paramsCount), null)); } } $selector[] = 'url'; $sitemapUrl = call_user_func_array('Qs_SiteMap::findFirst', $selector); } foreach ($list as &$row) { $row['sitemapUrl'] = $sitemapUrl; $row['searchUrl'] = $this->_buildSearchUrl(Qs_Array::get($providerOptions, 'urlPattern'), $row); $titleField = Qs_Array::get($providerOptions, 'titleField', App\Search\View::DEFAULT_TITLE_FIELD); $row['title'] = Qs_Text_Mark::markSearchWords($row[$titleField], $query); $row['jobTitle'] = Qs_Text_Mark::markSearchWords($row['jobTitle'], $query); $contentFields = $this->getFilterFields(); $contentFields = Qs_Array::excludeValue($contentFields, $titleField, 'jobTitle'); if (in_array('title', $contentFields)) { $contentFields = Qs_Array::excludeValue($contentFields, 'title'); } $content = Qs_Text_Mark::prepareSearchText($row, $contentFields, false); $row['content'] = Qs_Text_Mark::markSearchWords($content, $query); } } return $this; } protected function _prepareList(&$list) { $this->_addSocialLinksToList($list); return parent::_prepareList($list); } protected function _addSocialLinksToList(&$list) { $select = $this->_db->select(); $select->from($this->_getPair('PeopleSocialLink', 'psl'), array('peopleId', 'link')) ->join( $this->_getPair('SocialLinkDictionary', 'sld'), '`sld`.`id` = `psl`.`linkId`', array('iconName', 'serviceName') ) ->order('sld.sorter'); $links = $this->_db->fetchAll($select, array(), \Qs_Db::FETCH_GROUP); foreach ($list as &$user) { if (isset($links[$user['id']])) { $user['socialLinks'] = $links[$user['id']]; } } unset($user); return $this; } }