Properties

$type

$type : string

The component type of this class.

Type

string

$_container

$_container : \Horde_Icalendar

The parent (containing) iCalendar object.

Type

\Horde_Icalendar

$_attributes

$_attributes : array

The name/value pairs of attributes for this object (UID, DTSTART, etc.). Which are present depends on the object and on what kind of component it is.

Type

array

$_components

$_components : array

Any children (contained) iCalendar components of this object.

Type

array

$_newline

$_newline : string

According to RFC 2425, we should always use CRLF-terminated lines.

Type

string

$_version

$_version : string

iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).

Type

string

$_oldFormat

$_oldFormat : 

Whether entry is vcalendar 1.0, vcard 2.1 or vnote 1.1.

These 'old' formats are defined by www.imc.org. The 'new' (non-old) formats icalendar 2.0 and vcard 3.0 are defined in rfc2426 and rfc2445 respectively.

Type

Methods

__construct()

__construct(  $version = '1.1') 

Constructor.

Parameters

$version

newComponent()

newComponent(string  $type, \Horde_Icalendar  $container) : object

Return a reference to a new component.

Parameters

string $type

The type of component to return

\Horde_Icalendar $container

A container that this component will be associated with.

Returns

object —

Reference to a HordeIcalendar* object as specified.

setVersion()

setVersion(string  $version) 

Sets the version of this component.

Parameters

string $version

A float-like version string.

setAttribute()

setAttribute(string  $name, string  $value, array  $params = array(), boolean  $append = true, array  $values = false) 

Sets the value of an attribute.

Parameters

string $name

The name of the attribute.

string $value

The value of the attribute.

array $params

Array containing any addition parameters for this attribute.

boolean $append

True to append the attribute, False to replace the first matching attribute found.

array $values

Array representation of $value. For comma/semicolon seperated lists of values. If not set use $value as single array element.

setParameter()

setParameter(string  $name, array  $params = array()) : boolean

Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.

Parameters

string $name

The name of the attribute.

array $params

Array containing any additional parameters for this attribute.

Returns

boolean —

True on success, false if no attribute $name exists.

getAttribute()

getAttribute(string  $name, boolean  $params = false) : mixed

Get the value of an attribute.

Parameters

string $name

The name of the attribute.

boolean $params

Return the parameters for this attribute instead of its value.

Throws

\Horde_Icalendar_Exception

Returns

mixed —

(string) The value of the attribute. (array) The parameters for the attribute or multiple values for an attribute.

getAttributeSingle()

getAttributeSingle(string  $name) : string

Get a single value of an attribute.

If multiple values, is auto-determined by library which is preferred value to return.

Parameters

string $name

The name of the attribute.

Throws

\Horde_Icalendar_Exception

Returns

string —

The value of the attribute.

getAttributeValues()

getAttributeValues(string  $name) : array

Gets the values of an attribute as an array. Multiple values are possible due to:

a) multiple occurences of 'name' b) (unsecapd) comma seperated lists.

So for a vcard like "KEY:a,b\nKEY:c" getAttributesValues('KEY') will return array('a', 'b', 'c').

Parameters

string $name

The name of the attribute.

Throws

\Horde_Icalendar_Exception

Returns

array —

Multiple values for an attribute.

getAttributeDefault()

getAttributeDefault(string  $name, mixed  $default = '') : mixed

Returns the value of an attribute, or a specified default value if the attribute does not exist.

Parameters

string $name

The name of the attribute.

mixed $default

What to return if the attribute specified by $name does not exist.

Returns

mixed —

(mixed) The value of $name. (mixed) $default if $name does not exist.

removeAttribute()

removeAttribute(string  $name) 

Remove all occurences of an attribute.

Parameters

string $name

The name of the attribute.

getAllAttributes()

getAllAttributes(string  $tag = false) : array

Get attributes for all tags or for a given tag.

Parameters

string $tag

Return attributes for this tag, or all attributes if not given.

Returns

array —

An array containing all the attributes and their types.

addComponent()

addComponent(  $components) 

Add a vCalendar component (eg vEvent, vTimezone, etc.).

Parameters

$components

getComponents()

getComponents() : array

Retrieve all the components.

Returns

array —

Array of Horde_Icalendar objects.

getType()

getType() : \TODO

TODO

Returns

\TODO

getComponentClasses()

getComponentClasses() : array

Return the classes (entry types) we have.

Returns

array —

Hash with class names Horde_Icalendar_xxx as keys and number of components of this class as value.

getComponentCount()

getComponentCount() : integer

Number of components in this container.

Returns

integer —

Number of components in this container.

getComponent()

getComponent(integer  $idx) : mixed

Retrieve a specific component.

Parameters

integer $idx

The index of the object to retrieve.

Returns

mixed —

(boolean) False if the index does not exist. (HordeIcalendar*) The requested component.

findComponent()

findComponent(  $childclass) : boolean|\Horde_Icalendar_*

Locates the first child component of the specified class, and returns a reference to it.

Parameters

$childclass

Returns

boolean|\Horde_Icalendar_* —

False if no subcomponent of the specified class exists or the requested component.

findComponentByAttribute()

findComponentByAttribute(string  $childclass, string  $attribute, string  $value = null) : boolean|\Horde_Icalendar_*

Locates the first matching child component of the specified class, and returns a reference to it.

Parameters

string $childclass

The type of component to find.

string $attribute

This attribute must be set in the component for it to match.

string $value

Optional value that $attribute must match.

Returns

boolean|\Horde_Icalendar_* —

False if no matching subcomponent of the specified class exists, or the requested component.

clear()

clear() 

Clears the iCalendar object (resets the components and attributes arrays).

toString()

toString() 

exportvCalendar()

exportvCalendar() : \TODO

Unlike vevent and vtodo, a vnote is normally not enclosed in an iCalendar container. (BEGIN.

.END)

Returns

\TODO

toHash()

toHash(boolean  $paramsInKeys = false) : array

Export this entry as a hash array with tag names as keys.

Parameters

boolean $paramsInKeys

If false, the operation can be quite lossy as the parameters are ignored when building the array keys. So if you export a vcard with LABEL;TYPE=WORK:foo LABEL;TYPE=HOME:bar the resulting hash contains only one label field! If set to true, array keys look like 'LABEL;TYPE=WORK'

Returns

array —

A hash array with tag names as keys.

parsevCalendar()

parsevCalendar(string  $text, string  $base = 'VCALENDAR', boolean  $clear = true) : boolean

Parses a string containing vCalendar data.

Parameters

string $text

The data to parse.

string $base

The type of the base object.

boolean $clear

If true clears this object before parsing.

Throws

\Horde_Icalendar_Exception

Returns

boolean —

True on successful import, false otherwise.

_exportUtcOffset()

_exportUtcOffset(  $value) : \TODO

Export a UTC Offset field.

Parameters

$value

TODO

Returns

\TODO

_getEndDifference()

_getEndDifference(  $a,   $b) : boolean

Returns the difference between the datetime indicated by $a and the datetime indicated by $b after normalizing both values to a unix timestamp. Used when sorting timezone transitions that may contain mixed format end times.

Parameters

$a
$b

Returns

boolean —

True if $a < $b otherwise false.

_parseDateTime()

_parseDateTime(string  $text, string  $tzid = false) : integer

Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.

Parameters

string $text

The Icalendar datetime field value.

string $tzid

A timezone identifier.

Returns

integer —

A unix timestamp.

_exportDateTime()

_exportDateTime(integer|object|array  $value, boolean  $floating = false) : string

Export a DateTime field.

Parameters

integer|object|array $value

The time value to export (either a Horde_Date, array, or timestamp).

boolean $floating

Whether to return a floating date-time (without time zone information).

Returns

string —

The string representation of the datetime value.

_parseDate()

_parseDate(  $text) : array

Parses a Date field.

Parameters

$text

TODO

Returns

array —

TODO

_exportvData()

_exportvData(string  $base = 'VCALENDAR') : string

Export this component in vCal format.

Parameters

string $base

The type of the base object.

Returns

string —

vCal format data.

_parseUtcOffset()

_parseUtcOffset(  $text) : \TODO

Parse a UTC Offset field.

Parameters

$text

TODO

Returns

\TODO

_parsePeriod()

_parsePeriod(  $text) : array

Parse a Time Period field.

Parameters

$text

TODO

Returns

array —

TODO

_exportPeriod()

_exportPeriod(  $value) : \TODO

Export a Time Period field.

Parameters

$value

TODO

Returns

\TODO

_parseTZID()

_parseTZID(array  $date, array  $time, string  $tzid) : integer

Groks the TZID and returns an offset in seconds from UTC for this date and time.

Parameters

array $date

A date hash.

array $time

A time hash.

string $tzid

A timezone ID.

Returns

integer —

The offset from UTC in seconds for the provided timezone and date/time.

_checkEndDate()

_checkEndDate(integer  $t, array  $times) : boolean

Utility method to aid in checking the end date of a transition.

Parameters

integer $t

The timestamp of the date we are checking.

array $times

A transition array.

Returns

boolean —

True if $t is before the end date of the transition otherwise false.

_parseTime()

_parseTime(  $text) : \TODO

Parses a Time field.

Parameters

$text

TODO

Returns

\TODO

_exportDate()

_exportDate(object|array  $value, string  $autoconvert = false) : \TODO

Exports a date field.

Parameters

object|array $value

Date object or hash.

string $autoconvert

If set, use this as time part to export the date as datetime when exporting to Vcalendar 1.0. Examples: '000000' or '235959'

Returns

\TODO

_parseDuration()

_parseDuration(string  $text) : integer

Parses a DURATION value field.

Parameters

string $text

A DURATION value.

Returns

integer —

The duration in seconds.

_exportDuration()

_exportDuration(  $value) 

Export a duration value.

Parameters

$value

TODO