Details
Description
Summary
=======
CiviEvent Phase 1 will support "publishing" (to a web page) a list of "public" events for a given domain and time period in the iCalendar format.
Implementation
============
1. Input parameters for this page request are:
- start date ('start') - yyyymmdd format, default = today
- duration ('dur') - in days, default = 30
- event type ('type') - event_type_id, default = NULL (returns any event type)
Input params should be filtered by type to prevent invalid/malicious inputs.
2. Invoke path is civicrm/event/ical
Examples
-------------
civicrm/event/ical?start=20070216&dur=60&type=1
This returns all events for the civicrm domain linked to the URL. Pseudo-code for query:
WHERE civicrm_event.domain_id = $domain
civicrm_event.start_date >= $start AND
civicrm_event.event_type_id = 1
civicrm_event.is_active = 1 AND
civicrm_event.is_public = 1
civicrm/event/ical
This returns all events for the civicrm domain linked to the URL. Pseudo-code for query:
WHERE civicrm_event.domain_id = $domain
civicrm_event.start_date >= $today AND
civicrm_event.is_active = 1 AND
civicrm_event.is_public = 1
3. Output
We return an iCalendar formatted file:
- We'll use a fixed file name of civicrm_ical.ics for now.
- Mime CONTENT-TYPE:text/calendar
- Configured language for the site should be encluded in the Content-Language field in the header (e.g. 'us_EN')
3.1 File Content - Required Elements
Each output file will begin w/ the following static required lines:
BEGIN:VCALENDAR
PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
VERSION:2.0
... and end with this line:
END:VCALENDAR
3.2 For each Event in the requested query. Event properties are all retrieved from civicrm_event and related tables, and mapped to the outputs below as $column_name or $object_name.
BEGIN:VEVENT
SUMMARY: $title
DESCRIPTION: $summary
DTSTART: $start_date
DTEND:$end_date
LOCATION: "$location_name"; "$address_block" (comma separated, single line)
ORGANIZER:MAILTO:$contact_email (retrieve from associated location object)
URL:$completeURLtoEventInformationPage
END:VEVENT
4. test generated ics files on
a. macosx calendar program
b. google calendar
c. a calendar program on your local desktop if it has support for iCal
Resources
=========
Good overview of the format:
http://en.wikipedia.org/wiki/ICalendar
The IETF standard:
http://tools.ietf.org/html/rfc2445
Drupal iCal API code - includes example of converting an event array into iCal output:
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/event/ical.inc?rev=1.5
END:VCALENDAR