• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/account.php
  • Класс: CDavAccount
  • Вызов: CDavAccount::GetAccountById
static function GetAccountById($account)
{
	if (!is_array($account) || count($account) != 2)
		throw new Exception("account");

	$arResult = null;

	if ($account[0] == "group")
	{
		if (CModule::IncludeModule("socialnetwork"))
		{
			if (array_key_exists($account[1], self::$accountsCache["groups"]))
				return self::$accountsCache["groups"][$account[1]];

			$dbGroup = CSocNetGroup::GetList(array(), array("ID" => $account[1], "ACTIVE" => "Y"));
			if ($arGroup = $dbGroup->Fetch())
			{
				$arResult = self::ExtractAccountFromGroup($arGroup);
				self::$accountsCache["groups"][$arGroup["ID"]] = $arResult;
			}

			return $arResult;
		}
	}

	if (array_key_exists($account[1], self::$accountsCache["users"]))
		return self::$accountsCache["users"][$account[1]];

	$params = array(
		'filter' => array("ID" => $account[1], "=ACTIVE" => "Y"),
		'select' => array("ID", "NAME", "EMAIL", "LAST_NAME", "LOGIN")
	);
	$dbUsers = BitrixMainUserTable::getList($params);
	if ($arUser = $dbUsers->Fetch())
	{
		$arResult = self::ExtractAccountFromUser($arUser);
		self::$accountsCache["users"][$arUser["ID"]] = $arResult;
		self::$accountsCacheMap[$arUser["LOGIN"]] = $arUser["ID"];
	}

	return $arResult;
}