CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCalendar Class Reference

Class to generate a simple iCalendar document. More...

## Public Member Functions
| __construct ($ID, $StartDate, $EndDate, $AllDay, $TimeZoneID=NULL)
| Construct a basic iCalendar document. More...
| AddCreated ($Value)
| Add the created property to the iCalendar document. More...
| AddSummary ($Value)
| Add the summary property to the iCalendar document. More...
| AddDescription ($Value)
| Add the description property to the iCalendar document. More...
| AddCategories (array $Categories)
| Add the categories property to the iCalendar document. More...
| AddURL ($Value)
| Add the URL property to the iCalendar document. More...
| AddGeographicPosition ($Latitude, $Longitude)
| Add the geographic position property to the iCalendar document. More...
| AddLocation ($Value)
| Add the location property to the iCalendar document. More...
| GenerateDocument ()
| Generate the iCalendar document based on the current list of properties. More...
| GenerateFileName ()
| Generate a file name for the iCalendar document. More...

## Static Public Member Functions
static | GenerateFileNameFromSummary ($Summary=NULL)
| Create a file name for an iCalendar document using a given summary. More...
static | TransformHTMLToPlainText ($HTML)
| Helper method to transform an HTML string to plain text. More...

## Protected Member Functions
| AddProperty ($Component, $Property, $Value, array $Parameters=array())
| Add a generic property, i.e., one whose value is already in the proper form. More...
| AddTextProperty ($Component, $Property, $Value, array $Parameters=array())
| Add a text property to the list. More...
| AddDateProperty ($Component, $Property, $Value, array $Parameters=array())
| Add a date property to the list. More...
| AddDateTimeProperty ($Component, $Property, $Value, array $Parameters=array())
| Add a date/time property to the list. More...
| EscapeTextValue ($Value)
| Escape a text value for inserting into a property line. More...
| GenerateUID ($ID, $StartDate)
| Generate a full UID from an event ID and start date. More...
| GenerateDateString ($Date)
| Generate a date string from a date parsable by strtotime(). More...
| GenerateDateTimeString ($DateTime)
| Generate a date/time string from a date parsable by strtotime(). More...
| GenerateUTCDateTimeString ($DateTime)
| Generate a UTC date/time string from a date parsable by strtotime(). More...
| GeneratePropertyString ($Property, array $Parameters=array())
| Generate a property string (property + parameters + ":"). More...
| FoldString ($String, $End="\r\n ")
| Fold a string so that lines are never longer than 75 characters. More...

## Protected Attributes
| $Properties
| The list of components and properties. More...
| $Summary
| The summary property for the iCalendar document. More...

## Detailed Description

Class to generate a simple iCalendar document.

Definition at line 13 of file iCalendar.php.

## Constructor & Destructor Documentation

iCalendar::__construct | ( |  | $ID,
|  |  | $StartDate,
|  |  | $EndDate,
|  |  | $AllDay,
|  |  | $TimeZoneID = `NULL`
| ) |  |

Construct a basic iCalendar document.

Parameters

  string | $ID | Event ID used when generating the UID.
  string | $StartDate | Event start date parsable by strtotime().
  string | $EndDate | Event end date parsable by strtotime().
  bool | $AllDay | Flag to specify if the event takes place throughout the day instead of during specific times.
  string | $TimeZoneID | Optional time zone ID, e.g., "America/New_York".

Definition at line 25 of file iCalendar.php.

References AddDateProperty(), AddDateTimeProperty(), AddProperty(), and GenerateUID().

## Member Function Documentation

iCalendar::AddCategories | ( | array | $Categories | ) |

Add the categories property to the iCalendar document.

An existing categories property will be overwritten.

Parameters

  array | $Categories | A list of categories.

Definition at line 90 of file iCalendar.php.

References AddProperty().

iCalendar::AddCreated | ( |  | $Value | ) |

Add the created property to the iCalendar document.

An existing created property will be overwritten.

Parameters

  string | $Value | The date and time the event was created.

Definition at line 55 of file iCalendar.php.

References AddTextProperty(), and GenerateUTCDateTimeString().

iCalendar::AddDateProperty | ( |  | $Component,
|  |  | $Property,
|  |  | $Value,
|  | array | $Parameters = `array()`
| ) |  |
| protected

Add a date property to the list.

Parameters

  string | $Component | The iCalendar component the property belongs to.
  string | $Property | The name of the property.
  string | $Value | The property value.
  array | $Parameters | Optional parameters for the property. These should already be properly escaped.

See also
  AddProperty()
  AddTextProperty()
  AddDateTimeProperty()
  http://tools.ietf.org/html/rfc5545#section-3.3.4

Definition at line 334 of file iCalendar.php.

References AddProperty(), and GenerateDateString().

Referenced by __construct().

Here is the caller graph for this function:

iCalendar::AddDateTimeProperty | ( |  | $Component,
|  |  | $Property,
|  |  | $Value,
|  | array | $Parameters = `array()`
| ) |  |
| protected

Add a date/time property to the list.

Parameters

  string | $Component | The iCalendar component the property belongs to.
  string | $Property | The name of the property.
  string | $Value | The property value.
  array | $Parameters | Optional parameters for the property. These should already be properly escaped.

See also
  AddProperty()
  AddTextProperty()
  AddDateProperty()
  http://tools.ietf.org/html/rfc5545#section-3.3.5

Definition at line 356 of file iCalendar.php.

References AddProperty(), and GenerateDateTimeString().

Referenced by __construct().

Here is the caller graph for this function:

iCalendar::AddDescription | ( |  | $Value | ) |

Add the description property to the iCalendar document.

An existing description property will be overwritten.

Parameters

  string | $Value | The body of the description.

Definition at line 80 of file iCalendar.php.

References AddTextProperty().

iCalendar::AddGeographicPosition | ( |  | $Latitude,
|  |  | $Longitude
| ) |  |

Add the geographic position property to the iCalendar document.

An existing geographic position property will be overwritten.

Parameters

  float | $Latitude | Latitude value.
  float | $Longitude | Longitude value.

Definition at line 126 of file iCalendar.php.

References AddProperty().

iCalendar::AddLocation | ( |  | $Value | ) |

Add the location property to the iCalendar document.

An existing location property will be overwritten.

Parameters

  string | $Value | The location.

Definition at line 140 of file iCalendar.php.

References AddTextProperty().

iCalendar::AddProperty | ( |  | $Component,
|  |  | $Property,
|  |  | $Value,
|  | array | $Parameters = `array()`
| ) |  |
| protected

Add a generic property, i.e., one whose value is already in the proper form.

Parameters

  string | $Component | The iCalendar component the property belongs to.
  string | $Property | The name of the property.
  string | $Value | The property value.
  array | $Parameters | Optional parameters for the property. These should already be properly escaped.

See also
  AddTextProperty()
  AddDateProperty()
  AddDateTimeProperty()

Definition at line 281 of file iCalendar.php.

References FoldString(), and GeneratePropertyString().

Referenced by __construct(), AddCategories(), AddDateProperty(), AddDateTimeProperty(), AddGeographicPosition(), AddTextProperty(), AddURL(), and GenerateDocument().

Here is the caller graph for this function:

iCalendar::AddSummary | ( |  | $Value | ) |

Add the summary property to the iCalendar document.

An existing summary property will be overwritten.

Parameters

  string | $Value | The body of the summary.

Definition at line 66 of file iCalendar.php.

References AddTextProperty().

iCalendar::AddTextProperty | ( |  | $Component,
|  |  | $Property,
|  |  | $Value,
|  | array | $Parameters = `array()`
| ) |  |
| protected

Add a text property to the list.

Parameters

  string | $Component | The iCalendar component the property belongs to.
  string | $Property | The name of the property.
  string | $Value | The property value.
  array | $Parameters | Optional parameters for the property. These should already be properly escaped.

See also
  AddProperty()
  AddDateProperty()
  AddDateTimeProperty()
  http://tools.ietf.org/html/rfc5545#section-3.3.11

Definition at line 306 of file iCalendar.php.

References AddProperty(), and EscapeTextValue().

Referenced by AddCreated(), AddDescription(), AddLocation(), and AddSummary().

Here is the caller graph for this function:

iCalendar::AddURL | ( |  | $Value | ) |

Add the URL property to the iCalendar document.

An existing URL property will be overwritten.

Parameters

  string | $Value | The URL to add.

Definition at line 109 of file iCalendar.php.

References AddProperty().

iCalendar::EscapeTextValue | ( |  | $Value | ) |
| protected

Escape a text value for inserting into a property line.

Parameters

  string | $Value | The text value to escape.

Returns
  Returns the escaped text value.

Definition at line 371 of file iCalendar.php.

Referenced by AddTextProperty().

Here is the caller graph for this function:

iCalendar::FoldString | ( |  | $String,
|  |  | $End = `"\r\n "`
| ) |  |
| protected

Fold a string so that lines are never longer than 75 characters.

Parameters

  string | $String | The string to fold.
  string | $End | Optionally specifieds the line ending sequence.

Returns
  Returns the string, folded where necessary.

Definition at line 456 of file iCalendar.php.

Referenced by AddProperty().

Here is the caller graph for this function:

iCalendar::GenerateDateString | ( |  | $Date | ) |
| protected

Generate a date string from a date parsable by strtotime().

Parameters

  string | $Date | Date from which to generate the date string.

Returns
  Returns a date string.

Definition at line 403 of file iCalendar.php.

Referenced by AddDateProperty().

Here is the caller graph for this function:

iCalendar::GenerateDateTimeString | ( |  | $DateTime | ) |
| protected

Generate a date/time string from a date parsable by strtotime().

Parameters

  string | $DateTime | Date/Time from which to generate the date string.

Returns
  Returns a date/time string.

Definition at line 413 of file iCalendar.php.

Referenced by AddDateTimeProperty().

Here is the caller graph for this function:

iCalendar::GenerateDocument | ( |  | ) |

Generate the iCalendar document based on the current list of properties.

Returns
  Returns the iCalendar document as a string.

Definition at line 149 of file iCalendar.php.

References $Properties, AddProperty(), and GenerateUTCDateTimeString().

iCalendar::GenerateFileName | ( |  | ) |

Generate a file name for the iCalendar document.

The file name will be the summary property if set and the current date/time if not. The generated file name is safe to use in the "filename" property of the HTTP "Content-Disposition" header when the value is quoted.

Returns
  Returns the generated file name.

Definition at line 199 of file iCalendar.php.

static iCalendar::GenerateFileNameFromSummary | ( |  | $Summary = `NULL` | ) |
| static

Create a file name for an iCalendar document using a given summary.

The fiel name will be the current date/time if the summary is not given. The generated file name is safe to use in the "filename" property of the HTTP "Content-Disposition" header when the value is quoted.

Parameters

  string | $Summary | Optional summary to use in the name.

Returns
  Returns the generated file name.

Definition at line 212 of file iCalendar.php.

References $Summary.

iCalendar::GeneratePropertyString | ( |  | $Property,
|  | array | $Parameters = `array()`
| ) |  |
| protected

Generate a property string (property + parameters + ":").

Parameters

  string | $Property | The property name.
  array | $Parameters | Optional parameters for the property. These should already be properly escaped.

Returns
  Returns the generated property string.

Definition at line 435 of file iCalendar.php.

Referenced by AddProperty().

Here is the caller graph for this function:

iCalendar::GenerateUID | ( |  | $ID,
|  |  | $StartDate
| ) |  |
| protected

Generate a full UID from an event ID and start date.

Parameters

  string | $ID | Event ID.
  string | $StartDate | The date the event starts.

Returns
  Returns a full UID.

Definition at line 388 of file iCalendar.php.

References GenerateUTCDateTimeString().

Referenced by __construct().

Here is the caller graph for this function:

iCalendar::GenerateUTCDateTimeString | ( |  | $DateTime | ) |
| protected

Generate a UTC date/time string from a date parsable by strtotime().

Parameters

  string | $DateTime | Date/Time from which to generate the date string.

Returns
  Returns a UTC date/time string.

Definition at line 423 of file iCalendar.php.

Referenced by AddCreated(), GenerateDocument(), and GenerateUID().

Here is the caller graph for this function:

static iCalendar::TransformHTMLToPlainText | ( |  | $HTML | ) |
| static

Helper method to transform an HTML string to plain text.

Parameters

  string | $HTML | HTML string to transform.

Returns
  Returns the HTML string transformed to plain text.

Definition at line 245 of file iCalendar.php.

## Member Data Documentation

iCalendar::$Properties
| protected

Initial value:
= array(
"VEVENT" => array(),
"VTODO" => array(),
"VJOURNAL" => array(),
"VFREEBUSY" => array(),
"VTIMEZONE" => array(),
"VALARM" => array())

The list of components and properties.

Not all of the components may be used.

Definition at line 472 of file iCalendar.php.

Referenced by GenerateDocument().

iCalendar::$Summary
| protected

The summary property for the iCalendar document.

Used to generate the file name when set.

Definition at line 484 of file iCalendar.php.

Referenced by GenerateFileNameFromSummary().

The documentation for this class was generated from the following file:

- objects/iCalendar.php