• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/Configuration/Department.php
  • Класс: BitrixImConfigurationDepartment
  • Вызов: Department::getPathFromHeadToDepartment
public function getPathFromHeadToDepartment(): array
{
	if (!Loader::includeModule('iblock'))
	{
		return [];
	}

	$departmentTree = CIntranetUtils::GetDeparmentsTree(0);
	$topDepartmentId = self::getTopDepartmentId();

	if (!$topDepartmentId || empty($departmentTree) || !$this->id)
	{
		return [];
	}

	$path[] = $this->id;
	$departmentId = $this->id;

	while ($departmentId && $departmentId != $topDepartmentId)
	{
		$departmentId = $this->getHeadDepartmentId($departmentId, $departmentTree) ?? $topDepartmentId;
		$path[] = $departmentId;
	}

	return array_reverse($path);
}