Framework:sb ICalendar

From Surebert wiki

Contents

Overview

sb_ICalendar consists of three classes Attendee, Event and Organizer that allow you to create/delete calendar events that work with Outlook, mail.app, iphone, blackberry and Entourage.

Examples

Adding Event

php code

$event = new sb_ICalendar_Event();
$event->location = '901 Washington #3';
$event->summary = 'Ride for Roswell Meeting';
$event->set_time('11/26/2009 13:30', '11/26/2009 14:30');
$event->add_attendee(new sb_ICalendar_Attendee('Reid, Delmar', 'del.reid@roswellpark.org'));
$event->add_attendee(new sb_ICalendar_Attendee('Dean, Gregary', 'gregary.dean@roswellpark.org'));
$event->set_organizer(new sb_ICalendar_Organizer('Visco, Paul', 'paul.visco@roswellpark.org'));
$event->send()
  • $event->location sets location of event
  • $event->summary will be the body of the email. The first twenty characters will be the subject.
  • $event->set_time sets begin(first parameter) and end time(second parameter)
  • $event->add_attendee has a parameter that is sb_ICalendar_Attendee class with the name of the person and their email address as properties
  • $event->set_organizer parameter is sb_ICalendar_Attendee class with the name of the person and their email address as properties
  • $event->send Self-explanatory

Deleting Event

php code

$event = new sb_ICalendar_Event();
$event->uid = '123'
$event->status = 'CANCEL'
$event->location = '901 Washington #3';
$event->summary = 'Ride for Roswell Meeting';
$event->set_time('11/26/2009 13:30', '11/26/2009 14:30');
$event->add_attendee(new sb_ICalendar_Attendee('Reid, Delmar', 'del.reid@roswellpark.org'));
$event->add_attendee(new sb_ICalendar_Attendee('Dean, Gregary', 'gregary.dean@roswellpark.org'));
$event->set_organizer(new sb_ICalendar_Organizer('Visco, Paul', 'paul.visco@roswellpark.org'));
$event->send();

Same as the Adding event example with the addition of two properties

  • $event->uid is needed to identify the calendar event you want to cancel
  • $event->method determines what this message is supposed to do. Setting it to 'CANCEL' with cancel the event. 'REQUEST' is the default method

Class Properties

$this->summary

This will be the body of the email sent. The first twenty characters will be the subject of the message.

$this->location

Location where the event is going to take place

$this->method

Determines what type of event is sent out. The only two that are supported right now are:

$this->uid

Unique identifier for calendar event. This needs to be provided if you are canceling an event. If it is not provided it is set when an event is sent out.

$this->dtstart

Start time of the event in any format strtotime() can handle

$this->dtend

End time of the event in any format strtotime() can handle

$this->attendees

An array of sb_ICalendar_Attendee objects that are the attendees for the event

$this->organizer

The organizer of the event as an sb_ICalendar_Organizer