• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/event_calendar.php
  • Класс: CEventCalendar
  • Вызов: CEventCalendar::HandleSPUserCals
function HandleSPUserCals($name)
{
	$arFoundUsers = CSocNetUser::SearchUser($name);
	if (!is_array($arFoundUsers) || count($arFoundUsers) <= 0)
		return false;

	$arUserIds = $this->GetTrackingUsers();
	$arSPRes = array();
	foreach ($arFoundUsers as $userId => $userName)
	{
		$userId = intval($userId);
		if ($userId <= 0 || in_array($userId, $arUserIds) || $userId == $this->userId)
			continue;

		if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $userId, "calendar") ||
			!CSocNetFeaturesPerms::CanPerformOperation($this->userId, SONET_ENTITY_USER, $userId, "calendar", 'view'))
			continue;

		$arUserIds[] = $userId;
		// Get calendars
		$sectionId = intval($this->GetSectionIDByOwnerId($userId, 'USER', $this->userIblockId));
		if ($sectionId > 0)
		{
			$arCals_ = $this->GetCalendars(array(
				'bOwner' => true,
				'ownerType' => 'USER',
				'ownerId' => $userId,
				'iblockId' => $this->userIblockId,
				'sectionId' => $this->GetSectionIDByOwnerId($userId, 'USER', $this->userIblockId)
			));
		}
		else
		{
			$arCals_ = array();
		}
		$count = count($arCals_);
		$userName = htmlspecialcharsback($userName);
		if ($count > 0)
			$arCals_ = $this->ExtendCalArray($arCals_, array('GROUP_TITLE' => GetMessage('EC_SUPERPOSE_GR_USER'), "NAME" => $userName));

		// Save selected users....
		$this->SetTrackingUsers($arUserIds);

		$arSPRes[] = array(
			'ID' => $this->userIblockId,
			'USER_ID' => $userId,
			'NAME' => $userName,
			'ITEMS' => $arCals_
		);
	}
	if (count($arSPRes))
		return $arSPRes;
	else
		return false;
}