API Guide

Calendars

Creating a Calendar using SVCalendar

An example of how to create a VCalendar/ics file (iCal-compatible) using the SVCalendar class.

// Create a new calendar and a new event
$c = new SVCalendar();
$e = new SVEvent();
// Set some properties on the event. This includes setting "uid" -- some unique id number -- for
// the event. You can use the id of an object in your database, a random number, etc.
$e->summary = 'Workshop Number 1 Million';
$e->description = 'This is a cool workshop in which people do stuff.';
$e->uid = 1;
$e->setStartDate('2008-06-15');
$e->setEndDate('2008-06-16');
$c->addEvent($e);

// Print the calendar to the screen
header('Content-type: text/text');
print($c->render());

// Or, save the calendar to an ics file
file_put_contents('calendars/MyCal.ics', $c->render());

Generated on Wed Nov 24 02:01:28 2010 for Common by  doxygen 1.5.6