• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/department.php
  • Класс: BitrixImDepartment
  • Вызов: Department::getEmployeesList
static function getEmployeesList($ids = null, $options = array())
{
	if (!BitrixMainLoader::includeModule('intranet'))
	{
		return Array();
	}

	$structure = CIntranetUtils::GetStructure();
	if (!$structure || !isset($structure['DATA']))
	{
		return Array();
	}

	$result = Array();
	foreach ($structure['DATA'] as $department)
	{
		if (is_array($ids) && !in_array($department['ID'], $ids))
			continue;

		if (!is_array($department['EMPLOYEES']))
		{
			$result[$department['ID']] = Array();
			continue;
		}

		foreach ($department['EMPLOYEES'] as $key => $value)
		{
			$department['EMPLOYEES'][$key] = (int)$value;
		}

		$result[$department['ID']] = $department['EMPLOYEES'];
	}

	return $result;
}