aboutsummaryrefslogtreecommitdiff
path: root/mod/event_calendar/views/ical
diff options
context:
space:
mode:
Diffstat (limited to 'mod/event_calendar/views/ical')
-rw-r--r--mod/event_calendar/views/ical/event_calendar/show_events.php7
-rw-r--r--mod/event_calendar/views/ical/object/event_calendar.php44
-rw-r--r--mod/event_calendar/views/ical/page/default.php17
-rw-r--r--mod/event_calendar/views/ical/page/layouts/default.php2
4 files changed, 70 insertions, 0 deletions
diff --git a/mod/event_calendar/views/ical/event_calendar/show_events.php b/mod/event_calendar/views/ical/event_calendar/show_events.php
new file mode 100644
index 000000000..d357908b9
--- /dev/null
+++ b/mod/event_calendar/views/ical/event_calendar/show_events.php
@@ -0,0 +1,7 @@
+<?php
+if ($vars['events']) {
+ foreach ($vars['events'] as $entity) {
+ echo elgg_view_entity($entity['event']);
+ }
+ //echo elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false);
+}
diff --git a/mod/event_calendar/views/ical/object/event_calendar.php b/mod/event_calendar/views/ical/object/event_calendar.php
new file mode 100644
index 000000000..36d71a66c
--- /dev/null
+++ b/mod/event_calendar/views/ical/object/event_calendar.php
@@ -0,0 +1,44 @@
+<?php
+$event = $vars['entity'];
+if ($event->organizer) {
+ $organizer = "\nORGANIZER;CN={$event->organizer}\n";
+} else {
+ $organizer = '';
+}
+
+if ($event->description) {
+ // make sure that we are using Unix line endings
+ $description = str_replace("\r\n","\n",$event->description);
+ $description = str_replace("\r","\n",$description);
+
+ // now convert to icalendar format
+ $description = str_replace("\n",'\n',$description);
+ $description = wordwrap($description,75,"\r\n ",TRUE);
+} else {
+ $description = '';
+}
+?>
+BEGIN:VEVENT
+UID:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>
+
+URL:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>
+
+DTSTAMP:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated())?>
+
+CREATED:<?php echo date("Ymd\THis\Z", $event->getTimeCreated())?>
+
+LAST-MODIFIED:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated()) ?>
+
+DTSTART;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->start_date); ?>
+
+DTEND;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->real_end_time); ?>
+
+SUMMARY:<?php echo $event->title; ?>
+
+DESCRIPTION:<?php echo $description; ?>
+
+LOCATION:<?php echo $event->venue; ?><?php echo $organizer; ?>
+
+CATEGORIES:<?php implode(",",$event->tags); ?>
+
+END:VEVENT
diff --git a/mod/event_calendar/views/ical/page/default.php b/mod/event_calendar/views/ical/page/default.php
new file mode 100644
index 000000000..b4cd7eefb
--- /dev/null
+++ b/mod/event_calendar/views/ical/page/default.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg ICAL output pageshell
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ */
+
+header("Content-Type: text/calendar");
+header("Content-Disposition: inline; filename=\"calendar.ics\"");
+?>
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Curverider Ltd//NONSGML Elgg <?php echo get_version(true); ?>//EN
+<?php echo $vars['body']; ?>
+END:VCALENDAR
diff --git a/mod/event_calendar/views/ical/page/layouts/default.php b/mod/event_calendar/views/ical/page/layouts/default.php
new file mode 100644
index 000000000..57598fa1b
--- /dev/null
+++ b/mod/event_calendar/views/ical/page/layouts/default.php
@@ -0,0 +1,2 @@
+<?php
+echo $vars['content']; \ No newline at end of file