本文整理汇总了PHP中Bitrix\Main\Entity\Query::setFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::setFilter方法的具体用法?PHP Query::setFilter怎么用?PHP Query::setFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Entity\Query
的用法示例。
在下文中一共展示了Query::setFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
function getList($blockId, $fields, $order, $filers)
{
$entity_requests_data_class = connectToBlock($blockId);
$main_query_requests = new Entity\Query($entity_requests_data_class);
$main_query_requests->setSelect($fields);
//$main_query_requests->setSelect(array('ID','UF_TITLE'));
if (!empty($order)) {
$main_query_requests->setOrder($order);
}
if (!empty($filers)) {
$main_query_requests->setFilter($filers);
/*$main_query_requests->setFilter(
array(
'UF_NAME'=>'Александр',
)
);*/
}
$result_requests = $main_query_requests->exec();
$result_requests = new CDBResult($result_requests);
$requests = array();
while ($row_requests = $result_requests->Fetch()) {
$requests[] = $row_requests;
//массив выбранных элементов
}
return $requests;
}
示例2: validate
public function validate($value, $primary, array $row, Entity\Field $field)
{
$query = new Entity\Query($this->reference->getEntity());
$query->setFilter(array('=' . $this->reference->getName() => $value) + $this->filter);
$query->setLimit(1);
$result = $query->exec();
if ($result->fetch()) {
return true;
}
return new Entity\FieldError($field, $this->getErrorMessage($value, $field), self::NOT_EXISTS);
}
示例3: processActionShowObjectInGrid
protected function processActionShowObjectInGrid()
{
if (!$this->checkRequiredGetParams(array('objectId'))) {
$this->sendJsonErrorResponse();
}
/** @var Folder|File $object */
$object = BaseObject::loadById((int) $this->request->getQuery('objectId'), array('STORAGE'));
if (!$object) {
$this->errorCollection->addOne(new Error('Could not find file or folder', self::ERROR_COULD_NOT_FIND_FILE));
$this->sendJsonErrorResponse();
}
$storage = $object->getStorage();
$securityContext = $storage->getCurrentUserSecurityContext();
if (!$object->canRead($securityContext)) {
$this->errorCollection->addOne(new Error('Could not find file or folder', self::ERROR_COULD_NOT_READ_FILE));
$this->sendJsonErrorResponse();
}
$gridOptions = new Internals\Grid\FolderListOptions($storage);
$pageSize = $gridOptions->getPageSize();
$parameters = array('select' => array('ID'), 'filter' => array('PARENT_ID' => $object->getParentId(), 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE), 'order' => $gridOptions->getOrderForOrm(), 'limit' => $pageSize);
$countQuery = new Query(ObjectTable::getEntity());
$countQuery->addSelect(new ExpressionField('CNT', 'COUNT(1)'));
$countQuery->setFilter($parameters['filter']);
$totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch();
$totalCount = $totalCount['CNT'];
$pageCount = ceil($totalCount / $pageSize);
$driver = Driver::getInstance();
$finalPage = null;
for ($pageNumber = 1; $pageNumber <= $pageCount; $pageNumber++) {
$fullParameters = $driver->getRightsManager()->addRightsCheck($securityContext, $parameters, array('ID', 'CREATED_BY'));
$fullParameters['offset'] = $pageSize * ($pageNumber - 1);
$query = ObjectTable::getList($fullParameters);
while ($row = $query->fetch()) {
if ($row['ID'] == $object->getId()) {
$finalPage = $pageNumber;
break;
}
}
if ($finalPage !== null) {
break;
}
}
$finalPage = $finalPage ?: 1;
$command = $this->request->getQuery('cmd') ?: '';
if ($command) {
$command = '!' . $command;
}
LocalRedirect($driver->getUrlManager()->getPathInListing($object) . "?&pageNumber={$finalPage}#hl-" . $object->getId() . $command);
}
示例4: elemGetEx
function elemGetEx($elemId = false)
{
$hlHandler = $this->hlHandler;
$getList = new Entity\Query($hlHandler);
$getList->setSelect(array('*'));
$getList->setOrder(array("ID" => "ASC"));
if (!empty($elemId)) {
$getList->setFilter(array("ID" => $elemId));
}
$result = $getList->exec();
$result = new CDBResult($result);
$arRes = array();
while ($row = $result->Fetch()) {
$arRes[] = $row;
}
return $arRes;
}
示例5: validate
public function validate($value, $primary, array $row, Entity\Field $field)
{
$entity = $field->getEntity();
$primaryNames = $entity->getPrimaryArray();
$query = new Entity\Query($entity);
$query->setSelect($primaryNames);
$query->setFilter(array('=' . $field->getName() => $value));
$query->setLimit(2);
$result = $query->exec();
while ($existing = $result->fetch()) {
// check primary
foreach ($existing as $k => $v) {
if (!isset($primary[$k]) || $primary[$k] != $existing[$k]) {
return $this->getErrorMessage($value, $field);
}
}
}
return true;
}
示例6: getSubtreeRangeSqlForNode
/**
* This method is for internal use only. It may be changed without any notification further, or even mystically disappear.
*
* @access private
*/
public static function getSubtreeRangeSqlForNode($primary, $node = array())
{
$primary = Assert::expectIntegerPositive($primary, '$primary');
if (empty($node)) {
$node = self::getNodeInfo($primary);
if (!intval($node['ID'])) {
throw new Main\SystemException('Node being checked not found');
}
}
if (isset($node['LEFT_MARGIN']) && isset($node['RIGHT_MARGIN'])) {
$query = new Main\Entity\Query(static::getEntity());
$query->setSelect(array('ID'));
$query->setFilter(array('>LEFT_MARGIN' => $node['LEFT_MARGIN'], '<RIGHT_MARGIN' => $node['RIGHT_MARGIN']));
return $query->getQuery();
} else {
throw new Main\SystemException('Node not found or incorrect node info passed');
}
}
示例7: getHourlyCompanyActivitySince
protected static function getHourlyCompanyActivitySince(Type\DateTime $hour = null)
{
$query = new Entity\Query('Bitrix\\Intranet\\UStat\\UserHourTable');
// set all activity columns
$uStatFields = UserHourTable::getEntity()->getFields();
foreach ($uStatFields as $uStatField) {
if ($uStatField instanceof Entity\ScalarField && !$uStatField->isPrimary()) {
$query->addSelect(new Entity\ExpressionField($uStatField->getName() . '_SUM', 'SUM(%s)', $uStatField->getName()));
}
}
// add & automatically group by hour
$query->addSelect('HOUR');
// add filter by date
if ($hour !== null) {
$query->setFilter(array('>=HOUR' => \ConvertTimeStamp($hour->getTimestamp(), 'FULL')));
}
// collect activity
$activity = array();
$result = $query->exec();
while ($row = $result->fetch()) {
foreach ($row as $k => $v) {
if (substr($k, -4) === '_SUM') {
$row[substr($k, 0, -4)] = $v;
unset($row[$k]);
}
}
$activity[] = $row;
}
return $activity;
}
示例8: end
// add primary of grc entity field
$grcChain = Entity\QueryChain::getChainByDefinition($entity, $elem['name']);
$grc_field = $grcChain->getLastElement()->getValue();
if (is_array($grc_field)) {
$grc_field = end($grc_field);
}
$grc_primary = end($grc_field->getEntity()->getPrimaryArray());
$grc_marker = substr($elem['name'], 0, strrpos($elem['name'], '.')) . '.' . $grc_primary;
$grc_marker_alias = Entity\QueryChain::getAliasByDefinition($entity, $grc_marker);
$grcSelect[$grc_marker_alias] = $grc_marker;
// select
$resultName = $viewColumns[$num]['resultName'];
$grcData[$resultName] = array();
$grc_query = new Entity\Query($entity);
$grc_query->setSelect($grcSelect);
$grc_query->setFilter($grcFilter);
foreach ($runtime as $k => $v) {
$grc_query->registerRuntimeField($k, $v);
}
$result = $grc_query->exec();
while ($row = $result->fetch()) {
if (empty($row[$grc_marker_alias])) {
continue;
}
$grcData[$resultName][] = $row;
}
// add empty values to data
foreach ($data as $k => $v) {
$data[$k][$alias] = null;
}
// add values to data
示例9: getLikesList
function getLikesList($element, $user = false, $photos = false)
{
global $USER;
$cacheTime = 3600;
$cacheId = 'likes_' . $element;
$cachePath = '/likes';
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTime, $cacheId, $cachePath)) {
$vars = $obCache->GetVars();
return $vars['data'];
} else {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cachePath);
$CACHE_MANAGER->RegisterTag($cacheId);
$requiredModules = array('highloadblock');
foreach ($requiredModules as $requiredModule) {
if (!CModule::IncludeModule($requiredModule)) {
ShowError(GetMessage("F_NO_MODULE"));
return 0;
}
}
if ($photos) {
foreach ($photos as $key => &$value) {
$value = 'photo_' . $value;
}
}
// hlblock info
$hlblock_id = IB_LIKE;
if (empty($hlblock_id)) {
ShowError(GetMessage('HLBLOCK_LIST_NO_ID'));
return 0;
}
$hlblock = HL\HighloadBlockTable::getById($hlblock_id)->fetch();
if (empty($hlblock)) {
ShowError('404');
return 0;
}
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
// uf info
$fields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields('HLBLOCK_' . $hlblock['ID'], 0, LANGUAGE_ID);
// pagination
$limit = array('nPageSize' => $arParams['ROWS_PER_PAGE'], 'iNumPage' => is_set($_GET['PAGEN_1']) ? $_GET['PAGEN_1'] : 1, 'bShowAll' => true);
// sort
$sort_id = 'ID';
$sort_type = 'DESC';
// execute query
$main_query = new Entity\Query($entity);
$main_query->setSelect(array('*'));
if ($user) {
$main_query->setFilter(array('UF_ELEMENT_ID' => $element, 'UF_USER_ID' => $user));
} else {
if ($photos) {
$main_query->setFilter(array('UF_ELEMENT_ID' => $photos));
} else {
$main_query->setFilter(array('UF_ELEMENT_ID' => $element));
}
}
$main_query->setOrder(array($sort_id => $sort_type));
//$main_query->setSelect($select)
// ->setFilter($filter)
// ->setGroup($group)
// ->setOrder($order)
// ->setOptions($options);
//$main_query->setLimit($limit['nPageSize']);
//$main_query->setOffset(($limit['iNumPage']-1) * $limit['nPageSize']);
$result = $main_query->exec();
$result = new CDBResult($result);
// build results
$rows = array();
$tableColumns = array();
$liked = false;
$userLike = false;
while ($row = $result->Fetch()) {
foreach ($row as $k => $v) {
if ($k === 'UF_USER_ID' && $USER->IsAuthorized() && $v == $USER->GetID()) {
$liked = true;
$userLike = $row;
}
if ($k == 'ID') {
$tableColumns['ID'] = true;
continue;
}
$arUserField = $fields[$k];
if ($arUserField["SHOW_IN_LIST"] != "Y") {
continue;
}
$html = call_user_func_array(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"), array($arUserField, array("NAME" => "FIELDS[" . $row['ID'] . "][" . $arUserField["FIELD_NAME"] . "]", "VALUE" => htmlspecialcharsbx($v))));
if ($html == '') {
$html = ' ';
}
$tableColumns[$k] = true;
$row[$k] = $html;
}
$rows[] = $row;
}
$data = array('rows' => $rows, 'fields' => $fields, 'colums' => $tableColumns, 'liked' => $liked, 'userLike' => $userLike);
$CACHE_MANAGER->EndTagCache();
if ($obCache->StartDataCache()) {
$obCache->EndDataCache(array("data" => $data));
}
//.........这里部分代码省略.........
示例10: GetRegionsIdsByNames
public static function GetRegionsIdsByNames($arRegNames, $countryId = false)
{
if (self::isLocationProMigrated()) {
try {
$types = self::getTypes();
$query = new Entity\Query(self::SELF_ENTITY_NAME);
$fieldMap = array('RID' => 'REGION_ID', 'RNAME' => 'NAME.NAME', 'RSHORT_NAME' => 'NAME.SHORT_NAME');
$selectFields = $fieldMap;
$filterFields = array(array('LOGIC' => 'OR', 'RNAME' => $arRegNames, 'RSHORT_NAME' => $arRegNames), '=TYPE_ID' => $types['REGION'], '!=REGION_ID' => '0');
if ($countryId = intval($countryId)) {
$filterFields['=COUNTRY_ID'] = $countryId;
}
// order
$orderFields = array('RNAME' => 'asc', 'RSHORT_NAME' => 'asc');
// group
$groupFields = array('RID');
$nameJoinCondition = array('=this.ID' => 'ref.LOCATION_ID');
if (strlen($strLang)) {
$nameJoinCondition['=ref.LANGUAGE_ID'] = array('?', $strLang);
}
$query->registerRuntimeField('NAME', array('data_type' => self::NAME_ENTITY_NAME, 'reference' => $nameJoinCondition, 'join_type' => 'left'));
$query->setSelect($selectFields);
$query->setFilter($filterFields);
$query->setOrder($orderFields);
$query->setGroup($groupFields);
$result = array();
$res = $query->exec();
while ($item = $res->fetch()) {
$result[strlen($item['RNAME']) ? $item['RNAME'] : $item['RSHORT_NAME']] = $item['RID'];
}
return $result;
} catch (Exception $e) {
return array();
}
} else {
global $DB;
$arResult = array();
$arWhere = array();
$arQueryFields = array('RL.NAME', 'RL.SHORT_NAME');
if (is_array($arRegNames)) {
foreach ($arRegNames as $regName) {
$regName = $DB->ForSql($regName);
foreach ($arQueryFields as $field) {
$arWhere[] = $field . " LIKE '" . $regName . "'";
}
}
if (count($arWhere) > 0) {
$strWhere = implode(' OR ', $arWhere);
$query = "\tSELECT RL.REGION_ID, RL.NAME, RL.SHORT_NAME\n\t\t\t\t\t\t\t\tFROM b_sale_location_region_lang RL ";
if ($countryId) {
$strWhere = 'L.COUNTRY_ID=\'' . intval($countryId) . '\' AND (' . $strWhere . ')';
$query .= "LEFT JOIN b_sale_location L ON L.REGION_ID=RL.REGION_ID ";
}
$query .= "WHERE " . $strWhere;
$query .= " GROUP BY RL.REGION_ID";
$query .= " ORDER BY RL.NAME, RL.SHORT_NAME";
$dbList = $DB->Query($query);
$arRegionsLang = array();
while ($arRegion = $dbList->Fetch()) {
if (strlen($arRegion["NAME"]) > 0) {
$idx = $arRegion["NAME"];
} else {
$idx = $arRegion["SHORT_NAME"];
}
$arResult[$idx] = $arRegion["REGION_ID"];
}
}
}
return $arResult;
}
}
示例11: getSubtreeRangeSqlForNode
/**
* This method is for internal use only. It may be changed without any notification further, or even mystically disappear.
*
* @access private
*/
public static function getSubtreeRangeSqlForNode($primary, $node = array())
{
$primary = Assert::expectIntegerPositive($primary, '$primary');
if (empty($node)) {
$node = self::getNodeInfo($primary);
if (!intval($node['ID'])) {
throw new Tree\NodeNotFoundException(false, array('INFO' => array('ID' => $primary)));
}
}
static::checkNodeThrowException($node);
$query = new Main\Entity\Query(static::getEntity());
$query->setSelect(array('ID'));
$query->setFilter(array('>LEFT_MARGIN' => $node['LEFT_MARGIN'], '<RIGHT_MARGIN' => $node['RIGHT_MARGIN']));
return $query->getQuery();
}
示例12: delete
/**
* @param mixed $primary
*
* @return Main\DB\Result|Entity\DeleteResult
*/
public static function delete($primary)
{
global $USER_FIELD_MANAGER;
// get old data
$hlblock = static::getByPrimary($primary)->fetch();
// get file fields
$file_fields = array();
$fields = $USER_FIELD_MANAGER->getUserFields('HLBLOCK_' . $hlblock['ID']);
foreach ($fields as $name => $field) {
if ($field['USER_TYPE']['BASE_TYPE'] === 'file') {
$file_fields[] = $name;
}
}
// delete files
if (!empty($file_fields)) {
$oldEntity = static::compileEntity($hlblock);
$query = new Entity\Query($oldEntity);
// select file ids
$query->setSelect($file_fields);
// if they are not empty
$filter = array('LOGIC' => 'OR');
foreach ($file_fields as $file_field) {
$filter['!' . $file_field] = false;
}
$query->setFilter($filter);
// go
$result = $query->exec();
while ($row = $result->fetch()) {
foreach ($file_fields as $file_field) {
if (!empty($row[$file_field])) {
if (is_array($row[$file_field])) {
foreach ($row[$file_field] as $value) {
\CFile::delete($value);
}
} else {
\CFile::delete($row[$file_field]);
}
}
}
}
}
$connection = Application::getConnection();
foreach ($fields as $field) {
// delete from uf registry
if ($field['USER_TYPE']['BASE_TYPE'] === 'enum') {
$enumField = new \CUserFieldEnum();
$enumField->DeleteFieldEnum($field['ID']);
}
$connection->query("DELETE FROM b_user_field_lang WHERE USER_FIELD_ID = " . $field['ID']);
$connection->query("DELETE FROM b_user_field WHERE ID = " . $field['ID']);
// if multiple - drop utm table
if ($field['MULTIPLE'] == 'Y') {
$utmTableName = static::getMultipleValueTableName($hlblock, $field);
$connection->dropTable($utmTableName);
}
}
// clear uf cache
global $CACHE_MANAGER;
if (CACHED_b_user_field !== false) {
$CACHE_MANAGER->cleanDir("b_user_field");
}
// remove row
$result = parent::delete($primary);
// drop hl table
$connection->dropTable($hlblock['TABLE_NAME']);
return $result;
}
示例13: getCounters
public function getCounters(array $parameters = array())
{
$query = new Query(Internals\ContextCounterDayTable::getEntity());
if ($filter = $parameters['filter']) {
$query->setFilter($filter);
}
$i = 0;
foreach ($this->attributes as $name => $value) {
self::setAttributeFilter($query, '_conversion_attribute_' . ++$i . '_', $name, $value);
}
$query->registerRuntimeField(null, new ExpressionField('VALUE_SUM', 'SUM(%s)', array('VALUE')));
$splitNames = array();
if ($split = $parameters['split']) {
if (!is_array($split)) {
throw new ArgumentTypeException('parameters[split]', 'array');
}
foreach ($split as $name => $value) {
switch ($name) {
case 'ATTRIBUTE_NAME':
if (!is_string($value)) {
throw new ArgumentTypeException('parameters[split][ATTRIBUTE_NAME]', 'string');
}
self::setAttributeFilter($query, 'split_attribute', $value);
$query->addGroup('split_attribute.VALUE');
$query->addSelect('split_attribute.VALUE', 'ATTRIBUTE_VALUE');
$splitNames[] = 'ATTRIBUTE_VALUE';
break;
default:
throw new ArgumentTypeException('parameters[split][' . $name . ']', 'not implemented');
}
}
}
$query->addGroup('NAME');
$query->addSelect('NAME');
$query->addSelect('VALUE_SUM');
$result = $query->exec();
// return $result->fetchAll();
$counters = array();
while ($row = $result->fetch()) {
$level =& $counters;
foreach ($splitNames as $name) {
if (!($level =& $level[$row[$name]])) {
$level = array();
}
}
$level[$row['NAME']] = $row['VALUE_SUM'];
}
return $counters;
}
示例14: prepareSelectViewElement
/**
* @param $elem
* @param $select
* @param $is_init_entity_aggregated
* @param $fList
* @param Entity\QueryChain[] $fChainList
* @param $helper_class
* @param Entity\Base $entity
*
* @return array
*/
public static function prepareSelectViewElement($elem, $select, $is_init_entity_aggregated, $fList, $fChainList, $helper_class, Entity\Base $entity)
{
$result = null;
$alias = null;
if (empty($elem['aggr']) && !strlen($elem['prcnt'])) {
$result = $elem['name'];
} else {
$expression = '';
/** @var Entity\Field $field */
$field = $fList[$elem['name']];
$chain = $fChainList[$elem['name']];
$alias = $chain->getAlias();
$dataType = call_user_func(array($helper_class, 'getFieldDataType'), $field);
if (!empty($elem['aggr'])) {
$alias = $elem['aggr'] . '_' . $alias;
if ($dataType == 'boolean') {
// sum int for boolean
global $DB;
/** @var Entity\BooleanField $field */
$trueValue = $field->normalizeValue(true);
$localDef = 'CASE WHEN %s = \'' . $DB->ForSql($trueValue) . '\' THEN 1 ELSE 0 END';
} else {
$localDef = '%s';
}
if ($elem['aggr'] == 'COUNT_DISTINCT') {
$dataType = 'integer';
$expression = array('COUNT(DISTINCT ' . $localDef . ')', $elem['name']);
} else {
if ($dataType == 'boolean') {
$dataType = 'integer';
}
if ($elem['aggr'] == 'GROUP_CONCAT') {
$expression = array($localDef, $elem['name']);
} else {
$expression = array($elem['aggr'] . '(' . $localDef . ')', $elem['name']);
}
}
// pack 1:N aggregations into subquery
if ($chain->hasBackReference() && $elem['aggr'] != 'GROUP_CONCAT') {
$confirm = call_user_func_array(array($helper_class, 'confirmSelectBackReferenceRewrite'), array(&$elem, $chain));
if ($confirm) {
$filter = array();
foreach ($entity->GetPrimaryArray() as $primary) {
$filter['=' . $primary] = new CSQLWhereExpression('?#', ToLower($entity->getCode()) . '.' . $primary);
}
$query = new Entity\Query($entity);
$query->addSelect(new Entity\ExpressionField('X', $expression[0], $elem['name']));
$query->setFilter($filter);
$query->setTableAliasPostfix('_sub');
$expression = array('(' . $query->getQuery() . ')');
// double aggregation if init entity aggregated
if ($is_init_entity_aggregated) {
if ($elem['aggr'] == 'COUNT_DISTINCT') {
$expression[0] = 'SUM(' . $expression[0] . ')';
} else {
$expression[0] = $elem['aggr'] . '(' . $expression[0] . ')';
}
}
}
// confirmed
}
}
if (strlen($elem['prcnt'])) {
$alias = $alias . '_PRCNT';
$dataType = 'integer';
if ($elem['prcnt'] == 'self_column') {
if (empty($expression)) {
$expression = array('%s', $elem['name']);
}
} else {
if (empty($expression)) {
$localDef = '%s';
$localMembers = array($elem['name']);
} else {
$localDef = $expression[0];
$localMembers = array_slice($expression, 1);
}
list($remoteAlias, $remoteSelect) = self::prepareSelectViewElement($select[$elem['prcnt']], $select, $is_init_entity_aggregated, $fList, $fChainList, $helper_class, $entity);
if (is_array($remoteSelect) && !empty($remoteSelect['expression'])) {
// remote field is expression
$remoteDef = $remoteSelect['expression'][0];
$remoteMembers = array_slice($remoteSelect['expression'], 1);
$alias = $alias . '_FROM_' . $remoteAlias;
} else {
// remote field is usual field
$remoteDef = '%s';
$remoteMembers = array($remoteSelect);
$remoteAlias = Entity\QueryChain::getAliasByDefinition($entity, $remoteSelect);
$alias = $alias . '_FROM_' . $remoteAlias;
//.........这里部分代码省略.........
示例15: array
}
}
if ($selectFields['PROPERTY_TYPE']) {
$selectFields['USER_TYPE'] = true;
}
$selectFields = array_keys($selectFields);
$getListParams = array('select' => $selectFields, 'filter' => $arFilter, 'order' => $propertyOrder);
if ($usePageNavigation) {
$getListParams['limit'] = $navyParams['SIZEN'];
$getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1);
}
$totalPages = 0;
if ($usePageNavigation) {
$countQuery = new Main\Entity\Query(Iblock\PropertyTable::getEntity());
$countQuery->addSelect(new Main\Entity\ExpressionField('CNT', 'COUNT(1)'));
$countQuery->setFilter($getListParams['filter']);
$totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch();
unset($countQuery);
$totalCount = (int) $totalCount['CNT'];
if ($totalCount > 0) {
$totalPages = ceil($totalCount / $navyParams['SIZEN']);
if ($navyParams['PAGEN'] > $totalPages) {
$navyParams['PAGEN'] = $totalPages;
}
$getListParams['limit'] = $navyParams['SIZEN'];
$getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1);
} else {
$navyParams['PAGEN'] = 1;
$getListParams['limit'] = $navyParams['SIZEN'];
$getListParams['offset'] = 0;
}