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

	$departmentId = false;
	$res = CIBlock::GetList([], ["CODE" => "departments"]);
	if ($iblock = $res->Fetch())
	{
		$res = CIBlockSection::GetList(
			[],
			[
				"SECTION_ID" => 0,
				"IBLOCK_ID" => $iblock["ID"]
			]
		);
		if ($department = $res->Fetch())
		{
			$departmentId = (int)$department['ID'];
		}
	}

	return $departmentId;
}