- Модуль: intranet
- Путь к файлу: ~/bitrix/modules/intranet/classes/general/utils.php
- Класс: CIntranetUtils
- Вызов: CIntranetUtils::GetIBlockSectionChildren
static function GetIBlockSectionChildren($arSections)
{
if (!is_array($arSections))
{
$arSections = [ $arSections ];
}
$dbRes = CIBlockSection::GetList(
[ 'LEFT_MARGIN' => 'asc' ],
[ 'ID' => $arSections ],
false,
[ 'ID', 'IBLOCK_ID', 'LEFT_MARGIN', 'RIGHT_MARGIN' ]
);
$arChildren = [];
while ($arSection = $dbRes->Fetch())
{
if (
$arSection['RIGHT_MARGIN'] - $arSection['LEFT_MARGIN'] > 1
&& !in_array((int)$arSection['ID'], $arChildren, true)
)
{
$dbChildren = CIBlockSection::GetList(
[ 'id' => 'asc' ],
[
'IBLOCK_ID' => $arSection['IBLOCK_ID'],
'ACTIVE' => 'Y',
'>LEFT_BORDER' => $arSection['LEFT_MARGIN'],
'$arSection['RIGHT_MARGIN'],
],
false,
[ 'ID' ]
);
while ($arChild = $dbChildren->Fetch())
{
$arChildren[] = (int)$arChild['ID'];
}
}
}
return array_unique(array_merge($arSections, $arChildren));
}