• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/calendarhandler.php
  • Класс: CDavCalendarHandler
  • Вызов: CDavCalendarHandler::GetCalendarProperties
public function GetCalendarProperties(CDavResource $resource, $siteId, $account = null, $arPath = null, $options = 0)
	{
		$resource->AddProperty('resourcetype',
			array(
				array('collection', ''),
				//array('vevent-collection', '', CDavGroupDav::GROUPDAV),
				array('calendar', '', CDavGroupDav::CALDAV),
			)
		);
		$resource->AddProperty('component-set', 'VEVENT', CDavGroupDav::GROUPDAV);
		$resource->AddProperty('supported-calendar-component-set',
			array(
				array('comp', array('name' => 'VCALENDAR'), CDavGroupDav::CALDAV),
				array('comp', array('name' => 'VTIMEZONE'), CDavGroupDav::CALDAV),
				array('comp', array('name' => 'VEVENT'), CDavGroupDav::CALDAV)
			),
			CDavGroupDav::CALDAV
		);
		$resource->AddProperty('supported-report-set',
			array('supported-report',
				array(CDavResource::MakeProp('report', array(CDavResource::MakeProp('calendar-multiget', '', CDavGroupDav::CALDAV))))
			)
		);
		$resource->AddProperty('supported-calendar-data',
			array(
				array('calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0'), CDavGroupDav::CALDAV),
				array('calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'), CDavGroupDav::CALDAV)
			),
			CDavGroupDav::CALDAV
		);

		$calendarId = $this->GetCalendarId($siteId, $account, $arPath);
		$arCalendarList = CEventCalendar::GetCalendarList($calendarId);
		if (count($arCalendarList) > 0)
		{
			$resource->AddProperty('displayname', $arCalendarList[0]["NAME"], CDavGroupDav::DAV);
			$resource->AddProperty('calendar-description', $arCalendarList[0]["DESCRIPTION"], CDavGroupDav::CALDAV);
			$resource->AddProperty('calendar-color', $arCalendarList[0]["COLOR"], CDavGroupDav::ICAL);
		}

		$request = $this->groupdav->GetRequest();
		$resource->AddProperty('getctag', $this->GetCTag($siteId, $account, $arPath), CDavGroupDav::CALENDARSERVER);

		$arAccount = null;
		if ($account != null)
		{
			$arAccount = CDavAccount::GetAccountById($account);

			$resource->AddProperty('calendar-user-address-set',
				array(
					array('href', 'MAILTO:'.$arAccount['EMAIL']),
					array('href', $request->GetBaseUri().'/principals/'.$arAccount["TYPE"].'/'.$arAccount["CODE"].'/'),
					array('href', 'urn:uuid:'.$arAccount["ID"])
				),
				CDavGroupDav::CALDAV
			);
		}
	}