Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/parser/ics/PhutilICSWriter.php
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | private function getDocumentNodeProperties( | ||||
$properties = array(); | $properties = array(); | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'VERSION', | 'VERSION', | ||||
'2.0'); | '2.0'); | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'PRODID', | 'PRODID', | ||||
'-//Phacility//Phabricator//EN'); | self::getICSPRODID()); | ||||
return $properties; | return $properties; | ||||
} | } | ||||
public static function getICSPRODID() { | |||||
return '-//Phacility//Phabricator//EN'; | |||||
} | |||||
private function getEventNodeProperties(PhutilCalendarEventNode $event) { | private function getEventNodeProperties(PhutilCalendarEventNode $event) { | ||||
$properties = array(); | $properties = array(); | ||||
$uid = $event->getUID(); | $uid = $event->getUID(); | ||||
if (!strlen($uid)) { | if (!strlen($uid)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to write ICS document: event has no UID, but each event '. | 'Unable to write ICS document: event has no UID, but each event '. | ||||
Show All 31 Lines | private function getEventNodeProperties(PhutilCalendarEventNode $event) { | ||||
$dtend = $event->getEndDateTime(); | $dtend = $event->getEndDateTime(); | ||||
if ($dtend) { | if ($dtend) { | ||||
$properties[] = $this->newDateTimeProperty( | $properties[] = $this->newDateTimeProperty( | ||||
'DTEND', | 'DTEND', | ||||
$event->getEndDateTime()); | $event->getEndDateTime()); | ||||
} | } | ||||
$name = $event->getName(); | $name = $event->getName(); | ||||
if (strlen($name)) { | if (phutil_nonempty_string($name)) { | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'SUMMARY', | 'SUMMARY', | ||||
$name); | $name); | ||||
} | } | ||||
$description = $event->getDescription(); | $description = $event->getDescription(); | ||||
if (strlen($description)) { | if (phutil_nonempty_string($description)) { | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'DESCRIPTION', | 'DESCRIPTION', | ||||
$description); | $description); | ||||
} | } | ||||
$organizer = $event->getOrganizer(); | $organizer = $event->getOrganizer(); | ||||
if ($organizer) { | if ($organizer) { | ||||
$properties[] = $this->newUserProperty( | $properties[] = $this->newUserProperty( | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0