event_calendar.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. $event = $vars['entity'];
  3. if ($event->organizer) {
  4. $organizer = "\nORGANIZER;CN={$event->organizer}\n";
  5. } else {
  6. $organizer = '';
  7. }
  8. if ($event->description) {
  9. // make sure that we are using Unix line endings
  10. $description = str_replace("\r\n","\n",$event->description);
  11. $description = str_replace("\r","\n",$description);
  12. // now convert to icalendar format
  13. $description = str_replace("\n",'\n',$description);
  14. $description = wordwrap($description,75,"\r\n ",TRUE);
  15. } else {
  16. $description = '';
  17. }
  18. ?>
  19. BEGIN:VEVENT
  20. UID:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>
  21. URL:<?php echo elgg_get_site_url().'event_calendar/view/'.$event->guid; ?>
  22. DTSTAMP:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated())?>
  23. CREATED:<?php echo date("Ymd\THis\Z", $event->getTimeCreated())?>
  24. LAST-MODIFIED:<?php echo date("Ymd\THis\Z", $event->getTimeUpdated()) ?>
  25. DTSTART;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->start_date); ?>
  26. DTEND;VALUE=DATE:<?php echo date("Ymd\THis\Z", $event->real_end_time); ?>
  27. SUMMARY:<?php echo $event->title; ?>
  28. DESCRIPTION:<?php echo $description; ?>
  29. LOCATION:<?php echo $event->venue; ?><?php echo $organizer; ?>
  30. CATEGORIES:<?php implode(",",$event->tags); ?>
  31. END:VEVENT