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


PHP Query::setSelect方法代码示例

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


在下文中一共展示了Query::setSelect方法的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: 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: 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

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

示例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;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:unique.php

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

示例7: 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;
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:71,代码来源:location.php

示例8: GetLocationList

 /**
  * <p>Метод возвращает набор местоположений, связанных с группами местоположений, удовлетворяющих фильтру arFilter. Метод динамичный.</p>
  *
  *
  * @param array $arrayarFilter = Array() Фильтр представляет собой ассоциативный массив, в котором
  * ключами являются названия параметров записи, а значениями -
  * условия на значения<br><br> Допустимые ключи: <ul> <li> <b>LOCATION_ID</b> - код
  * местоположения;</li> <li> <b>LOCATION_GROUP_ID</b> - код группы
  * местоположений.</li> </ul>
  *
  * @return CDBResult <p>Возвращается объект класса CDBResult, содержащий ассоциативные
  * массивы с ключами:</p> <table class="tnormal" width="100%"> <tr> <th width="15%">Ключ</th>
  * <th>Описание</th> </tr> <tr> <td>LOCATION_ID</td> <td>Код местоположения.</td> </tr> <tr>
  * <td>LOCATION_GROUP_ID</td> <td>Код группы местоположений.</td> </tr> </table> <a
  * name="examples"></a>
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * // Выберем все местоположения группы 2
  * $db_res = CSaleLocationGroup::GetLocationList(array("LOCATION_GROUP_ID"=&gt;2));
  * while ($ar_res = $db_res-&gt;Fetch())
  * {
  *    echo $ar_res["LOCATION_ID"].", ";
  * }
  * ?&gt;
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocationgroup/csalelocationgroup__getlocationlist.56a02620.php
  * @author Bitrix
  */
 public static function GetLocationList($arFilter = array())
 {
     if (CSaleLocation::isLocationProMigrated()) {
         try {
             $query = new Entity\Query(self::CONN_ENTITY_NAME);
             $fieldMap = array('D_SPIKE' => 'D_SPIKE', 'LLOCATION_ID' => 'C.ID', 'LOCATION_GROUP_ID' => 'LOCATION_GROUP_ID');
             $fieldProxy = array('LLOCATION_ID' => 'LOCATION_ID');
             $query->registerRuntimeField('D_SPIKE', array('data_type' => 'integer', 'expression' => array('distinct %s', 'LOCATION_GROUP_ID')));
             $query->registerRuntimeField('L', array('data_type' => self::LOCATION_ENTITY_NAME, 'reference' => array('=this.LOCATION_ID' => 'ref.ID'), 'join_type' => 'inner'));
             $query->registerRuntimeField('C', array('data_type' => self::LOCATION_ENTITY_NAME, 'reference' => array('LOGIC' => 'OR', array('>=ref.LEFT_MARGIN' => 'this.L.LEFT_MARGIN', '<=ref.RIGHT_MARGIN' => 'this.L.RIGHT_MARGIN'), array('=ref.ID' => 'this.L.ID')), 'join_type' => 'inner'));
             // select
             $selectFields = CSaleLocation::processSelectForGetList(array('*'), $fieldMap);
             // filter
             list($filterFields, $filterClean) = CSaleLocation::processFilterForGetList($arFilter, $fieldMap, $fieldProxy);
             $query->setSelect($selectFields);
             $query->setFilter($filterFields);
             $res = $query->exec();
             $res->addReplacedAliases(array('LLOCATION_ID' => 'LOCATION_ID'));
             return $res;
         } catch (Exception $e) {
             return new DB\ArrayResult(array());
         }
     } else {
         global $DB;
         $arSqlSearch = array();
         if (!is_array($arFilter)) {
             $filter_keys = array();
         } else {
             $filter_keys = array_keys($arFilter);
         }
         $countFieldKey = count($filter_keys);
         for ($i = 0; $i < $countFieldKey; $i++) {
             $val = $DB->ForSql($arFilter[$filter_keys[$i]]);
             if (strlen($val) <= 0) {
                 continue;
             }
             $key = $filter_keys[$i];
             if ($key[0] == "!") {
                 $key = substr($key, 1);
                 $bInvert = true;
             } else {
                 $bInvert = false;
             }
             switch (ToUpper($key)) {
                 case "LOCATION_ID":
                     $arSqlSearch[] = "LOCATION_ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                     break;
                 case "LOCATION_GROUP_ID":
                     $arSqlSearch[] = "LOCATION_GROUP_ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                     break;
             }
         }
         $strSqlSearch = "";
         $countSqlSearch = count($arSqlSearch);
         for ($i = 0; $i < $countSqlSearch; $i++) {
             $strSqlSearch .= " AND ";
             $strSqlSearch .= " (" . $arSqlSearch[$i] . ") ";
         }
         $strSql = "SELECT LOCATION_ID, LOCATION_GROUP_ID " . "FROM b_sale_location2location_group " . "WHERE 1 = 1 " . "\t" . $strSqlSearch . " ";
         $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         return $res;
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:96,代码来源:location_group.php

示例9: setSectionValue

 /**
  * Set values for fields type iblock_section.
  */
 protected function setSectionValue()
 {
     $iblockList = $this->getListByType('iblock_section');
     $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->highLoadBlockFields as &$field) {
             if ($field['USER_TYPE_ID'] != 'iblock_section') {
                 continue;
             }
             if ($field['SETTINGS']['IBLOCK_ID'] == $section['IBLOCK_ID']) {
                 $field['VALUE_LIST'][] = $section;
             }
         }
     }
 }
开发者ID:ASDAFF,项目名称:citfact.form,代码行数:20,代码来源:UserFieldBuilder.php

示例10: while

    $arResult['FILTER'] = $filterLexer->getFilter();
    $arResult['FILTER_PROPERTY'] = $filterLexer->getProperty();
    $arResult['FILTER_PRICE_TYPE'] = $filterLexer->getPriceType();
    $arResult['FILTER_VALUE'] = $filterLexer->getValue();
}
if (array_key_exists('SECTION_ID', $arResult)) {
    $queryBuilder = new Entity\Query(IBlock\SectionTable::getEntity());
    $queryBuilder->setSelect(array('*'))->setFilter(array('ID' => $arResult['SECTION_ID']));
    $sectionResult = $queryBuilder->exec();
    while ($section = $sectionResult->fetch()) {
        $arResult['SECTIONS'][$section['ID']] = $section;
    }
}
if (array_key_exists('IBLOCKS_ID', $arResult)) {
    $queryBuilder = new Entity\Query(IBlock\IblockTable::getEntity());
    $queryBuilder->setSelect(array('*'))->setFilter(array('ID' => $arResult['IBLOCKS_ID']));
    $iblockResult = $queryBuilder->exec();
    while ($iblock = $iblockResult->fetch()) {
        $arResult['IBLOCKS'][$iblock['ID']] = $iblock;
    }
}
if ($request->isPost() && $arResult['COMPONENT_ID'] == $request->getPost('COMPONENT_ID')) {
    $subscribeManager = new \Citfact\FilterSubscribe\SubscribeManager();
    $response = array();
    if ('DELETE' == $request->getPost('ACTION')) {
        $filterUserId = (int) $request->getPost('ID');
        try {
            $removeResult = $subscribeManager->removeFilterUser($filterUserId);
            $response['success'] = $removeResult->isSuccess();
            $response['errors'] = $removeResult->getErrorMessages();
        } catch (\Exception $e) {
开发者ID:ASDAFF,项目名称:citfact.filter.subscribe,代码行数:31,代码来源:component.php

示例11: array

if (!Loader::includeModule('citfact.uservars')) {
    $applicationOld->authForm(Loc::getMessage('ACCESS_DENIED'));
}
$request = $application->getContext()->getRequest();
$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_GROUP'), 'TITLE' => Loc::getMessage('USER_VARS_ADD_GROUP'), 'LINK' => 'user_vars_group_edit.php?lang=' . LANGUAGE_ID, 'ICON' => 'btn_new');
$headers = array(array('id' => 'ID', 'content' => 'ID', 'sort' => 'ID', 'default' => true), array('id' => 'NAME', 'content' => Loc::getMessage('USER_VARS_TABLE_NAME'), 'sort' => 'NAME', 'default' => true), array('id' => 'CODE', 'content' => Loc::getMessage('USER_VARS_TABLE_CODE'), 'sort' => 'CODE', 'default' => true));
$tableId = 'tbl_user_vars';
$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\VarsGroupTable::getEntity());
$queryBuilder->setSelect(array('ID', 'NAME', 'CODE'));
$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' => 'list', 'TEXT' => Loc::getMessage('USER_VARS_ACTION_LIST'), 'ACTION' => $adminList->actionRedirect('user_vars_list.php?lang=' . LANGUAGE_ID . '&GROUP_ID=' . $item['ID']));
    $actions[] = array('ICON' => 'edit', 'TEXT' => Loc::GetMessage('USER_VARS_ACTION_EDIT_GROUP'), 'ACTION' => $adminList->actionRedirect('user_vars_group_edit.php?ID=' . $item['ID']));
    $actions[] = array('ICON' => 'delete', 'TEXT' => Loc::getMessage('USER_VARS_ACTION_DELETE_GROUP'), 'ACTION' => "if(confirm('" . Loc::getMessage('USER_VARS_DELETE_GROUP_CONFIRM') . "')) " . $adminList->actionRedirect('user_vars_group_edit.php?action=delete&ID=' . $item['ID'] . '&' . bitrix_sessid_get()));
    $row->addActions($actions);
}
$prologType = $request->getQuery('mode') == 'list' ? 'prolog_js' : 'prolog';
开发者ID:ASDAFF,项目名称:citfact.uservars,代码行数:31,代码来源:user_vars.php

示例12: 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');
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:23,代码来源:tree.php

示例13: sprintf

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

示例14: delete

 public static function delete($primary)
 {
     // get old data
     $oldData = static::getByPrimary($primary)->fetch();
     // get file fields
     $file_fields = array();
     $fields = $GLOBALS['USER_FIELD_MANAGER']->getUserFields('HLBLOCK_' . $oldData['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($oldData);
         $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])) {
                     \CFile::delete($row[$file_field]);
                 }
             }
         }
     }
     foreach ($fields as $name => $field) {
         $GLOBALS['DB']->query("DELETE FROM b_user_field_lang WHERE USER_FIELD_ID = " . $field['ID'], false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
         $GLOBALS['DB']->query("DELETE FROM b_user_field WHERE ID = " . $field['ID'], false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
     }
     // clear uf cache
     global $CACHE_MANAGER;
     if (CACHED_b_user_field !== false) {
         $CACHE_MANAGER->CleanDir("b_user_field");
     }
     // remove row
     $result = parent::delete($primary);
     // remove table in db
     $dbtype = strtolower($GLOBALS['DB']->type);
     $connection = Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     if ($dbtype == 'oracle') {
         $GLOBALS['DB']->query('DROP TABLE ' . $sqlHelper->quote($oldData['TABLE_NAME']) . ' CASCADE CONSTRAINTS');
         $GLOBALS['DB']->query('DROP SEQUENCE sq_' . $oldData['TABLE_NAME']);
     } else {
         $GLOBALS['DB']->query('DROP TABLE ' . $sqlHelper->quote($oldData['TABLE_NAME']));
     }
     if (!empty($fields)) {
         $GLOBALS['DB']->query("DROP SEQUENCE SQ_B_UTM_" . 'HLBLOCK_' . $oldData['ID'], true);
         $GLOBALS['DB']->query("DROP TABLE b_uts_" . strtolower('HLBLOCK_' . $oldData['ID']), false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
         $GLOBALS['DB']->query("DROP TABLE b_utm_" . strtolower('HLBLOCK_' . $oldData['ID']), false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
     }
     return $result;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:62,代码来源:highloadblock.php

示例15: CDBResult

<?php

if (!CModule::IncludeModule("highloadblock")) {
    return;
}
use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;
$Set_ID = $_SESSION["WF_IBL_SETTINGS_ID"];
unset($_SESSION["WF_IBL_SETTINGS_ID"]);
//Creating default values
$hldata = HL\HighloadBlockTable::getById($Set_ID)->fetch();
$hlentity = HL\HighloadBlockTable::compileEntity($hldata);
$hlHandler = $hlentity->getDataClass();
$getList = new Entity\Query($hlHandler);
$getList->setSelect(array('*'));
$getList->setOrder(array("ID" => "ASC"));
$getList->setFilter(array("ID" => 1));
$result = $getList->exec();
$result = new CDBResult($result);
if ($row = $result->Fetch()) {
} else {
    $arData = array("UF_THEME" => "default", "UF_SHADOWS" => "default", "UF_BUTTONS" => "coral", "UF_BG" => "default");
    $hlHandler::add($arData);
}
$Brand_ID = $_SESSION["WF_IBL_BRANDS_ID"];
unset($_SESSION["WF_IBL_BRANDS_ID"]);
$hldata = HL\HighloadBlockTable::getById($Brand_ID)->fetch();
$hlentity = HL\HighloadBlockTable::compileEntity($hldata);
$hlHandler = $hlentity->getDataClass();
$sort = 100;
$arBrandsUt = array("1 Marka" => "ref_files/7e44ec9828b17ace0d8f75a349b8de43.png", "Apollo" => "ref_files/61441e895fdde98034964c624e295f90.png", "AquaVita" => "ref_files/9d8f6c21dbd87f76b88a8b35e3cd0572.png", "BAS" => "ref_files/7eaea2afe6729ef29a25aeb82aba2513.png", "Cersanit" => "ref_files/9fe61dfbd7454a7ee27e41e0066fd3ba.png", "EAGO" => "ref_files/7d6f158e6fba7b90963c489c218fb8ef.png", "Kolpa-san" => "ref_files/a1906e21f88ebf48c6550117fb77b69f.png", "Loranto" => "ref_files/794eda4bc38c0decfb66455b436919e2.png", "RELISAN" => "ref_files/a3a02d848afdf90036f1def792d5adaf.png", "Roca" => "ref_files/bddd67008a780c90950540be078685a0.png", "Triton" => "ref_files/f75713924bd7964c999de3fbea43c2de.png", "Vayer" => "ref_files/5841ebf40c33bc9858245adfe7336427.png", "IDDIS" => "ref_files/85f24f3d3a9da494f411baa869b9df69.png", "Grohe" => "ref_files/6a2820fa128435a333ca473d06a78895.png", "Hansgrohe" => "ref_files/82499c22bd8a60b4ced944606973a91a.png");
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:hlfill.php


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