diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-09-28 23:16:32 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-09-28 23:17:26 +0200 |
commit | c9c7d5e1aa423616334deaed86f516a2f84b7aff (patch) | |
tree | 4c1ee5ff7dad13f3e29dd325b65dda9dcebce10c /apps/calendar/lib | |
parent | 5875b50de055138d62252075d19e242eac608d24 (diff) | |
download | nextcloud-server-c9c7d5e1aa423616334deaed86f516a2f84b7aff.tar.gz nextcloud-server-c9c7d5e1aa423616334deaed86f516a2f84b7aff.zip |
Add support for DURATION in VEVENT
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r-- | apps/calendar/lib/object.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 0c7649776d5..0c3e497d4f2 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -286,6 +286,30 @@ class OC_Calendar_Object{ } } + public static function getDTEndFromVEvent($vevent) + { + if ($vevent->DTEND) { + $dtend = $vevent->DTEND; + }else{ + $dtend = clone $vevent->DTSTART; + if ($vevent->DURATION){ + $duration = strval($vevent->DURATION); + $invert = 0; + if ($duration[0] == '-'){ + $duration = substr($duration, 1); + $invert = 1; + } + if ($duration[0] == '+'){ + $duration = substr($duration, 1); + } + $interval = new DateInterval($duration); + $interval->invert = $invert; + $dtend->getDateTime()->add($interval); + } + } + return $dtend; + } + public static function getCategoryOptions($l10n) { return array( @@ -482,6 +506,7 @@ class OC_Calendar_Object{ } $vevent->DTSTART = $dtstart; $vevent->DTEND = $dtend; + unset($vevent->DURATION); if($location != ""){ $vevent->LOCATION = $location; |