本文整理汇总了PHP中Bitrix\Main\Entity\Query类的典型用法代码示例。如果您正苦于以下问题:PHP Query类的具体用法?PHP Query怎么用?PHP Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:spas-viktor,项目名称:books,代码行数:26,代码来源:block_funcs.php
示例2: execute
/**
* Executes the query
*
* @param string $filterField
* @param mixed $filterFieldValue
* @param string $method
*
* @return \Bitrix\Main\DB\MysqlResult
*/
private function execute($filterField, $filterFieldValue, $method)
{
$queryBuilder = new Entity\Query(Model\VarsGroupTable::getEntity());
$queryBuilder->setSelect(array('ID', 'NAME', 'CODE'))->setOrder(array('ID' => 'ASC'))->setFilter(array($filterField => $filterFieldValue));
if ($method == 'findOneBy') {
$queryBuilder->setLimit(1);
}
return $queryBuilder->exec();
}
开发者ID:ASDAFF,项目名称:citfact.uservars,代码行数:18,代码来源:VarsGroup.php
示例3: 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);
}
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:foreign.php
示例4: calculateEntityCount
public function calculateEntityCount(DuplicateCriterion $criterion, array $options = null)
{
$entityTypeID = $this->getEntityTypeID();
$enablePermissionCheck = $this->isPermissionCheckEnabled();
$userID = $this->getUserID();
$query = new Main\Entity\Query(DuplicateCommunicationMatchCodeTable::getEntity());
$query->addSelect('QTY');
$query->registerRuntimeField('', new Main\Entity\ExpressionField('QTY', 'COUNT(*)'));
$query->addFilter('=ENTITY_TYPE_ID', $entityTypeID);
if ($enablePermissionCheck) {
$permissionSql = $this->preparePermissionSql();
if ($permissionSql === false) {
//Access denied;
return 0;
}
if (is_string($permissionSql) && $permissionSql !== '') {
$query->addFilter('@ENTITY_ID', new Main\DB\SqlExpression($permissionSql));
}
}
$matches = $criterion->getMatches();
$type = isset($matches['TYPE']) ? $matches['TYPE'] : '';
if ($type === '') {
throw new Main\ArgumentException("Parameter 'TYPE' is required.", 'matches');
}
$value = isset($matches['VALUE']) ? $matches['VALUE'] : '';
if ($type === '') {
throw new Main\ArgumentException("Parameter 'VALUE' is required.", 'matches');
}
$query->addFilter('=TYPE', $type);
$query->addFilter('=VALUE', $value);
$rootEntityID = 0;
if (is_array($options) && isset($options['ROOT_ENTITY_ID'])) {
$rootEntityID = (int) $options['ROOT_ENTITY_ID'];
}
if ($rootEntityID > 0) {
$query->addFilter('!ENTITY_ID', $rootEntityID);
$query->addFilter('!@ENTITY_ID', DuplicateIndexMismatch::prepareQueryField($criterion, $entityTypeID, $rootEntityID, $userID));
}
$limit = 0;
if (is_array($options) && isset($options['LIMIT'])) {
$limit = (int) $options['LIMIT'];
}
if ($limit > 0) {
$query->setLimit($limit);
}
$dbResult = $query->exec();
$fields = $dbResult->fetch();
return is_array($fields) && isset($fields['QTY']) ? intval($fields['QTY']) : 0;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:communicationdedupedatasource.php
示例5: 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);
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:focuscontroller.php
示例6: deleteUnnecessaryFiles
/**
* Deletes unnecessary files, which don't relate to version or object.
*
* @param int $portion Count of files which we want to delete. Default value is 10.
* @return string
*/
public static function deleteUnnecessaryFiles($portion = 10)
{
$query = new Query(FileTable::getEntity());
$query->addSelect('ID')->addFilter('=EXTERNAL_ID', 'unnecessary')->addFilter('=MODULE_ID', Driver::INTERNAL_MODULE_ID)->setLimit($portion);
$workLoad = false;
$dbResult = $query->exec();
while ($row = $dbResult->fetch()) {
$workLoad = true;
\CFile::delete($row['ID']);
}
if (!$workLoad) {
return '';
}
return static::className() . '::deleteUnnecessaryFiles();';
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:cleaner.php
示例7: isRegistered
/**
* @return boolean
*/
public static function isRegistered($ownerID)
{
if (!is_int($ownerID)) {
$ownerID = (int) $ownerID;
}
if ($ownerID <= 0) {
throw new Main\ArgumentException('Owner ID must be greater than zero.', 'ownerID');
}
$query = new Query(DealInvoiceStatisticsTable::getEntity());
$query->addSelect('CREATED_DATE');
$query->addFilter('=OWNER_ID', $ownerID);
$query->setLimit(1);
$dbResult = $query->exec();
$result = $dbResult->fetch();
return is_array($result);
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:dealinvoicestatisticentry.php
示例8: 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;
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:17,代码来源:highloadblocks.php
示例9: checkFields
public static function checkFields(Result $result, $primary, array $data)
{
parent::checkFields($result, $primary, $data);
if (!$result->isSuccess()) {
return;
}
$query = new Entity\Query(static::getEntity());
$res = $query->setSelect(array('ID', 'STATUS'))->setFilter(array('=TO_ENTITY' => $data['TO_ENTITY'], '=REAL_OBJECT_ID' => $data['REAL_OBJECT_ID']))->setLimit(2)->exec();
while ($existing = $res->fetch()) {
if (!isset($primary) || $primary != $existing['ID']) {
if ($existing['STATUS'] == self::STATUS_IS_DECLINED) {
static::delete($existing['ID']);
} else {
$result->addError(new Entity\EntityError(Loc::getMessage("DISK_SHARING_ENTITY_ERROR_NON_UNIQUE")));
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:sharing.php
示例10: buildQuery
protected function buildQuery()
{
if ($this->useIblockSearch()) {
$this->appendIblockRelatedData();
} else {
$entityClass = $this->getEntity()->getDataClass();
$this->filter['IBLOCK_ID'] = $entityClass::getIblockId();
}
return parent::buildQuery();
}
开发者ID:maximaster,项目名称:tools.orm,代码行数:10,代码来源:Query.php
示例11: 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;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:unique.php
示例12: getMismatches
public static function getMismatches($entityTypeID, $entityID, $typeID, $matchHash, $userID, $limit = 0)
{
if (!is_int($limit)) {
$limit = (int) $limit;
}
$results = array();
$query = new Main\Entity\Query(Entity\DuplicateIndexMismatchTable::getEntity());
$query->addSelect('R_ENTITY_ID', 'ENTITY_ID');
$query->addFilter('=USER_ID', $userID);
$query->addFilter('=ENTITY_TYPE_ID', $entityTypeID);
$query->addFilter('=TYPE_ID', $typeID);
$query->addFilter('=MATCH_HASH', $matchHash);
$query->addFilter('=L_ENTITY_ID', $entityID);
if ($limit > 0) {
$query->addOrder('R_ENTITY_ID', 'ASC');
$query->setLimit($limit);
}
$dbResult = $query->exec();
while ($fields = $dbResult->fetch()) {
$results[] = (int) $fields['ENTITY_ID'];
}
$query = new Main\Entity\Query(Entity\DuplicateIndexMismatchTable::getEntity());
$query->addSelect('L_ENTITY_ID', 'ENTITY_ID');
$query->addFilter('=USER_ID', $userID);
$query->addFilter('=ENTITY_TYPE_ID', $entityTypeID);
$query->addFilter('=TYPE_ID', $typeID);
$query->addFilter('=MATCH_HASH', $matchHash);
$query->addFilter('=R_ENTITY_ID', $entityID);
if ($limit > 0) {
$query->addOrder('L_ENTITY_ID', 'ASC');
$query->setLimit($limit);
}
$dbResult = $query->exec();
while ($fields = $dbResult->fetch()) {
$results[] = (int) $fields['ENTITY_ID'];
}
return $results;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:duplicateindexmismatch.php
示例13: findUserFilterNotify
/**
* Method searches for a custom filter that, needs updating (notifications of new elements).
* Custom filters are added to the stack of tasks.
*
* @param int $limitFilter
* @return string
*/
public static function findUserFilterNotify($limitFilter = 1, $limitFilterUser = 100)
{
$iblockElement = new \CIBlockElement();
$connection = \Bitrix\Main\Application::getConnection();
$sqlHelper = $connection->getSqlHelper();
$limitFilter = (int) $limitFilter;
$limitFilterUser = (int) $limitFilterUser;
if ($limitFilterUser <= 0 || $limitFilterUser <= 0) {
return;
}
$queryBuilder = new Entity\Query(Model\SubscribeTable::getEntity());
$filterResult = $queryBuilder->setSelect(array('*'))->setFilter(array('ACTIVE' => 'Y'))->setLimit($limitFilter)->exec();
while ($filterRow = $filterResult->fetch()) {
$filter['IBLOCK_ID'] = $filterRow['IBLOCK_ID'];
if ($filterRow['SECTION_ID'] > 0) {
$filter['SECTION_ID'] = $filterRow['SECTION_ID'];
}
$filter = array_merge($filter, unserialize($filterRow['FILTER']));
$elementResult = $iblockElement->GetList(false, $filter, array('IBLOCK_ID'))->fetch();
if ($elementResult['CNT'] <= 0) {
continue;
}
// Choose filters which notification less,
// than the number of elements with filter
$sql = "\n SELECT DISTINCT t1.ID\n FROM b_citfact_filter_subscribe_user as t1\n LEFT OUTER JOIN b_citfact_filter_subscribe_notify as t2 ON (\n t1.ID = t2.FILTER_USER_ID AND\n t1.FILTER_ID = '" . $sqlHelper->forSql($filterRow['ID']) . "'\n )\n WHERE (SELECT count(ID) FROM b_citfact_filter_subscribe_notify as t3 WHERE t3.FILTER_USER_ID = t1.ID) < '" . $sqlHelper->forSql($elementResult['CNT']) . "'\n GROUP BY t1.ID\n LIMIT 0," . $limitFilterUser . "\n ";
// Adding custom filters to stack table
$notifyList = (array) $connection->query($sql)->fetchAll();
foreach ($notifyList as $key => $notify) {
Model\SubscribeStackTable::add(array('FILTER_USER_ID' => $notify['ID'], 'ACTION' => 'UPDATE'));
}
// If list for stack table is not empty, then deactivate filter
if (sizeof($notifyList) > 0) {
Model\SubscribeTable::update($filterRow['ID'], array('ACTIVE' => 'N'));
}
}
return "Citfact\\FilterSubscribe\\Agent::findUserFilterNotify({$limitFilter})";
}
开发者ID:ASDAFF,项目名称:citfact.filter.subscribe,代码行数:44,代码来源:Agent.php
示例14: prepareEntityListFilter
/** @return array */
public function prepareEntityListFilter(array $filterParams)
{
$filter = self::internalizeFilter($filterParams);
$query = new Query(DealStageHistoryTable::getEntity());
$query->addSelect('OWNER_ID');
$query->addGroup('OWNER_ID');
$period = $filter->getPeriod();
$periodStartDate = $period['START'];
$periodEndDate = $period['END'];
$query->addFilter('=TYPE_ID', HistoryEntryType::CREATION);
$query->addFilter('>=START_DATE', $periodStartDate);
$query->addFilter('<=START_DATE', $periodEndDate);
$query->registerRuntimeField('', new ExpressionField('E1', '(CASE WHEN NOT EXISTS(' . self::prepareHistoryQuery($periodStartDate, $periodEndDate, HistoryEntryType::MODIFICATION, '%s', '_i')->getQuery() . ') THEN 1 ELSE 0 END)', 'OWNER_ID'));
$query->addFilter('=E1', 1);
$query->registerRuntimeField('', new ExpressionField('E2', '(CASE WHEN NOT EXISTS(' . self::prepareHistoryQuery($periodStartDate, $periodEndDate, HistoryEntryType::FINALIZATION, '%s', '_i')->getQuery() . ') THEN 1 ELSE 0 END)', 'OWNER_ID'));
$query->addFilter('=E2', 1);
$query->registerRuntimeField('', new ExpressionField('E3', '(CASE WHEN NOT EXISTS(' . self::prepareActivityQuery($periodStartDate, $periodEndDate, '%s')->getQuery() . ') THEN 1 ELSE 0 END)', 'OWNER_ID'));
$query->addFilter('=E3', 1);
$query->registerRuntimeField('', new ExpressionField('E4', '(CASE WHEN NOT EXISTS(' . self::prepareInvoiceQuery($periodStartDate, $periodEndDate, '%s')->getQuery() . ') THEN 1 ELSE 0 END)', 'OWNER_ID'));
$query->addFilter('=E4', 1);
$responsibleIDs = $filter->getResponsibleIDs();
if (!empty($responsibleIDs)) {
$query->addFilter('@RESPONSIBLE_ID', $responsibleIDs);
}
return array('__JOINS' => array(array('TYPE' => 'INNER', 'SQL' => 'INNER JOIN(' . $query->getQuery() . ') DS ON DS.OWNER_ID = L.ID')));
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:dealidle.php
示例15: getCount
public static function getCount()
{
$query = new Query(static::getEntity());
$query->setSelect(array('CNT' => array('expression' => array('COUNT(*)'), 'data_type' => 'integer')));
$result = $query->exec()->fetch();
return $result['CNT'];
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:7,代码来源:datamanager.php
示例16: array
$navyParams['PAGEN'] = (int) $navyParams['PAGEN'];
$navyParams['SIZEN'] = (int) $navyParams['SIZEN'];
}
}
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'];
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_property_admin.php
示例17: ShowError
}
use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;
global $USER_FIELD_MANAGER;
// hlblock info
$hlblock_id = $arParams['BLOCK_ID'];
if (empty($hlblock_id)) {
ShowError(GetMessage('HLBLOCK_VIEW_NO_ID'));
return 0;
}
$hlblock = HL\HighloadBlockTable::getById($hlblock_id)->fetch();
if (empty($hlblock)) {
ShowError('404');
return 0;
}
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
// row data
$main_query = new Entity\Query($entity);
$main_query->setSelect(array('*'));
$main_query->setFilter(array('=ID' => $arParams['ROW_ID']));
$result = $main_query->exec();
$result = new CDBResult($result);
$row = $result->Fetch();
$fields = $USER_FIELD_MANAGER->getUserFieldsWithReadyData('HLBLOCK_' . $hlblock['ID'], $row, LANGUAGE_ID);
if (empty($row)) {
ShowError(sprintf(GetMessage('HLBLOCK_VIEW_NO_ROW'), $arParams['ROW_ID']));
return 0;
}
$arResult['fields'] = $fields;
$arResult['row'] = $row;
$this->IncludeComponentTemplate();
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php
示例18: LocalRedirect
if (!isset($dataGroup) || empty($dataGroup)) {
LocalRedirect(sprintf('user_vars.php?lang=%s', LANGUAGE_ID));
}
$includePath = array('prolog' => '/bitrix/modules/main/include/prolog_admin_after.php', 'prolog_js' => '/bitrix/modules/main/include/prolog_admin_js.php', 'epilog' => '/bitrix/modules/main/include/epilog_admin.php', 'epilog_js' => '/bitrix/modules/main/include/epilog_admin_js.php');
$contextMenu[] = array('TEXT' => Loc::getMessage('USER_VARS_ADD'), 'TITLE' => Loc::getMessage('USER_VARS_ADD'), 'LINK' => 'user_vars_edit.php?GROUP_ID=' . $dataGroup['ID'] . '&lang=' . LANGUAGE_ID, 'ICON' => 'btn_new');
$contextMenu[] = array('TEXT' => Loc::getMessage('USER_VARS_EDIT_GROUP'), 'TITLE' => Loc::getMessage('USER_VARS_EDIT_GROUP'), 'LINK' => 'user_vars_group_edit.php?ID=' . $dataGroup['ID'] . '&lang=' . LANGUAGE_ID, 'ICON' => 'btn_edit');
$varsMap = Model\VarsTable::getMap();
$headers = array(array('id' => 'ID', 'content' => 'ID', 'sort' => 'ID', 'default' => true), array('id' => 'NAME', 'content' => $varsMap['NAME']['title'], 'sort' => 'NAME', 'default' => true), array('id' => 'CODE', 'content' => $varsMap['CODE']['title'], 'sort' => 'CODE', 'default' => true), array('id' => 'VALUE', 'content' => $varsMap['VALUE']['title'], 'sort' => 'VALUE', 'default' => true), array('id' => 'DESCRIPTION', 'content' => $varsMap['DESCRIPTION']['title'], 'sort' => 'DESCRIPTION', 'default' => true));
$tableId = 'tbl_user_vars_list';
$adminSort = new CAdminSorting($tableId, 'NAME', 'asc');
$adminList = new CAdminList($tableId, $adminSort);
$adminList->addHeaders($headers);
if ($request->getQuery('mode') != 'list') {
$context = new CAdminContextMenu($contextMenu);
}
$queryBuilder = new Entity\Query(Model\VarsTable::getEntity());
$queryBuilder->setSelect(array('ID', 'NAME', 'CODE', 'DESCRIPTION', 'VALUE'))->setFilter(array('GROUP_ID' => $dataGroup['ID']));
$sortBy = $request->getQuery('by') ? strtoupper($request->getQuery('by')) : 'ID';
$sortOrder = $request->getQuery('order') ?: 'asc';
$queryBuilder->setOrder(array($sortBy => $sortOrder));
$resultData = new CAdminResult($queryBuilder->exec(), $tableId);
$resultData->navStart();
$adminList->navText($resultData->getNavPrint(Loc::getMessage('PAGES')));
while ($item = $resultData->fetch()) {
$row = $adminList->addRow($item['ID'], $item);
$actions = array();
$actions[] = array('ICON' => 'edit', 'TEXT' => Loc::GetMessage('USER_VARS_ACTION_EDIT_VAR'), 'ACTION' => $adminList->actionRedirect('user_vars_edit.php?ID=' . $item['ID'] . '&GROUP_ID=' . $dataGroup['ID']));
$actions[] = array('ICON' => 'delete', 'TEXT' => Loc::getMessage('USER_VARS_ACTION_DELETE_VAR'), 'ACTION' => "if(confirm('" . Loc::getMessage('USER_VARS_DELETE_VAR_CONFIRM') . "')) " . $adminList->actionRedirect('user_vars_edit.php?action=delete&ID=' . $item['ID'] . '&GROUP_ID=' . $dataGroup['ID'] . '&' . bitrix_sessid_get()));
$row->addActions($actions);
}
$prologType = $request->getQuery('mode') == 'list' ? 'prolog_js' : 'prolog';
开发者ID:ASDAFF,项目名称:citfact.uservars,代码行数:31,代码来源:user_vars_list.php
示例19: synchronize
public static function synchronize($ownerID, array $entityFields = null)
{
if (!is_int($ownerID)) {
$ownerID = (int) $ownerID;
}
if ($ownerID <= 0) {
throw new Main\ArgumentException('Owner ID must be greater than zero.', 'ownerID');
}
$query = new Query(DealStageHistoryTable::getEntity());
$query->addSelect('START_DATE');
$query->addSelect('END_DATE');
$query->addSelect('RESPONSIBLE_ID');
$query->addFilter('=OWNER_ID', $ownerID);
$query->setLimit(1);
$dbResult = $query->exec();
$first = $dbResult->fetch();
if (!is_array($first)) {
return false;
}
if (!is_array($entityFields)) {
$dbResult = \CCrmDeal::GetListEx(array(), array('=ID' => $ownerID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID', 'BEGINDATE', 'CLOSEDATE'));
$entityFields = is_object($dbResult) ? $dbResult->Fetch() : null;
if (!is_array($entityFields)) {
return false;
}
}
$responsibleID = isset($entityFields['ASSIGNED_BY_ID']) ? (int) $entityFields['ASSIGNED_BY_ID'] : 0;
$beginDate = isset($entityFields['BEGINDATE']) ? $entityFields['BEGINDATE'] : '';
/** @var Date $startDate */
$startDate = new Date($beginDate);
$closeDate = isset($entityFields['CLOSEDATE']) ? $entityFields['CLOSEDATE'] : '';
/** @var Date $endDate */
$endDate = $closeDate !== '' ? new Date($closeDate) : new Date('9999-12-31', 'Y-m-d');
if ($startDate->getTimestamp() === $first['START_DATE']->getTimestamp() && $endDate->getTimestamp() === $first['END_DATE']->getTimestamp() && $responsibleID === (int) $first['RESPONSIBLE_ID']) {
return false;
}
DealStageHistoryTable::synchronize($ownerID, array('START_DATE' => $startDate, 'END_DATE' => $endDate, 'RESPONSIBLE_ID' => $responsibleID));
return true;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:39,代码来源:dealstagehistoryentry.php
示例20: 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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:ustat.php
注:本文中的Bitrix\Main\Entity\Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论