• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/repository/departmentrepository.php
  • Класс: BitrixTimemanRepositoryDepartmentRepository
  • Вызов: DepartmentRepository::buildUserDepartmentsPriorityTrees
public function buildUserDepartmentsPriorityTrees($userId)
{
	$result = [];
	$userDepartmentsIds = $this->getDirectParentIdsByUserId($userId); // might be more than one
	foreach ($userDepartmentsIds as $departmentId)
	{
		$parentDepartmentsIds = $this->getAllParentDepartmentsIds($departmentId);

		$result[] = array_merge(
			['U' . $userId],
			['DR' . $departmentId],
			array_map(function ($id) {
				return 'DR' . $id;
			}, array_reverse($parentDepartmentsIds))
		);
	}
	return $result;
}