Last active
February 26, 2019 19:21
-
-
Save di7spider/4dd50d8b48a7a60e09ee to your computer and use it in GitHub Desktop.
1С-bitrix :: Возвращает разделы и вложенные подразделы в иерархическом виде
This file contains hidden or 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 $arLincs[0]; | |
} | |
?> |
Author
di7spider
commented
Sep 21, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment