- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblocksection.php
- Класс: CAllIBlockSection
- Вызов: CAllIBlockSection::GetMixedList
static function GetMixedList($arOrder=array("SORT"=>"ASC"), $arFilter=array(), $bIncCnt = false, $arSelectedFields = false)
{
$arResult = [];
if (!is_array($arOrder))
{
$arOrder = ['SORT' => 'ASC'];
}
if (!is_array($arSelectedFields))
{
$arSelectedFields = [];
};
$emptySelect = empty($arSelectedFields) || in_array('*', $arSelectedFields);
if (!empty($arFilter))
{
$arFilter = array_change_key_case($arFilter, CASE_UPPER);
}
$arFilter = static::normalizeMixedFilter($arFilter);
if (static::checkLoadSections($arFilter))
{
$arSectionFilter = $arFilter;
$sectionFields = [
'ID' => true,
'CODE' => true,
'XML_ID' => true,
'EXTERNAL_ID' => true,
'IBLOCK_ID' => true,
'IBLOCK_SECTION_ID' => true,
'TIMESTAMP_X' => true,
'TIMESTAMP_X_UNIX' => true,
'SORT' => true,
'NAME' => true,
'ACTIVE' => true,
'GLOBAL_ACTIVE' => true,
'PICTURE' => true,
'DESCRIPTION' => true,
'DESCRIPTION_TYPE' => true,
'LEFT_MARGIN' => true,
'RIGHT_MARGIN' => true,
'DEPTH_LEVEL' => true,
'SEARCHABLE_CONTENT' => true,
'MODIFIED_BY' => true,
'DATE_CREATE' => true,
'DATE_CREATE_UNIX' => true,
'CREATED_BY' => true,
'DETAIL_PICTURE' => true,
'TMP_ID' => true,
'LIST_PAGE_URL' => true,
'SECTION_PAGE_URL' => true,
'IBLOCK_TYPE_ID' => true,
'IBLOCK_CODE' => true,
'IBLOCK_EXTERNAL_ID' => true,
'SOCNET_GROUP_ID' => true,
];
if ($emptySelect)
{
$sectionSelect = array_keys($sectionFields);
}
else
{
$sectionSelect = [];
foreach ($arSelectedFields as $field)
{
if (!isset($sectionFields[$field]))
{
continue;
}
$sectionSelect[$field] = $field;
}
unset($field);
if (!empty($sectionSelect))
{
$sectionSelect = array_values($sectionSelect);
}
}
$obSection = new CIBlockSection;
$rsSection = $obSection->GetList($arOrder, $arSectionFilter, $bIncCnt, $sectionSelect);
while ($arSection = $rsSection->Fetch())
{
$arSection['TYPE'] = IblockGridRowType::SECTION;
$arResult[] = $arSection;
}
unset($arSection);
unset($rsSection);
unset($obSection);
}
if (static::checkLoadElements($arFilter))
{
$arElementFilter = $arFilter;
$arElementFilter['SHOW_NEW'] = ($arFilter['SHOW_NEW'] ?? 'Y') === 'N' ? 'N' : 'Y';
if ($emptySelect)
{
$arSelectedFields = ["*"];
}
$obElement = new CIBlockElement;
$rsElement = $obElement->GetList($arOrder, $arElementFilter, false, false, $arSelectedFields);
while ($arElement = $rsElement->Fetch())
{
$arElement['TYPE'] = IblockGridRowType::ELEMENT;
$arResult[] = $arElement;
}
unset($arElement);
unset($rsElement);
unset($obElement);
}
$rsResult = new CDBResult;
$rsResult->InitFromArray($arResult);
unset($arResult);
return $rsResult;
}