aboutsummaryrefslogtreecommitdiff
path: root/views/ical
diff options
context:
space:
mode:
Diffstat (limited to 'views/ical')
-rw-r--r--views/ical/event_calendar/show_events.php7
-rw-r--r--views/ical/export/entity.php33
-rw-r--r--views/ical/object/default.php10
-rw-r--r--views/ical/object/event_calendar.php44
-rw-r--r--views/ical/page/default.php6
-rw-r--r--views/ical/page/layouts/default.php2
6 files changed, 47 insertions, 55 deletions
diff --git a/views/ical/event_calendar/show_events.php b/views/ical/event_calendar/show_events.php
deleted file mode 100644
index d357908b9..000000000
--- a/views/ical/event_calendar/show_events.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/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/object/event_calendar.php b/views/ical/object/event_calendar.php
deleted file mode 100644
index 36d71a66c..000000000
--- a/views/ical/object/event_calendar.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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/views/ical/page/default.php b/views/ical/page/default.php
index b4cd7eefb..01bd9e86e 100644
--- a/views/ical/page/default.php
+++ b/views/ical/page/default.php
@@ -7,11 +7,13 @@
*
*/
+$site = elgg_get_site_entity();
+
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
+PRODID:-//Elgg//NONSGML <?php echo $site->name; ?>//EN
<?php echo $vars['body']; ?>
END:VCALENDAR
diff --git a/views/ical/page/layouts/default.php b/views/ical/page/layouts/default.php
deleted file mode 100644
index 57598fa1b..000000000
--- a/views/ical/page/layouts/default.php
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-echo $vars['content']; \ No newline at end of file