当前位置: 首页>>代码示例>>PHP>>正文


PHP Query::exec方法代码示例

本文整理汇总了PHP中Bitrix\Main\Entity\Query::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::exec方法的具体用法?PHP Query::exec怎么用?PHP Query::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\Entity\Query的用法示例。


在下文中一共展示了Query::exec方法的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;
}
开发者ID:spas-viktor,项目名称:books,代码行数:26,代码来源:block_funcs.php

示例2: getList

 /**
  * @return array
  */
 public function getList(array $params)
 {
     /** @var Filter $filter */
     $filter = isset($params['filter']) ? $params['filter'] : null;
     if (!$filter instanceof Filter) {
         throw new Main\ObjectNotFoundException("The 'filter' is not found in params.");
     }
     /** @var array $select */
     $select = isset($params['select']) && is_array($params['select']) ? $params['select'] : array();
     $name = '';
     if (!empty($select)) {
         $selectItem = $select[0];
         if (isset($selectItem['name'])) {
             $name = $selectItem['name'];
         }
     }
     if ($name === '') {
         $name = 'COUNT';
     }
     $group = isset($params['group']) ? strtoupper($params['group']) : '';
     if ($group !== '' && $group !== self::GROUP_BY_DATE) {
         $group = '';
     }
     $enableGroupByDate = $group !== '';
     $period = $filter->getPeriod();
     $periodStartDate = $period['START'];
     $periodEndDate = $period['END'];
     $query = new Query(DealStageHistoryTable::getEntity());
     $query->registerRuntimeField('', new ExpressionField($name, "COUNT(*)"));
     $query->addSelect($name);
     $query->addFilter('=TYPE_ID', HistoryEntryType::CREATION);
     $query->addFilter('>=START_DATE', $periodStartDate);
     $query->addFilter('<=START_DATE', $periodEndDate);
     if ($enableGroupByDate) {
         $query->addSelect('START_DATE', 'DATE');
         $query->addGroup('START_DATE');
         $query->addOrder('START_DATE', 'ASC');
     }
     $query->registerRuntimeField('', new ExpressionField('E1', '(CASE WHEN NOT EXISTS(' . self::prepareHistoryQuery($periodStartDate, $periodEndDate, HistoryEntryType::MODIFICATION, '%s', '_h')->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', '_h')->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', '_a')->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', '_i')->getQuery() . ') THEN 1 ELSE 0 END)', 'OWNER_ID'));
     $query->addFilter('=E4', 1);
     $results = array();
     $dbResult = $query->exec();
     while ($ary = $dbResult->fetch()) {
         if ($enableGroupByDate) {
             /** @var Date $date */
             $date = $ary['DATE'];
             $ary['DATE'] = $date->format('Y-m-d');
         }
         $results[] = $ary;
     }
     return $results;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:61,代码来源:dealidle.php

示例3: 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

示例4: 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

示例5: getList

 /** @return array */
 public function getList(array $params)
 {
     /** @var Filter $filter */
     $filter = isset($params['filter']) ? $params['filter'] : null;
     if (!$filter instanceof Filter) {
         throw new Main\ObjectNotFoundException("The 'filter' is not found in params.");
     }
     $permissionSql = '';
     if ($this->enablePermissionCheck) {
         $permissionSql = $this->preparePermissionSql();
         if ($permissionSql === false) {
             //Access denied;
             return array();
         }
     }
     $period = $filter->getPeriod();
     $periodStartDate = $period['START'];
     $periodEndDate = $period['END'];
     $query = new Query(DealStageHistoryTable::getEntity());
     $query->addSelect('STAGE_ID');
     $query->addSelect('QTY');
     $query->registerRuntimeField('', new ExpressionField('QTY', 'COUNT(DISTINCT OWNER_ID)'));
     $typeID = $filter->getExtraParam('typeID', HistoryEntryType::UNDEFINED);
     if ($typeID !== HistoryEntryType::UNDEFINED) {
         $query->addFilter('=TYPE_ID', $typeID);
         if ($typeID === HistoryEntryType::CREATION) {
             $query->addFilter('>=START_DATE', $periodStartDate);
             $query->addFilter('<=START_DATE', $periodEndDate);
         } elseif ($typeID === HistoryEntryType::MODIFICATION) {
             $query->addFilter('>=CREATED_TIME', $periodStartDate);
             $query->addFilter('<=CREATED_TIME', $periodEndDate);
         } elseif ($typeID === HistoryEntryType::FINALIZATION) {
             $query->addFilter('>=END_DATE', $periodStartDate);
             $query->addFilter('<=END_DATE', $periodEndDate);
         }
     }
     if ($this->enablePermissionCheck && is_string($permissionSql) && $permissionSql !== '') {
         $query->addFilter('@OWNER_ID', new SqlExpression($permissionSql));
     }
     $responsibleIDs = $filter->getResponsibleIDs();
     if (!empty($responsibleIDs)) {
         $query->addFilter('@RESPONSIBLE_ID', $responsibleIDs);
     }
     $query->addGroup('STAGE_ID');
     $dbResult = $query->exec();
     //Trace('sql', Query::getLastQuery(), 1);
     $result = array();
     while ($ary = $dbResult->fetch()) {
         $result[] = $ary;
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:dealstagehistory.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: calculateEntityCount

 public function calculateEntityCount(DuplicateCriterion $criterion, array $options = null)
 {
     $entityTypeID = $this->getEntityTypeID();
     $enablePermissionCheck = $this->isPermissionCheckEnabled();
     $userID = $this->getUserID();
     $query = new Main\Entity\Query(DuplicateOrganizationMatchCodeTable::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();
     $title = isset($matches['TITLE']) ? $matches['TITLE'] : '';
     if ($title === '') {
         throw new Main\ArgumentException("Parameter 'TITLE' is required.", 'matches');
     }
     $query->addFilter('=TITLE', $title);
     $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,代码行数:44,代码来源:organizationdedupedatasource.php

示例10: 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

示例11: 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

示例12: setSectionValue

 /**
  * Set values for property with type G(link to section).
  */
 protected function setSectionValue()
 {
     $iblockList = $this->getListByType('G');
     $queryBuilder = new Entity\Query(Iblock\SectionTable::getEntity());
     $queryBuilder->setSelect(array('ID', 'NAME', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'XML_ID'))->setFilter(array('IBLOCK_ID' => $iblockList))->setOrder(array());
     $sectionResult = $queryBuilder->exec();
     while ($section = $sectionResult->fetch()) {
         foreach ($this->iblockProperty as &$field) {
             if ($field['PROPERTY_TYPE'] != 'G') {
                 continue;
             }
             if ($field['LINK_IBLOCK_ID'] == $section['IBLOCK_ID']) {
                 $field['VALUE_LIST'][] = $section;
             }
         }
     }
 }
开发者ID:ASDAFF,项目名称:citfact.form,代码行数:20,代码来源:IBlockBuilder.php

示例13: normalizeLocationList

 public static function normalizeLocationList($denormalizedList = array())
 {
     if (empty($denormalizedList)) {
         return array();
     }
     $useCodes = static::getUseCodes();
     $denormalizedList = array_flip($denormalizedList);
     $query = new Entity\Query('Bitrix\\Sale\\Location\\Location');
     $query->setSelect(array('PARENT_ID', 'ID', 'CODE', 'LNAME' => 'NAME.NAME'));
     $query->setFilter(array('NAME.LANGUAGE_ID' => LANGUAGE_ID));
     // tmp
     $query->setOrder(array('LEFT_MARGIN' => 'desc'));
     // important
     $res = $query->exec();
     // make table of children count for each node
     $relations = array();
     $selected = array();
     while ($item = $res->fetch()) {
         if (!isset($relations[$item['ID']]['name'])) {
             // tmp
             $relations[$item['ID']]['name'] = $item['LNAME'];
         }
         if (!isset($relations[$item['ID']]['total'])) {
             $relations[$item['ID']]['total'] = 0;
         }
         if (!isset($relations[$item['ID']]['selected'])) {
             $relations[$item['ID']]['selected'] = 0;
         }
         ///
         if ($item['PARENT_ID'] != 0) {
             if (!isset($relations[$item['PARENT_ID']]['total'])) {
                 $relations[$item['PARENT_ID']]['total'] = 0;
             }
             if (!isset($relations[$item['PARENT_ID']]['selected'])) {
                 $relations[$item['PARENT_ID']]['selected'] = 0;
             }
         }
         $relations[$item['PARENT_ID']]['total'] += 1 + $relations[$item['ID']]['total'];
         if (isset($denormalizedList[$item['ID']])) {
             $relations[$item['PARENT_ID']]['selected'] += 1 + $relations[$item['ID']]['selected'];
             $selected[$item['ID']] = $item;
         }
     }
     // now make up list of nodes which we`ll remove
     $removeItems = array();
     $removeChildrenOf = array();
     foreach ($relations as $id => $rel) {
         if ($rel['total'] > 0) {
             if ($rel['total'] == $rel['selected']) {
                 if (isset($selected[$id])) {
                     // item should be selected itself to remove its children
                     $removeChildrenOf[$id] = true;
                 }
             } elseif ($rel['selected'] > 0) {
                 // selected M of N of children, where M > 0, so remove item itself
                 $removeItems[$id] = true;
             }
         }
     }
     $normalized = array();
     foreach ($selected as $id => $item) {
         if (!($item['PARENT_ID'] && $removeChildrenOf[$item['PARENT_ID']]) && !$removeItems[$item['ID']]) {
             $normalized[] = $item[$useCodes ? 'CODE' : 'ID'];
         }
     }
     return $normalized;
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:67,代码来源:connector.php

示例14: compatibleNavQuery

 function compatibleNavQuery(Query $query, array $arNavStartParams)
 {
     $cnt = $query->exec()->getSelectedRowsCount();
     // TODO check groups
     global $DB;
     if (isset($arNavStartParams["SubstitutionFunction"])) {
         $arNavStartParams["SubstitutionFunction"]($this, $query->getLastQuery(), $cnt, $arNavStartParams);
         return null;
     }
     if (isset($arNavStartParams["bDescPageNumbering"])) {
         $bDescPageNumbering = $arNavStartParams["bDescPageNumbering"];
     } else {
         $bDescPageNumbering = false;
     }
     $this->InitNavStartVars($arNavStartParams);
     $this->NavRecordCount = $cnt;
     if ($this->NavShowAll) {
         $this->NavPageSize = $this->NavRecordCount;
     }
     //calculate total pages depend on rows count. start with 1
     $this->NavPageCount = $this->NavPageSize > 0 ? floor($this->NavRecordCount / $this->NavPageSize) : 0;
     if ($bDescPageNumbering) {
         $makeweight = 0;
         if ($this->NavPageSize > 0) {
             $makeweight = $this->NavRecordCount % $this->NavPageSize;
         }
         if ($this->NavPageCount == 0 && $makeweight > 0) {
             $this->NavPageCount = 1;
         }
         //page number to display
         $this->NavPageNomer = $this->PAGEN < 1 || $this->PAGEN > $this->NavPageCount ? $_SESSION[$this->SESS_PAGEN] < 1 || $_SESSION[$this->SESS_PAGEN] > $this->NavPageCount ? $this->NavPageCount : $_SESSION[$this->SESS_PAGEN] : $this->PAGEN;
         //rows to skip
         $NavFirstRecordShow = 0;
         if ($this->NavPageNomer != $this->NavPageCount) {
             $NavFirstRecordShow += $makeweight;
         }
         $NavFirstRecordShow += ($this->NavPageCount - $this->NavPageNomer) * $this->NavPageSize;
         $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize;
     } else {
         if ($this->NavPageSize > 0 && $this->NavRecordCount % $this->NavPageSize > 0) {
             $this->NavPageCount++;
         }
         //calculate total pages depend on rows count. start with 1
         if ($this->PAGEN >= 1 && $this->PAGEN <= $this->NavPageCount) {
             $this->NavPageNomer = $this->PAGEN;
         } elseif ($_SESSION[$this->SESS_PAGEN] >= 1 && $_SESSION[$this->SESS_PAGEN] <= $this->NavPageCount) {
             $this->NavPageNomer = $_SESSION[$this->SESS_PAGEN];
         } elseif ($arNavStartParams["checkOutOfRange"] !== true) {
             $this->NavPageNomer = 1;
         } else {
             return null;
         }
         //rows to skip
         $NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
         $NavLastRecordShow = $this->NavPageSize * $this->NavPageNomer;
     }
     $NavAdditionalRecords = 0;
     if (is_set($arNavStartParams, "iNavAddRecords")) {
         $NavAdditionalRecords = $arNavStartParams["iNavAddRecords"];
     }
     if (!$this->NavShowAll) {
         $query->setOffset($NavFirstRecordShow);
         $query->setLimit($NavLastRecordShow - $NavFirstRecordShow + $NavAdditionalRecords);
     }
     $res_tmp = $query->exec();
     //, $bIgnoreErrors);
     //		// Return false on sql errors (if $bIgnoreErrors == true)
     //		if ($bIgnoreErrors && ($res_tmp === false))
     //			return false;
     //		$this->result = $res_tmp->result;
     $this->DB = DB;
     if ($this->SqlTraceIndex) {
         $start_time = microtime(true);
     }
     $temp_arrray = array();
     $temp_arrray_add = array();
     $tmp_cnt = 0;
     while ($ar = $res_tmp->fetch()) {
         $tmp_cnt++;
         if (intval($NavLastRecordShow - $NavFirstRecordShow) > 0 && $tmp_cnt > $NavLastRecordShow - $NavFirstRecordShow) {
             $temp_arrray_add[] = $ar;
         } else {
             $temp_arrray[] = $ar;
         }
     }
     if ($this->SqlTraceIndex) {
         /** @noinspection PhpUndefinedVariableInspection */
         $exec_time = round(microtime(true) - $start_time, 10);
         $DB->addDebugTime($this->SqlTraceIndex, $exec_time);
         $DB->timeQuery += $exec_time;
     }
     $this->arResult = !empty($temp_arrray) ? $temp_arrray : false;
     $this->arResultAdd = !empty($temp_arrray_add) ? $temp_arrray_add : false;
     $this->nSelectedCount = $cnt;
     $this->bDescPageNumbering = $bDescPageNumbering;
     $this->bFromLimited = true;
     return null;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:98,代码来源:compatible.php

示例15: sprintf

$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';
require sprintf('%s%s', getenv('DOCUMENT_ROOT'), $includePath[$prologType]);
if ($prologType != 'prolog_js') {
    $context->show();
}
$adminList->checkListMode();
开发者ID:ASDAFF,项目名称:citfact.uservars,代码行数:31,代码来源:user_vars_list.php


注:本文中的Bitrix\Main\Entity\Query::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。