• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar.php
  • Класс: CCalendar
  • Вызов: CCalendar::SearchAttendees
static function SearchAttendees($name = '', $Params = [])
{
	if (!isset($Params['arFoundUsers']))
	{
		$Params['arFoundUsers'] = CSocNetUser::SearchUser($name);
	}

	$arUsers = [];
	if (!is_array($Params['arFoundUsers']) || empty($Params['arFoundUsers']))
	{
		if ($Params['addExternal'] !== false)
		{
			if (check_email($name, true))
			{
				$arUsers[] = array(
					'type' => 'ext',
					'email' => htmlspecialcharsex($name),
				);
			}
			else
			{
				$arUsers[] = array(
					'type' => 'ext',
					'name' => htmlspecialcharsex($name),
				);
			}
		}
	}
	else
	{
		foreach ($Params['arFoundUsers'] as $userId => $userName)
		{
			$userId = (int)$userId;

			$r = CUser::GetList('id', 'asc', array("ID_EQUAL_EXACT" => $userId, "ACTIVE" => "Y"));

			if (!$User = $r->Fetch())
			{
				continue;
			}
			$name = trim($User['NAME'].' '.$User['LAST_NAME']);
			if (!$name)
			{
				$name = trim($User['LOGIN']);
			}

			$arUsers[] = array(
				'type' => 'int',
				'id' => $userId,
				'name' => $name,
				'status' => 'Q',
				'busy' => 'free',
			);
		}
	}
	return $arUsers;
}