-
-
Save ASDAFF/2a4b601ae660096d06db82e8a187c8b3 to your computer and use it in GitHub Desktop.
1С-bitrix :: Возвращает разделы и вложенные подразделы в иерархическом виде
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Возвращает разделы и вложенные подразделы в иерархическом виде */ | |
function getSectionList($filter, $select) | |
{ | |
$dbSection = CIBlockSection::GetList( | |
Array( | |
'DEPTH_LEVEL' => 'ASC', | |
'SORT' => 'ASC' | |
), | |
array_merge( | |
Array( | |
'ACTIVE' => 'Y', | |
'GLOBAL_ACTIVE' => 'Y' | |
), | |
is_array($filter) ? $filter : Array() | |
), | |
false, | |
array_merge( | |
Array( | |
'ID', | |
'IBLOCK_SECTION_ID' | |
), | |
is_array($select) ? $select : Array() | |
) | |
); | |
while( $arSection = $dbSection-> GetNext(true, false) ){ | |
$SID = $arSection['ID']; | |
$PSID = (int) $arSection['IBLOCK_SECTION_ID']; | |
$arLincs[$PSID]['CHILDS'][$SID] = $arSection; | |
$arLincs[$SID] = &$arLincs[$PSID]['CHILDS'][$SID]; | |
} | |
return array_shift($arLincs); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment