34 if (!Loader::includeModule(
'iblock'))
39 $departmentTree = \CIntranetUtils::GetDeparmentsTree(0);
42 if (!$topDepartmentId || empty($departmentTree) || !$this->
id)
48 $departmentId = $this->id;
50 while ($departmentId && $departmentId != $topDepartmentId)
52 $departmentId = $this->
getHeadDepartmentId($departmentId, $departmentTree) ?? $topDepartmentId;
53 $path[] = $departmentId;
56 return array_reverse($path);
106 if (!Loader::includeModule(
"iblock"))
111 $departmentId =
false;
112 $res = \CIBlock::GetList([], [
"CODE" =>
"departments"]);
113 if ($iblock = $res->Fetch())
115 $res = \CIBlockSection::GetList(
119 "IBLOCK_ID" => $iblock[
"ID"]
122 if ($department = $res->Fetch())
124 $departmentId = (int)$department[
'ID'];
128 return $departmentId;