26 $sectionId = (int)$sectionId;
28 if ($sectionId <= 0 || $depth <= 0)
30 $section = Iblock\SectionTable::getList(array(
31 'select' => array(
'ID',
'IBLOCK_ID',
'LEFT_MARGIN',
'RIGHT_MARGIN',
'DEPTH_LEVEL'),
32 'filter' => array(
'=ID' => $sectionId)
36 $section[
'DEPTH_LEVEL'] = (int)$section[
'DEPTH_LEVEL'];
37 if ($section[
'DEPTH_LEVEL'] < $depth)
39 if ($section[
'DEPTH_LEVEL'] == $depth)
40 return (
int)$section[
'ID'];
42 $parentSection = Iblock\SectionTable::getList(array(
43 'select' => array(
'ID'),
45 '=IBLOCK_ID' => $section[
'IBLOCK_ID'],
46 '<=LEFT_MARGIN' => $section[
'LEFT_MARGIN'],
47 '>=RIGHT_MARGIN' => $section[
'RIGHT_MARGIN'],
48 '=DEPTH_LEVEL' => $depth
51 if (!empty($parentSection))
52 return (
int)$parentSection[
'ID'];