本文整理汇总了PHP中CIBlockParameters::GetElementSortFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockParameters::GetElementSortFields方法的具体用法?PHP CIBlockParameters::GetElementSortFields怎么用?PHP CIBlockParameters::GetElementSortFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockParameters
的用法示例。
在下文中一共展示了CIBlockParameters::GetElementSortFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
}
Loc::loadMessages(__FILE__);
try {
ComponentParameters::includeModules(['iblock']);
$iblockTypes = CIBlockParameters::GetIBlockTypes([0 => '']);
$iblocks = [0 => ''];
$sections = [0 => ''];
$elementProperties = [];
if (isset($arCurrentValues['IBLOCK_TYPE']) && strlen($arCurrentValues['IBLOCK_TYPE'])) {
$rsIblocks = Iblock\IblockTable::getList(['order' => ['SORT' => 'ASC', 'NAME' => 'ASC'], 'filter' => ['IBLOCK_TYPE_ID' => $arCurrentValues['IBLOCK_TYPE'], 'ACTIVE' => 'Y'], 'select' => ['ID', 'NAME']]);
while ($iblock = $rsIblocks->fetch()) {
$iblocks[$iblock['ID']] = $iblock['NAME'];
}
}
if (isset($arCurrentValues['IBLOCK_ID']) && strlen($arCurrentValues['IBLOCK_ID'])) {
$rsSections = Iblock\SectionTable::getList(['order' => ['SORT' => 'ASC', 'NAME' => 'ASC'], 'filter' => ['IBLOCK_ID' => $arCurrentValues['IBLOCK_ID'], 'ACTIVE' => 'Y'], 'select' => ['ID', 'NAME']]);
while ($arSection = $rsSections->fetch()) {
$sections[$arSection['ID']] = $arSection['NAME'];
}
$rsProperties = CIBlockProperty::GetList(['sort' => 'asc', 'name' => 'asc'], ['ACTIVE' => 'Y', 'IBLOCK_ID' => $arCurrentValues['IBLOCK_ID']]);
while ($property = $rsProperties->Fetch()) {
$elementProperties[$property['CODE']] = '[' . $property['CODE'] . '] ' . $property['NAME'];
}
}
$paramElementsFields = CIBlockParameters::GetFieldCode(Loc::getMessage('ELEMENTS_LIST_FIELDS'), 'BASE');
$sortOrders = ['ASC' => Loc::getMessage('ELEMENTS_LIST_SORT_ORDER_ASC'), 'DESC' => Loc::getMessage('ELEMENTS_LIST_SORT_ORDER_DESC')];
$arComponentParameters = ['GROUPS' => ['AJAX' => ['NAME' => Loc::getMessage('ELEMENTS_LIST_GROUP_AJAX')], 'SEO' => ['NAME' => Loc::getMessage('ELEMENTS_LIST_GROUP_SEO')], 'OTHERS' => ['NAME' => Loc::getMessage('ELEMENTS_LIST_GROUP_OTHERS')]], 'PARAMETERS' => ['IBLOCK_TYPE' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_IBLOCK_TYPE'), 'TYPE' => 'LIST', 'VALUES' => $iblockTypes, 'DEFAULT' => '', 'REFRESH' => 'Y'], 'IBLOCK_ID' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_IBLOCK_ID'), 'TYPE' => 'LIST', 'VALUES' => $iblocks, 'REFRESH' => 'Y'], 'SECTION_ID' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SECTION_ID'), 'TYPE' => 'LIST', 'VALUES' => $sections], 'SECTION_CODE' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SECTION_CODE'), 'TYPE' => 'STRING'], 'INCLUDE_SUBSECTIONS' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_INCLUDE_SUBSECTIONS'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'], 'SORT_BY_1' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SORT_BY_1'), 'TYPE' => 'LIST', 'VALUES' => CIBlockParameters::GetElementSortFields()], 'SORT_ORDER_1' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SORT_ORDER_1'), 'TYPE' => 'LIST', 'VALUES' => $sortOrders], 'SORT_BY_2' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SORT_BY_2'), 'TYPE' => 'LIST', 'VALUES' => CIBlockParameters::GetElementSortFields()], 'SORT_ORDER_2' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SORT_ORDER_2'), 'TYPE' => 'LIST', 'VALUES' => $sortOrders], 'SELECT_FIELDS' => $paramElementsFields, 'SELECT_PROPS' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_PROPERTIES'), 'TYPE' => 'LIST', 'MULTIPLE' => 'Y', 'VALUES' => $elementProperties, 'ADDITIONAL_VALUES' => 'Y'], 'RESULT_PROCESSING_MODE' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_RESULT_PROCESSING_MODE'), 'TYPE' => 'LIST', 'VALUES' => ['DEFAULT' => Loc::getMessage('ELEMENTS_LIST_RESULT_PROCESSING_MODE_DEFAULT'), 'EXTENDED' => Loc::getMessage('ELEMENTS_LIST_RESULT_PROCESSING_MODE_EXTENDED')]], 'EX_FILTER_NAME' => ['PARENT' => 'BASE', 'NAME' => Loc::getMessage('ELEMENTS_LIST_EX_FILTER_NAME'), 'TYPE' => 'STRING', 'DEFAULT' => ''], 'PAGER_SAVE_SESSION' => ['PARENT' => 'PAGER_SETTINGS', 'NAME' => Loc::getMessage('ELEMENTS_LIST_NAV_SAVE_SESSION'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'], 'ELEMENTS_COUNT' => ['PARENT' => 'PAGER_SETTINGS', 'NAME' => Loc::getMessage('ELEMENTS_LIST_ELEMENTS_COUNT'), 'TYPE' => 'STRING', 'DEFAULT' => '10'], 'USE_AJAX' => ['PARENT' => 'AJAX', 'NAME' => Loc::getMessage('ELEMENTS_LIST_USE_AJAX'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y'], 'AJAX_TYPE' => ['PARENT' => 'AJAX', 'NAME' => Loc::getMessage('ELEMENTS_LIST_AJAX_TYPE'), 'TYPE' => 'LIST', 'VALUES' => ['DEFAULT' => Loc::getMessage('ELEMENTS_LIST_AJAX_TYPE_DEFAULT'), 'JSON' => Loc::getMessage('ELEMENTS_LIST_AJAX_TYPE_JSON')]], 'AJAX_HEAD_RELOAD' => ['PARENT' => 'AJAX', 'NAME' => Loc::getMessage('ELEMENTS_LIST_AJAX_HEAD_RELOAD'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'], 'AJAX_TEMPLATE_PAGE' => ['PARENT' => 'AJAX', 'NAME' => Loc::getMessage('ELEMENTS_LIST_AJAX_TEMPLATE_PAGE'), 'TYPE' => 'STRING', 'DEFAULT' => ''], 'AJAX_COMPONENT_ID' => ['PARENT' => 'AJAX', 'NAME' => Loc::getMessage('ELEMENTS_LIST_AJAX_COMPONENT_ID'), 'TYPE' => 'STRING', 'DEFAULT' => ''], 'SET_SEO_TAGS' => ['PARENT' => 'SEO', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SET_SEO_TAGS'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y'], 'ADD_SECTIONS_CHAIN' => ['PARENT' => 'SEO', 'NAME' => Loc::getMessage('ELEMENTS_LIST_ADD_SECTIONS_CHAIN'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y'], 'SET_404' => ['PARENT' => 'OTHERS', 'NAME' => Loc::getMessage('ELEMENTS_LIST_SET_404'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'], 'CHECK_PERMISSIONS' => ['PARENT' => 'OTHERS', 'NAME' => Loc::getMessage('ELEMENTS_LIST_CHECK_PERMISSIONS'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y'], 'DATE_FORMAT' => CIBlockParameters::GetDateFormat(Loc::getMessage('ELEMENTS_LIST_DATE_FORMAT'), 'OTHERS'), 'CACHE_GROUPS' => ['PARENT' => 'CACHE_SETTINGS', 'NAME' => Loc::getMessage('ELEMENTS_LIST_CACHE_GROUPS'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'], 'CACHE_TIME' => ['DEFAULT' => 360000]]];
CIBlockParameters::AddPagerSettings($arComponentParameters, Loc::getMessage('ELEMENTS_LIST_NAV_TITLE'), true, true);
} catch (Exception $e) {
ShowError($e->getMessage());
}
示例2: is_array
$arOffers = CIBlockPriceTools::GetOffersIBlock($arCurrentValues["IBLOCK_ID"]);
$OFFERS_IBLOCK_ID = is_array($arOffers)? $arOffers["OFFERS_IBLOCK_ID"]: 0;
$arProperty_Offers = array();
if($OFFERS_IBLOCK_ID)
{
$rsProp = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), Array("IBLOCK_ID"=>$OFFERS_IBLOCK_ID, "ACTIVE"=>"Y"));
while($arr=$rsProp->Fetch())
{
if($arr["PROPERTY_TYPE"] != "F")
$arProperty_Offers[$arr["CODE"]] = "[".$arr["CODE"]."] ".$arr["NAME"];
}
}
$arSort = CIBlockParameters::GetElementSortFields(
array('SHOWS', 'SORT', 'TIMESTAMP_X', 'NAME', 'ID', 'ACTIVE_FROM', 'ACTIVE_TO'),
array('KEY_LOWERCASE' => 'Y')
);
$arPrice = array();
if ($boolCatalog)
{
$arSort = array_merge($arSort, CCatalogIBlockParameters::GetCatalogSortFields());
$rsPrice=CCatalogGroup::GetListEx(
array("SORT" => "ASC"),
array(),
false,
false,
array('ID', 'NAME', 'NAME_LANG')
);
while($arr=$rsPrice->Fetch())
$arPrice[$arr["NAME"]] = "[".$arr["NAME"]."] ".$arr["NAME_LANG"];
示例3: while
}
if ($currentIblockId) {
//select section properties
$filter = ['ENTITY_ID' => 'IBLOCK_' . $currentIblockId . '_SECTION'];
$rs = CUserTypeEntity::GetList([], $filter);
while ($field = $rs->Fetch()) {
$sectionProperties[$field['FIELD_NAME']] = $field['FIELD_NAME'];
}
//select element properties
$filter = ['ACTIVE' => 'Y', 'IBLOCK_ID' => $currentIblockId];
$rsProp = CIBlockProperty::GetList([], $filter);
while ($item = $rsProp->Fetch()) {
$elementProperties[$item['CODE']] = '[' . $item['CODE'] . '] ' . $item['NAME'];
}
}
$arComponentParameters = array('GROUPS' => array('ELEMENTS_SORTING' => array('NAME' => 'Сортировка элементов', 'SORT' => 150), 'SECTION_SORTING' => array('NAME' => 'Сортировка разделов', 'SORT' => 160)), 'PARAMETERS' => array('IBLOCK_TYPE' => array('PARENT' => 'BASE', 'NAME' => 'Тип инфоблоков', 'TYPE' => 'LIST', 'VALUES' => $iblockTypes, 'REFRESH' => 'Y'), 'IBLOCK_CODE' => array('PARENT' => 'BASE', 'NAME' => 'Код инфоблока', 'TYPE' => 'LIST', 'VALUES' => $iblocks, 'REFRESH' => 'Y'), 'ELEMENTS_COUNT' => array('PARENT' => 'BASE', 'NAME' => 'Количество записей в списке', 'TYPE' => 'STRING', 'DEFAULT' => '20'), 'SELECT_SECTIONS' => array('PARENT' => 'BASE', 'NAME' => 'Запрашивать разделы инфоблока', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y'), 'ELEMENT_SORT_BY1' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Поле для 1-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'ACTIVE_FROM', 'VALUES' => CIBlockParameters::GetElementSortFields(), 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_SORT_ORDER1' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Направление 1-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'DESC', 'VALUES' => $arSorts, 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_SORT_BY2' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Поле для 2-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'SORT', 'VALUES' => CIBlockParameters::GetElementSortFields(), 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_SORT_ORDER2' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Направление 2-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'ASC', 'VALUES' => $arSorts, 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_SORT_BY3' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Поле для 3-ей сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'SORT', 'VALUES' => CIBlockParameters::GetElementSortFields(), 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_SORT_ORDER3' => array('PARENT' => 'ELEMENTS_SORTING', 'NAME' => 'Направление 3-ей сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'ASC', 'VALUES' => $arSorts, 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_FIELDS' => array('PARENT' => 'DATA_SOURCE', 'NAME' => 'Поля элементов', 'TYPE' => 'LIST', 'MULTIPLE' => 'Y', 'SIZE' => 8, 'VALUES' => ['NAME' => 'Название', 'CODE' => 'Символьный код', 'DETAIL_PAGE_URL' => 'Ссылка на детальную страницу', 'ACTIVE_FROM' => 'Начало активности', 'ACTIVE_TO' => 'Окончание активности', 'PREVIEW_TEXT' => 'Описание для анонса', 'PREVIEW_PICTURE' => 'Картинка для анонса', 'DETAIL_TEXT' => 'Детальное описание', 'DETAIL_PICTURE' => 'Детальная картинка', 'IBLOCK_SECTION_ID' => 'ID раздела', 'TAGS' => 'Теги', 'SORT' => 'Индекс сортировки'], 'ADDITIONAL_VALUES' => 'Y'), 'ELEMENT_PROPERTIES' => array('PARENT' => 'DATA_SOURCE', 'NAME' => 'Свойства элементов', 'TYPE' => 'LIST', 'MULTIPLE' => 'Y', 'SIZE' => 8, 'VALUES' => $elementProperties, 'ADDITIONAL_VALUES' => 'Y'), 'FILTER_NAME' => array('PARENT' => 'ADDITIONAL_SETTINGS', 'NAME' => 'Название PHP-переменной фильтра элементов инфоблока', 'TYPE' => 'STRING', 'DEFAULT' => ''), 'SHOW_PANEL_BUTTONS' => array('PARENT' => 'ADDITIONAL_SETTINGS', 'NAME' => 'Выводить кнопки управления контентом в режиме редактирования в публичной части', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y'), 'CUSTOM_DATE_FORMAT' => array('PARENT' => 'ADDITIONAL_SETTINGS', 'NAME' => 'Особый формат даты', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y'), 'CACHE_TIME' => array('DEFAULT' => 36000000), 'CACHE_GROUPS' => array('PARENT' => 'CACHE_SETTINGS', 'NAME' => 'Учитывать права доступа', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y')));
$arComponentParameters['PARAMETERS']['SELECT_BY_SECTION'] = array('PARENT' => 'BASE', 'NAME' => 'Выбирать элементы по разделу', 'TYPE' => 'LIST', 'VALUES' => ['NO' => 'нет', 'CODE' => 'по коду раздела', 'ID' => 'по id раздела'], 'DEFAULT' => 'NO', 'REFRESH' => 'Y');
if ($arCurrentValues['SELECT_BY_SECTION'] == 'ID') {
$arComponentParameters['PARAMETERS']['SECTION_ID'] = array('PARENT' => 'BASE', 'NAME' => 'ID раздела', 'TYPE' => 'STRING', 'DEFAULT' => '');
} else {
if ($arCurrentValues['SELECT_BY_SECTION'] == 'CODE') {
$arComponentParameters['PARAMETERS']['SECTION_CODE'] = array('PARENT' => 'BASE', 'NAME' => 'Код раздела', 'TYPE' => 'STRING', 'DEFAULT' => '');
}
}
if (in_array($arCurrentValues['SELECT_BY_SECTION'], ['ID', 'CODE'])) {
$arComponentParameters['PARAMETERS']['INCLUDE_SUBSECTIONS'] = array('PARENT' => 'BASE', 'NAME' => 'Выбирать элементы из всех подразделов выбранного раздела', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'Y');
$arComponentParameters['PARAMETERS']['SELECT_SECTIONS_TREE'] = array('PARENT' => 'BASE', 'NAME' => 'Выбирать всё дерево разделов выбранного раздела', 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N');
CIBlockParameters::Add404Settings($arComponentParameters, $arCurrentValues);
}
if ($arCurrentValues['SELECT_SECTIONS'] == 'Y') {
$arComponentParameters['PARAMETERS'] = array_merge($arComponentParameters['PARAMETERS'], array('SECTION_SORT_BY1' => array('PARENT' => 'SECTION_SORTING', 'NAME' => 'Поле для 1-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'SORT', 'VALUES' => CIBlockParameters::GetSectionSortFields(), 'ADDITIONAL_VALUES' => 'Y'), 'SECTION_SORT_ORDER1' => array('PARENT' => 'SECTION_SORTING', 'NAME' => 'Направление 1-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'DESC', 'VALUES' => $arSorts, 'ADDITIONAL_VALUES' => 'Y'), 'SECTION_SORT_BY2' => array('PARENT' => 'SECTION_SORTING', 'NAME' => 'Поле для 2-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'ID', 'VALUES' => CIBlockParameters::GetSectionSortFields(), 'ADDITIONAL_VALUES' => 'Y'), 'SECTION_SORT_ORDER2' => array('PARENT' => 'SECTION_SORTING', 'NAME' => 'Направление 2-ой сортировки', 'TYPE' => 'LIST', 'DEFAULT' => 'ASC', 'VALUES' => $arSorts, 'ADDITIONAL_VALUES' => 'Y'), 'SECTION_FIELDS' => array('PARENT' => 'DATA_SOURCE', 'NAME' => 'Поля разделов', 'TYPE' => 'LIST', 'MULTIPLE' => 'Y', 'SIZE' => 3, 'VALUES' => ['NAME' => 'Название', 'CODE' => 'Символьный код', 'IBLOCK_SECTION_ID' => 'ID родительского раздела', 'DESCRIPTION' => 'Описание', 'PICTURE' => 'Изображение'], 'ADDITIONAL_VALUES' => 'Y'), 'SECTION_PROPERTIES' => array('PARENT' => 'DATA_SOURCE', 'NAME' => 'Свойства разделов', 'TYPE' => 'LIST', 'MULTIPLE' => 'Y', 'VALUES' => $sectionProperties, 'ADDITIONAL_VALUES' => 'Y')));