aboutsummaryrefslogtreecommitdiff
path: root/views/ical/export
diff options
context:
space:
mode:
Diffstat (limited to 'views/ical/export')
-rw-r--r--views/ical/export/entity.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/views/ical/export/entity.php b/views/ical/export/entity.php
new file mode 100644
index 000000000..eaa3b56d8
--- /dev/null
+++ b/views/ical/export/entity.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Elgg ICAL output of default object.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ */
+
+$entity = $vars['entity'];
+
+if ($entity instanceof Notable &&
+ $entity->getCalendarStartTime() &&
+ $entity->getCalendarEndTime()) {
+
+ $timestamp = date("Ymd\THis\Z", $entity->getTimeCreated());
+ $start = date("Ymd\THis\Z", $entity->getCalendarStartTime());
+ $end = date("Ymd\THis\Z", $entity->getCalendarEndTime());
+ $summary = $entity->title;
+ $modified = date("Ymd\THis\Z", $entity->getTimeUpdated());
+
+ echo <<< ICAL
+BEGIN:VEVENT
+DTSTAMP:$timestamp
+DTSTART:$start
+DTEND:$end
+SUMMARY:$summary
+LAST-MODIFIED:$modified
+END:VEVENT
+
+ICAL;
+
+}