• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/icalendar.php
  • Класс: CDavICalendar
  • Вызов: CDavICalendar::__construct
public function __construct($cal, $siteId = null)
{
	if (!isset($cal) || (!is_array($cal) && !is_string($cal)))
	{
		return;
	}

	$this->component = new CDavICalendarComponent();

	if (is_string($cal))
	{
		$this->component->InitializeFromString($cal);
	}
	else
	{
		$this->component->SetType('VCALENDAR');

		$this->component->SetProperties(
			array(
				new CDavICalendarProperty('VERSION:2.0'),
				new CDavICalendarProperty('PRODID:-//davical.org//NONSGML AWL Calendar//EN'),
				//new CDavICalendarProperty('CALSCALE:GREGORIAN'),
				new CDavICalendarProperty('METHOD:PUBLISH')
			)
		);

		$arComps = array();

		$tz = CDavICalendarTimeZone::GetTimezone(CDavICalendarTimeZone::getTimeZoneId());
		if (!empty($tz))
		{
			$comptz = new CDavICalendarComponent();
			$comptz->InitializeFromString($tz);
			$arComps[] = $comptz;
		}

		$comp = new CDavICalendarComponent();
		$comp->InitializeFromArray($cal);
		$arComps[] = $comp;

		$this->component->SetComponents($arComps);
	}
}