$navyParams = CDBResult::GetNavParams(CAdminResult::GetNavSize($adminListTableID)); if ($navyParams['SHOW_ALL']) { $usePageNavigation = false; } else { $navyParams['PAGEN'] = (int) $navyParams['PAGEN']; $navyParams['SIZEN'] = (int) $navyParams['SIZEN']; } } $getListParams = array('select' => array_keys($selectFields), 'filter' => $filter, 'order' => array($by => $order)); if ($usePageNavigation) { $getListParams['limit'] = $navyParams['SIZEN']; $getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1); } $discountIterator = new CAdminResult(Internals\DiscountTable::getList($getListParams), $adminListTableID); if ($usePageNavigation) { $countQuery = new Main\Entity\Query(Internals\DiscountTable::getEntity()); $countQuery->addSelect(new Main\Entity\ExpressionField('CNT', 'COUNT(1)')); $countQuery->setFilter($getListParams['filter']); $totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch(); $totalCount = (int) $totalCount['CNT']; $totalPages = ceil($totalCount / $getListParams['limit']); unset($countQuery); $discountIterator->NavStart($getListParams['limit'], $navyParams['SHOW_ALL'], $navyParams['PAGEN']); $discountIterator->NavRecordCount = $totalCount; $discountIterator->NavPageCount = $totalPages; $discountIterator->NavPageNomer = $navyParams['PAGEN']; } else { $discountIterator->NavStart(); } $adminList->NavText($discountIterator->GetNavPrint(Loc::getMessage("BT_SALE_DISCOUNT_LIST_MESS_NAV"))); $userList = array();
public static function getAllCounter() { $countQuery = new Main\Entity\Query(Sale\Internals\DiscountTable::getEntity()); $countQuery->addSelect(new Main\Entity\ExpressionField('CNT', 'COUNT(1)')); $countQuery->setFilter(array('=VERSION' => Sale\Internals\DiscountTable::VERSION_NEW)); $totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch(); return (int) $totalCount['CNT']; }