• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
  • Класс: CCalendarSect
  • Вызов: CCalendarSect::ReturnICal
static function ReturnICal($Params)
{
	$sectId = $Params['sectId'];
	$userId = (int)$Params['userId'];
	$sign = $Params['sign'];
	$type = mb_strtolower($Params['type']);
	$ownerId = (int)$Params['ownerId'];
	$bCache = false;

	$GLOBALS['APPLICATION']->RestartBuffer();

	if (!self::CheckSign($sign, $userId, $sectId))
	{
		return CCalendar::ThrowError(Loc::getMessage('EC_ACCESS_DENIED'));
	}

	$arSections = self::GetList(
		array(
			'arFilter' => array('ID' => $sectId),
			'checkPermissions' => false,
		));

	if ($arSections && $arSections[0] && $arSections[0]['EXPORT'] && $arSections[0]['EXPORT']['ALLOW'])
	{
		$arSection = $arSections[0];
		$arEvents = CCalendarEvent::GetList(
			array(
				'arFilter' => array(
					'SECTION' => $arSection['ID'],
				),
				'getUserfields' => false,
				'parseRecursion' => false,
				'fetchAttendees' => false,
				'fetchMeetings' => true,
				'userId' => $userId,
			)
		);
		$iCalEvents = self::FormatICal($arSection, $arEvents);
	}
	else
	{
		return CCalendar::ThrowError(Loc::getMessage('EC_ACCESS_DENIED'));
	}

	self::ShowICalHeaders();
	echo $iCalEvents;
	exit();
}