aboutsummaryrefslogtreecommitdiff
path: root/views/ical
diff options
context:
space:
mode:
Diffstat (limited to 'views/ical')
-rw-r--r--views/ical/export/entity.php33
-rw-r--r--views/ical/object/default.php10
-rw-r--r--views/ical/page/default.php19
3 files changed, 62 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;
+
+}
diff --git a/views/ical/object/default.php b/views/ical/object/default.php
new file mode 100644
index 000000000..77183bb8a
--- /dev/null
+++ b/views/ical/object/default.php
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Elgg ICAL output of default object.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ */
+
+echo elgg_view('export/entity', $vars); \ No newline at end of file
diff --git a/views/ical/page/default.php b/views/ical/page/default.php
new file mode 100644
index 000000000..01bd9e86e
--- /dev/null
+++ b/views/ical/page/default.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Elgg ICAL output pageshell
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ */
+
+$site = elgg_get_site_entity();
+
+header("Content-Type: text/calendar");
+
+?>
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Elgg//NONSGML <?php echo $site->name; ?>//EN
+<?php echo $vars['body']; ?>
+END:VCALENDAR