You are here

calendar-view-ical.tpl.php in Calendar 6.2

File

calendar_ical/calendar-view-ical.tpl.php
View source
<?php

/**
 * $calname
 *   The name of the calendar.
 * $site_timezone
 *   The name of the site timezone.
 * $events
 *   An array with the following information about each event:
 *
 *   $event['uid'] - a unique id for the event (usually the url).
 *   $event['summary'] - the name of the event.
 *   $event['start'] - the formatted start date of the event.
 *   $event['end'] - the formatted end date of the event.
 *   $event['rrule'] - the RRULE of the event, if any.
 *   $event['timezone'] - the formatted timezone name of the event, if any.
 *   $event['url'] - the url for the event.
 *   $event['location'] - the name of the event location.
 *   $event['description'] - a description of the event.
 *
 * If you are editing this file, remember that all output lines generated by it
 * must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
 * comply with the iCal spec: http://tools.ietf.org/html/rfc5545#section-3.1.
 **/
if (empty($method)) {
  $method = 'PUBLISH';
}
print "BEGIN:VCALENDAR\r\n";
print "VERSION:2.0\r\n";
print "METHOD:print {$method}\r\n";
if (!empty($calname)) {
  print "X-WR-CALNAME;VALUE=TEXT:{$calname}\r\n";
}
print "PRODID:-//Drupal iCal API//EN\r\n";
foreach ($events as $event) {
  print "BEGIN:VEVENT\r\n";
  print "UID:" . $event['uid'] . "\r\n";
  print "SUMMARY:" . $event['summary'] . "\r\n";
  print "DTSTAMP:" . $current_date . "Z\r\n";
  print "DTSTART:" . $event['start'] . "Z\r\n";
  if (!empty($event['end'])) {
    print "DTEND:" . $event['end'] . "Z\r\n";
  }
  if (!empty($event['rrule'])) {
    print $event['rrule'] . "\r\n";
  }
  if (!empty($event['url'])) {
    print "URL;VALUE=URI:" . $event['url'] . "\r\n";
  }
  if (!empty($event['location'])) {
    print "LOCATION:" . $event['location'] . "\r\n";
  }
  if (!empty($event['description'])) {
    print "DESCRIPTION:" . $event['description'] . "\r\n";
  }
  print "END:VEVENT\r\n";
}
print "END:VCALENDAR\r\n";