Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.09 KB | None | 0 0
  1. <?php
  2. // $Id: calendar-view-ical.tpl.php,v 1.1.2.5 2010/11/21 12:25:12 karens Exp $
  3. /**
  4.  * $calname
  5.  *   The name of the calendar.
  6.  * $site_timezone
  7.  *   The name of the site timezone.
  8.  * $events
  9.  *   An array with the following information about each event:
  10.  *
  11.  *   $event['uid'] - a unique id for the event (usually the url).
  12.  *   $event['summary'] - the name of the event.
  13.  *   $event['start'] - the formatted start date of the event.
  14.  *   $event['end'] - the formatted end date of the event.
  15.  *   $event['rrule'] - the RRULE of the event, if any.
  16.  *   $event['timezone'] - the formatted timezone name of the event, if any.
  17.  *   $event['url'] - the url for the event.
  18.  *   $event['location'] - the name of the event location.
  19.  *   $event['description'] - a description of the event.
  20.  *
  21.  *   Note that there are empty spaces after RRULE, URL, LOCATION, etc
  22.  *   that are needed to make sure we get the required line break.
  23.  *
  24.  */
  25.  
  26. ?>
  27. BEGIN:VCALENDAR
  28. VERSION:2.0
  29. METHOD:PUBLISH
  30. X-WR-CALNAME: <?php print $calname . "\r\n"; ?>
  31. X-WR-TIMEZONE:America/New_York
  32. PRODID:-//Drupal iCal API//EN
  33. <?php foreach($events as $event): ?>
  34. BEGIN:VEVENT
  35. <?php
  36. if(substr($event['start'],-7,1)!='T'){
  37.     $allday=";VALUE=DATE";
  38.     $z="Z";
  39. }
  40. else{
  41.     $allday="";
  42.     $z="";
  43.     }
  44.     ?>
  45. DTSTART<?php print($allday);?>:<?php print($event['start'].$z."\r\n"); ?>
  46. <?php if (!empty($event['end'])): ?>
  47. DTEND<?php print($allday);?>:<?php print($event['end'].$z."\r\n"); ?>
  48. <?php endif; ?>
  49. DTSTAMP:<?php print($current_date . "Z\r\n") ?>
  50. UID:<?php print($event['uid'] . "\r\n") ?>
  51. SUMMARY:<?php print($event['summary'] . "\r\n") ?>
  52. <?php if (!empty($event['rrule'])) : ?>
  53. <?php print($event['rrule'] . "\r\n") ?>
  54. <?php endif; ?>
  55. <?php if (!empty($event['url'])): ?>
  56. URL;VALUE=URI:<?php print($event['url'] . "\r\n") ?>
  57. <?php endif; ?>
  58. <?php if (!empty($event['location'])): ?>
  59. LOCATION:<?php print($event['location'] . "\r\n") ?>
  60. <?php endif; ?>
  61. <?php if (!empty($event['description'])) : ?>
  62. DESCRIPTION:<?php print($event['description'] . "\r\n") ?>
  63. <?php endif; ?>
  64. END:VEVENT
  65. <?php endforeach; ?>
  66. END:VCALENDAR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement