Sitellite Application Framework
Class Tree         Index         All Elements

Class: vCal

Source Location: Program_Root/Date/vCalendar/vCalendar.php

Class Overview


vCal implements a basic parser and mechanism for generating vCalendar and iCalendar messages. Knowledge of the names and meanings of the properties available to each message type will be required, as this class does nothing to manage those.


Author(s)

Version

  • 1.2, 2002-09-25, $Id: vCalendar.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 83]
vCal implements a basic parser and mechanism for generating vCalendar and iCalendar messages. Knowledge of the names and meanings of the properties available to each message type will be required, as this class does nothing to manage those.

New in 1.2:

  • Added some compatibility improvements which allow vCal to also support the vCard format, as well as all of the event types.
  • Note: There is a problem with Apple's Address Book, which I am testing against. It does not properly unfold a vCard, so if a name is on the following line (using the CRLF plus a space syntax defined in the specs) it will be imported with no name. Fortunately for us vCal coders, a workaround is to wrap your write() call in an unfold() call, although this will remove all occurrences of CRLF + space and could cause long lines which might not work with some vCalendar/vCard applications.

1 <?php
2
3 $cal = new vCal ();
4
5 $cal->addProperty ('VERSION', '2.0');
6 $cal->addProperty ('PRODID', '-//Simian Systems//NONSGML Sitellite Application Framework//EN');
7
8 $event =& $cal->addEvent ('VEVENT');
9
10 $event->addProperty ('UID', 54321);
11 $event->addProperty ('ORGANIZER', 'MAILTO:bananaman@simian.ca');
12 $prop =& $event->addProperty ('ATTENDEE', 'MAILTO:bananaman@simian.ca');
13 $prop->addParameter ('RSVP', 'TRUE');
14
15 // start time is now
16 $event->addProperty ('DTSTART', date ('Ymd\THis\Z'));
17
18 // end time is the same time tomorrow
19 $event->addProperty ('DTEND', date ('Ymd\THis\Z', time () + 86400));
20
21 $event->addProperty ('SUMMARY', 'Party time!');
22 $event->addProperty ('LOCATION', 'My place');
23
24 echo $cal->write ();
25
26 ? >




Tags:

access:  public
version:  1.2, 2002-09-25, $Id: vCalendar.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$calendars =  false

[line 118]

List of calendars in this calendar container. All calendars are vCal objects. A vCal object may act as either a calendar or as a container of multiple calendars. This property is false if this is not a container.



Tags:

access:  public

Type:   mixed


[ Top ]

$events = array ()

[line 99]

List of events in this calendar. All events are vCalEvent objects.



Tags:

access:  public

Type:   mixed


[ Top ]

$originalData =

[line 91]

If this vCal object has been created from an existing data source, this property contains the original data string.



Tags:

access:  public

Type:   mixed


[ Top ]

$properties = array ()

[line 108]

List of properties in this calendar. All properties are vCalProperty objects.



Tags:

access:  public

Type:   mixed


[ Top ]

$tag =  'VCALENDAR'

[line 128]

This is the name of the surrounding BEGIN and END tag. It defaults to 'VCALENDAR', but can be changed to support additional formats such as 'VCARD'.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor vCal [line 138]

vCal vCal( [string $parseData = ''])

Constructor Method. Optionally parses an existing data string into a complete vCal object.



Tags:

access:  public


Parameters:

string   $parseData  

[ Top ]

method addEvent [line 438]

object reference &addEvent( [string $type = 'VEVENT'], [array $properties = array ()])

Adds an event to the list. Returns a reference to the new event object. The $type can be any valid vCalendar event type.



Tags:

access:  public


Parameters:

string   $type  
array   $properties  

[ Top ]

method addProperty [line 455]

object reference &addProperty( string $name, string $value, [array $parameters = array ()])

Adds a property to the list. Returns a reference to the new property object. The $name can be any valid vCalendar property.



Tags:

access:  public


Parameters:

string   $name  
string   $value  
array   $parameters  

[ Top ]

method fold [line 406]

string fold( string $data)

Folds a block of text by inserting a Carriage Return (\r), a Line Feed (\n), and a single space every 70 characters.



Tags:

access:  public


Parameters:

string   $data  

[ Top ]

method parse [line 155]

void parse( string $data, [string $tag = 'VCALENDAR'])

Parses a vCalendar message into an array of calendar objects with events and properties. Changing $tag to 'VCARD' allows vCal to parse vCard files as well.



Tags:

access:  public


Parameters:

string   $data  
string   $tag  

[ Top ]

method parseLine [line 183]

vCalProperty parseLine( string $data)

Parses a property:value line into a vCalProperty object.



Tags:

return:  object
access:  public


Parameters:

string   $data  

[ Top ]

method quote [line 420]

string quote( string $data)

Checks whether a string contains a comma (,), a semi-colon (;), or a colon (:), and adds double quotes to the string if it does.



Tags:

access:  public


Parameters:

string   $data  

[ Top ]

method splitIntoKeys [line 374]

aarray splitIntoKeys( string $data)

Parses a string for a list of properties. Properties take the

format NAME:VALUE. Optional parameters may be added before the colon, like this: NAME;PARAM1=VALUE1;PARAM2=VALUE2:VALUE, and the value itself may also be broken into key/value pairs, like this: NAME:FOO=BAR;FOO2=BAR2. Returns an array of names and vCalProperty objects.




Tags:

access:  public


Parameters:

string   $data  

[ Top ]

method unfold [line 392]

string unfold( string $data)

Unfolds a block of text by removing instances of a Carriage Return (\r), a Line Feed (\n), and a single space.



Tags:

access:  public


Parameters:

string   $data  

[ Top ]

method write [line 468]

string write( )

Writes a vCalendar message out of the current object.



Tags:

access:  public


[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:20:07 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2