diff options
Diffstat (limited to 'views/ical')
-rw-r--r-- | views/ical/event_calendar/show_events.php | 7 | ||||
-rw-r--r-- | views/ical/object/event_calendar.php | 44 | ||||
-rw-r--r-- | views/ical/page/default.php | 17 | ||||
-rw-r--r-- | views/ical/page/layouts/default.php | 2 |
4 files changed, 70 insertions, 0 deletions
diff --git a/views/ical/event_calendar/show_events.php b/views/ical/event_calendar/show_events.php new file mode 100644 index 000000000..19981596f --- /dev/null +++ b/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); + } + //echo elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false); +} diff --git a/views/ical/object/event_calendar.php b/views/ical/object/event_calendar.php new file mode 100644 index 000000000..a6ed889e5 --- /dev/null +++ b/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:<?php echo date("Ymd\THis\Z", $event->start_date); ?> + +DTEND:<?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/views/ical/page/default.php b/views/ical/page/default.php new file mode 100644 index 000000000..b8347c9a0 --- /dev/null +++ b/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: attachment; 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/views/ical/page/layouts/default.php b/views/ical/page/layouts/default.php new file mode 100644 index 000000000..57598fa1b --- /dev/null +++ b/views/ical/page/layouts/default.php @@ -0,0 +1,2 @@ +<?php +echo $vars['content'];
\ No newline at end of file |