CWIS Developer Documentation
|
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... | |
Class to generate a simple iCalendar document.
Definition at line 13 of file iCalendar.php.
iCalendar::__construct | ( | $ID, | |
$StartDate, | |||
$EndDate, | |||
$AllDay, | |||
$TimeZoneID = NULL |
|||
) |
Construct a basic iCalendar document.
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().
iCalendar::AddCategories | ( | array | $Categories | ) |
Add the categories property to the iCalendar document.
An existing categories property will be overwritten.
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.
string | $Value | The date and time the event was created. |
Definition at line 55 of file iCalendar.php.
References AddTextProperty(), and GenerateUTCDateTimeString().
|
protected |
Add a date property to the list.
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. |
Definition at line 334 of file iCalendar.php.
References AddProperty(), and GenerateDateString().
Referenced by __construct().
|
protected |
Add a date/time property to the list.
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. |
Definition at line 356 of file iCalendar.php.
References AddProperty(), and GenerateDateTimeString().
Referenced by __construct().
iCalendar::AddDescription | ( | $Value | ) |
Add the description property to the iCalendar document.
An existing description property will be overwritten.
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.
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.
string | $Value | The location. |
Definition at line 140 of file iCalendar.php.
References AddTextProperty().
|
protected |
Add a generic property, i.e., one whose value is already in the proper form.
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. |
Definition at line 281 of file iCalendar.php.
References FoldString(), and GeneratePropertyString().
Referenced by __construct(), AddCategories(), AddDateProperty(), AddDateTimeProperty(), AddGeographicPosition(), AddTextProperty(), AddURL(), and GenerateDocument().
iCalendar::AddSummary | ( | $Value | ) |
Add the summary property to the iCalendar document.
An existing summary property will be overwritten.
string | $Value | The body of the summary. |
Definition at line 66 of file iCalendar.php.
References AddTextProperty().
|
protected |
Add a text property to the list.
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. |
Definition at line 306 of file iCalendar.php.
References AddProperty(), and EscapeTextValue().
Referenced by AddCreated(), AddDescription(), AddLocation(), and AddSummary().
iCalendar::AddURL | ( | $Value | ) |
Add the URL property to the iCalendar document.
An existing URL property will be overwritten.
string | $Value | The URL to add. |
Definition at line 109 of file iCalendar.php.
References AddProperty().
|
protected |
Escape a text value for inserting into a property line.
string | $Value | The text value to escape. |
Definition at line 371 of file iCalendar.php.
Referenced by AddTextProperty().
|
protected |
Fold a string so that lines are never longer than 75 characters.
string | $String | The string to fold. |
string | $End | Optionally specifieds the line ending sequence. |
Definition at line 456 of file iCalendar.php.
Referenced by AddProperty().
|
protected |
Generate a date string from a date parsable by strtotime().
string | $Date | Date from which to generate the date string. |
Definition at line 403 of file iCalendar.php.
Referenced by AddDateProperty().
|
protected |
Generate a date/time string from a date parsable by strtotime().
string | $DateTime | Date/Time from which to generate the date string. |
Definition at line 413 of file iCalendar.php.
Referenced by AddDateTimeProperty().
iCalendar::GenerateDocument | ( | ) |
Generate the iCalendar document based on the current list of properties.
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.
Definition at line 199 of file iCalendar.php.
|
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.
string | $Summary | Optional summary to use in the name. |
Definition at line 212 of file iCalendar.php.
References $Summary.
|
protected |
Generate a property string (property + parameters + ":").
string | $Property | The property name. |
array | $Parameters | Optional parameters for the property. These should already be properly escaped. |
Definition at line 435 of file iCalendar.php.
Referenced by AddProperty().
|
protected |
Generate a full UID from an event ID and start date.
string | $ID | Event ID. |
string | $StartDate | The date the event starts. |
Definition at line 388 of file iCalendar.php.
References GenerateUTCDateTimeString().
Referenced by __construct().
|
protected |
Generate a UTC date/time string from a date parsable by strtotime().
string | $DateTime | Date/Time from which to generate the date string. |
Definition at line 423 of file iCalendar.php.
Referenced by AddCreated(), GenerateDocument(), and GenerateUID().
|
static |
Helper method to transform an HTML string to plain text.
string | $HTML | HTML string to transform. |
Definition at line 245 of file iCalendar.php.
|
protected |
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().
|
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().