Horde_Icalendar_Vfreebusy
extends Horde_Icalendar
in package
Class representing vFreebusy components.
Tags
Table of Contents
- $type : string
- The component type of this class.
- $_attributes : array<string|int, mixed>
- 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.
- $_busyPeriods : array<string|int, mixed>
- TODO
- $_components : array<string|int, mixed>
- Any children (contained) iCalendar components of this object.
- $_container : Horde_Icalendar
- The parent (containing) iCalendar object.
- $_extraParams : array<string|int, mixed>
- TODO
- $_newline : string
- According to RFC 2425, we should always use CRLF-terminated lines.
- $_oldFormat : mixed
- Whether entry is vcalendar 1.0, vcard 2.1 or vnote 1.1.
- $_version : string
- iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).
- __construct() : mixed
- Constructor.
- _exportDateTime() : string
- Export a DateTime field.
- _exportUtcOffset() : TODO
- Export a UTC Offset field.
- _getEndDifference() : bool
- 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.
- _parseDate() : array<string|int, mixed>
- Parses a Date field.
- _parseDateTime() : int
- Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.
- addBusyPeriod() : mixed
- Adds a busy period to the info.
- addComponent() : mixed
- Add a vCalendar component (eg vEvent, vTimezone, etc.).
- clear() : mixed
- Clears the iCalendar object (resets the components and attributes arrays).
- exportvCalendar() : string
- Returns the component exported as string.
- findComponent() : mixed
- Locates the first child component of the specified class, and returns a reference to it.
- findComponentByAttribute() : mixed
- Locates the first matching child component of the specified class, and returns a reference to it.
- getAllAttributes() : array<string|int, mixed>
- Get attributes for all tags or for a given tag.
- getAttribute() : mixed
- Get the value of an attribute.
- getAttributeDefault() : mixed
- Returns the value of an attribute, or a specified default value if the attribute does not exist.
- getAttributeSingle() : string
- Get a single value of an attribute.
- getAttributeValues() : array<string|int, mixed>
- Gets the values of an attribute as an array. Multiple values are possible due to:
- getBusyPeriods() : array<string|int, mixed>
- Returns the busy periods.
- getComponent() : mixed
- Retrieve a specific component.
- getComponentClasses() : array<string|int, mixed>
- Return the classes (entry types) we have.
- getComponentCount() : int
- Number of components in this container.
- getComponents() : array<string|int, mixed>
- Retrieve all the components.
- getEmail() : string
- Returns the email address for this object.
- getEnd() : int
- Returns the timestamp of the end of the time period this free busy information covers.
- getExtraParams() : array<string|int, mixed>
- Returns any additional freebusy parameters.
- getFreePeriods() : array<string|int, mixed>
- Returns all the free periods of time in a given period.
- getName() : string
- Returns a display name for this object.
- getStart() : int
- Returns the timestamp of the start of the time period this free busy information covers.
- getType() : TODO
- TODO
- merge() : mixed
- Merges the busy periods of another Horde_Icalendar_Vfreebusy object into this one.
- newComponent() : object
- Return a reference to a new component.
- parsevCalendar() : bool
- Parses a string containing vFreebusy data.
- removeAttribute() : mixed
- Remove all occurences of an attribute.
- setAttribute() : mixed
- Sets the value of an attribute.
- setParameter() : bool
- Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.
- setVersion() : mixed
- Sets the version of this component.
- simplify() : mixed
- Removes all overlaps and simplifies the busy periods array as much as possible.
- toHash() : array<string|int, mixed>
- Export this entry as a hash array with tag names as keys.
- toString() : mixed
- _checkEndDate() : bool
- Utility method to aid in checking the end date of a transition.
- _exportDate() : TODO
- Exports a date field.
- _exportDuration() : mixed
- Export a duration value.
- _exportPeriod() : TODO
- Export a Time Period field.
- _exportvData() : string
- Export this component in vCal format.
- _parseDuration() : int
- Parses a DURATION value field.
- _parsePeriod() : array<string|int, mixed>
- Parse a Time Period field.
- _parseTime() : TODO
- Parses a Time field.
- _parseTZID() : int
- Groks the TZID and returns an offset in seconds from UTC for this date and time.
- _parseUtcOffset() : TODO
- Parse a UTC Offset field.
- _simplify() : array<string|int, mixed>
- TODO
Properties
$type
The component type of this class.
public
string
$type
= 'vFreebusy'
$_attributes
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.
protected
array<string|int, mixed>
$_attributes
= array()
$_busyPeriods
TODO
protected
array<string|int, mixed>
$_busyPeriods
= array()
$_components
Any children (contained) iCalendar components of this object.
protected
array<string|int, mixed>
$_components
= array()
$_container
The parent (containing) iCalendar object.
protected
Horde_Icalendar
$_container
= \false
$_extraParams
TODO
protected
array<string|int, mixed>
$_extraParams
= array()
$_newline
According to RFC 2425, we should always use CRLF-terminated lines.
protected
string
$_newline
= "\r\n"
$_oldFormat
Whether entry is vcalendar 1.0, vcard 2.1 or vnote 1.1.
protected
mixed
$_oldFormat
= \true
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.
$_version
iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).
protected
string
$_version
Methods
__construct()
Constructor.
public
__construct([mixed $version = '2.0' ]) : mixed
Parameters
- $version : mixed = '2.0'
Return values
mixed —_exportDateTime()
Export a DateTime field.
public
_exportDateTime(int|object|array<string|int, mixed> $value[, bool $floating = false ]) : string
Parameters
- $value : int|object|array<string|int, mixed>
-
The time value to export (either a Horde_Date, array, or timestamp).
- $floating : bool = false
-
Whether to return a floating date-time (without time zone information).
Tags
Return values
string —The string representation of the datetime value.
_exportUtcOffset()
Export a UTC Offset field.
public
_exportUtcOffset( $value) : TODO
Parameters
Return values
TODO —_getEndDifference()
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.
public
static _getEndDifference(mixed $a, mixed $b) : bool
Parameters
- $a : mixed
- $b : mixed
Tags
Return values
bool —True if $a < $b otherwise false.
_parseDate()
Parses a Date field.
public
_parseDate( $text) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —TODO
_parseDateTime()
Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.
public
_parseDateTime(string $text[, string $tzid = false ]) : int
Parameters
- $text : string
-
The Icalendar datetime field value.
- $tzid : string = false
-
A timezone identifier.
Tags
Return values
int —A unix timestamp.
addBusyPeriod()
Adds a busy period to the info.
public
addBusyPeriod(string $type, int $start[, int $end = null ][, int $duration = null ][, array<string|int, mixed> $extra = array() ]) : mixed
This function may throw away data in case you add a period with a start date that already exists. The longer of the two periods will be chosen (and all information associated with the shorter one will be removed).
Parameters
- $type : string
-
The type of the period. Either 'FREE' or 'BUSY'; only 'BUSY' supported at the moment.
- $start : int
-
The start timestamp of the period.
- $end : int = null
-
The end timestamp of the period.
- $duration : int = null
-
The duration of the period. If specified, the $end parameter will be ignored.
- $extra : array<string|int, mixed> = array()
-
Additional parameters for this busy period.
Return values
mixed —addComponent()
Add a vCalendar component (eg vEvent, vTimezone, etc.).
public
addComponent(mixed $components) : mixed
Parameters
- $components : mixed
Return values
mixed —clear()
Clears the iCalendar object (resets the components and attributes arrays).
public
clear() : mixed
Return values
mixed —exportvCalendar()
Returns the component exported as string.
public
exportvCalendar() : string
Return values
string —The exported vFreeBusy information according to the iCalendar format specification.
findComponent()
Locates the first child component of the specified class, and returns a reference to it.
public
findComponent(mixed $childclass) : mixed
Parameters
- $childclass : mixed
Return values
mixed —findComponentByAttribute()
Locates the first matching child component of the specified class, and returns a reference to it.
public
findComponentByAttribute(string $childclass, string $attribute[, string $value = null ]) : mixed
Parameters
- $childclass : string
-
The type of component to find.
- $attribute : string
-
This attribute must be set in the component for it to match.
- $value : string = null
-
Optional value that $attribute must match.
Return values
mixed —getAllAttributes()
Get attributes for all tags or for a given tag.
public
getAllAttributes([string $tag = false ]) : array<string|int, mixed>
Parameters
- $tag : string = false
-
Return attributes for this tag, or all attributes if not given.
Return values
array<string|int, mixed> —An array containing all the attributes and their types.
getAttribute()
Get the value of an attribute.
public
getAttribute(string $name[, bool $params = false ]) : mixed
Parameters
- $name : string
-
The name of the attribute.
- $params : bool = false
-
Return the parameters for this attribute instead of its value.
Tags
Return values
mixed —(string) The value of the attribute. (array) The parameters for the attribute or multiple values for an attribute.
getAttributeDefault()
Returns the value of an attribute, or a specified default value if the attribute does not exist.
public
getAttributeDefault(string $name[, mixed $default = '' ]) : mixed
Parameters
- $name : string
-
The name of the attribute.
- $default : mixed = ''
-
What to return if the attribute specified by $name does not exist.
Return values
mixed —(mixed) The value of $name. (mixed) $default if $name does not exist.
getAttributeSingle()
Get a single value of an attribute.
public
getAttributeSingle(string $name) : string
If multiple values, is auto-determined by library which is preferred value to return.
Parameters
- $name : string
-
The name of the attribute.
Tags
Return values
string —The value of the attribute.
getAttributeValues()
Gets the values of an attribute as an array. Multiple values are possible due to:
public
getAttributeValues(string $name) : array<string|int, mixed>
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
- $name : string
-
The name of the attribute.
Tags
Return values
array<string|int, mixed> —Multiple values for an attribute.
getBusyPeriods()
Returns the busy periods.
public
getBusyPeriods() : array<string|int, mixed>
Return values
array<string|int, mixed> —All busy periods.
getComponent()
Retrieve a specific component.
public
getComponent(int $idx) : mixed
Parameters
- $idx : int
-
The index of the object to retrieve.
Return values
mixed —(boolean) False if the index does not exist. (Horde_Icalendar_*) The requested component.
getComponentClasses()
Return the classes (entry types) we have.
public
getComponentClasses() : array<string|int, mixed>
Return values
array<string|int, mixed> —Hash with class names Horde_Icalendar_xxx as keys and number of components of this class as value.
getComponentCount()
Number of components in this container.
public
getComponentCount() : int
Return values
int —Number of components in this container.
getComponents()
Retrieve all the components.
public
getComponents() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of Horde_Icalendar objects.
getEmail()
Returns the email address for this object.
public
getEmail() : string
Return values
string —The email address of this object's owner.
getEnd()
Returns the timestamp of the end of the time period this free busy information covers.
public
getEnd() : int
Return values
int —A timestamp.
getExtraParams()
Returns any additional freebusy parameters.
public
getExtraParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —Additional parameters of the freebusy periods.
getFreePeriods()
Returns all the free periods of time in a given period.
public
getFreePeriods(int $startStamp, int $endStamp) : array<string|int, mixed>
Parameters
- $startStamp : int
-
The start timestamp.
- $endStamp : int
-
The end timestamp.
Return values
array<string|int, mixed> —A hash with free time periods, the start times as the keys and the end times as the values.
getName()
Returns a display name for this object.
public
getName() : string
Return values
string —A clear text name for displaying this object.
getStart()
Returns the timestamp of the start of the time period this free busy information covers.
public
getStart() : int
Return values
int —A timestamp.
getType()
TODO
public
getType() : TODO
Return values
TODO —merge()
Merges the busy periods of another Horde_Icalendar_Vfreebusy object into this one.
public
merge(Horde_Icalendar_Vfreebusy $freebusy[, bool $simplify = true ]) : mixed
This might lead to simplification no matter what you specify for the "simplify" flag since periods with the same start date will lead to the shorter period being removed (see addBusyPeriod).
Parameters
- $freebusy : Horde_Icalendar_Vfreebusy
-
A freebusy object.
- $simplify : bool = true
-
If true, simplify() will called after the merge.
Return values
mixed —newComponent()
Return a reference to a new component.
public
static newComponent(string $type, Horde_Icalendar $container) : object
Parameters
- $type : string
-
The type of component to return
- $container : Horde_Icalendar
-
A container that this component will be associated with.
Return values
object —Reference to a Horde_Icalendar_* object as specified.
parsevCalendar()
Parses a string containing vFreebusy data.
public
parsevCalendar(string $data[, $type = null ][, $charset = null ]) : bool
Parameters
Return values
bool —True on successful import, false otherwise.
removeAttribute()
Remove all occurences of an attribute.
public
removeAttribute(string $name) : mixed
Parameters
- $name : string
-
The name of the attribute.
Return values
mixed —setAttribute()
Sets the value of an attribute.
public
setAttribute(string $name, string $value[, array<string|int, mixed> $params = array() ][, bool $append = true ][, array<string|int, mixed> $values = false ]) : mixed
Parameters
- $name : string
-
The name of the attribute.
- $value : string
-
The value of the attribute.
- $params : array<string|int, mixed> = array()
-
Array containing any addition parameters for this attribute.
- $append : bool = true
-
True to append the attribute, False to replace the first matching attribute found.
- $values : array<string|int, mixed> = false
-
Array representation of $value. For comma/semicolon seperated lists of values. If not set use $value as single array element.
Return values
mixed —setParameter()
Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.
public
setParameter(string $name[, array<string|int, mixed> $params = array() ]) : bool
Parameters
- $name : string
-
The name of the attribute.
- $params : array<string|int, mixed> = array()
-
Array containing any additional parameters for this attribute.
Return values
bool —True on success, false if no attribute $name exists.
setVersion()
Sets the version of this component.
public
setVersion(string $version) : mixed
Parameters
- $version : string
-
A float-like version string.
Tags
Return values
mixed —simplify()
Removes all overlaps and simplifies the busy periods array as much as possible.
public
simplify() : mixed
Return values
mixed —toHash()
Export this entry as a hash array with tag names as keys.
public
toHash([bool $paramsInKeys = false ]) : array<string|int, mixed>
Parameters
- $paramsInKeys : bool = false
-
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'
Return values
array<string|int, mixed> —A hash array with tag names as keys.
toString()
public
toString() : mixed
Return values
mixed —_checkEndDate()
Utility method to aid in checking the end date of a transition.
protected
_checkEndDate(int $t, array<string|int, mixed> $times) : bool
Parameters
- $t : int
-
The timestamp of the date we are checking.
- $times : array<string|int, mixed>
-
A transition array.
Return values
bool —True if $t is before the end date of the transition otherwise false.
_exportDate()
Exports a date field.
protected
_exportDate(object|array<string|int, mixed> $value[, string $autoconvert = false ]) : TODO
Parameters
- $value : object|array<string|int, mixed>
-
Date object or hash.
- $autoconvert : string = false
-
If set, use this as time part to export the date as datetime when exporting to Vcalendar 1.0. Examples: '000000' or '235959'
Return values
TODO —_exportDuration()
Export a duration value.
protected
_exportDuration( $value) : mixed
Parameters
Return values
mixed —_exportPeriod()
Export a Time Period field.
protected
_exportPeriod( $value) : TODO
Parameters
Return values
TODO —_exportvData()
Export this component in vCal format.
protected
_exportvData([string $base = 'VCALENDAR' ]) : string
Parameters
- $base : string = 'VCALENDAR'
-
The type of the base object.
Return values
string —vCal format data.
_parseDuration()
Parses a DURATION value field.
protected
_parseDuration(string $text) : int
Parameters
- $text : string
-
A DURATION value.
Return values
int —The duration in seconds.
_parsePeriod()
Parse a Time Period field.
protected
_parsePeriod( $text) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —TODO
_parseTime()
Parses a Time field.
protected
_parseTime( $text) : TODO
Parameters
Return values
TODO —_parseTZID()
Groks the TZID and returns an offset in seconds from UTC for this date and time.
protected
_parseTZID(array<string|int, mixed> $date, array<string|int, mixed> $time, string $tzid) : int
Parameters
- $date : array<string|int, mixed>
-
A date hash.
- $time : array<string|int, mixed>
-
A time hash.
- $tzid : string
-
A timezone ID.
Return values
int —The offset from UTC in seconds for the provided timezone and date/time.
_parseUtcOffset()
Parse a UTC Offset field.
protected
_parseUtcOffset( $text) : TODO
Parameters
Return values
TODO —_simplify()
TODO
protected
_simplify( $busyPeriods[, array<string|int, mixed> $extraParams = array() ]) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —TODO