Properties

$calendar

$calendar : string

The current calendar.

Type

string

$backgroundColor

$backgroundColor : string

The HTML background color to be used for this event.

Type

string

$foregroundColor

$foregroundColor : string

The HTML foreground color to be used for this event.

Type

string

$_params

$_params : array

A hash containing any parameters for the current driver.

Type

array

$_cache

$_cache : array

Cache events as we fetch them to avoid fetching or parsing the same event twice.

Type

array

$_client

$_client : \Sabre\DAV\Client

DAV client object.

Type

\Sabre\DAV\Client

$_davSupport

$_davSupport : array

A list of DAV support levels.

Type

array

$_permission

$_permission : integer

The Horde_Perms permissions mask matching the CalDAV ACL.

Type

integer

$_errormsg

$_errormsg : string

An error message to throw when something is wrong.

Type

string

Methods

__construct()

__construct(array  $params = array(), string  $errormsg = null) 

Constructor.

Just stores the $params in our newly-created object. All other work is done by \initialize().

Parameters

array $params

Any parameters needed for this driver.

string $errormsg

A custom error message to use.

getParam()

getParam(string  $param) : mixed

Returns a configuration for this driver.

Parameters

string $param

A parameter name.

Returns

mixed —

The parameter value or null if not set.

setParam()

setParam(string  $param, mixed  $value) 

Sets a configuration for this driver.

Parameters

string $param

A parameter name.

mixed $value

The parameter value.

setParams()

setParams(string  $params) 

Sets all configuration parameters for this driver.

Parameters

string $params

A parameters hash.

open()

open(string  $calendar) 

Selects a calendar as the currently opened calendar.

Parameters

string $calendar

A calendar identifier.

backgroundColor()

backgroundColor() : string

Returns the background color of the current calendar.

Returns

string —

The calendar color.

colors()

colors() : array

Returns the colors of the current calendar.

Returns

array —

The calendar background and foreground color.

supportsTimezones()

supportsTimezones() : boolean

Returns whether this driver supports per-event timezones.

Returns

boolean —

Whether this drivers suppports per-event timezones.

search()

search(object  $query, boolean  $json = false) : array

Searches a calendar.

Parameters

object $query

An object with the criteria to search for.

boolean $json

Store the results of the events' toJson() method?

Throws

\Kronolith_Exception

Returns

array —

An array of search results keyed by date, with each date containing an array of Kronolith_Events occuring on that date.

nextRecurrence()

nextRecurrence(string  $eventId, \Horde_Date  $afterDate) : \Horde_Date|boolean

Finds the next recurrence of $eventId that's after $afterDate.

Parameters

string $eventId

The ID of the event to fetch.

\Horde_Date $afterDate

Return events after this date.

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

Returns

\Horde_Date|boolean —

The date of the next recurrence or false if the event does not recur after $afterDate.

countEvents()

countEvents() : integer

Returns the number of events in the current calendar.

Throws

\Kronolith_Exception

Returns

integer —

The number of events.

initialize()

initialize() 

Stub to initiate a driver.

Throws

\Kronolith_Exception

getEvent()

getEvent(  $eventId = null) 

Stub to be overridden in the child class.

Parameters

$eventId

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

getByUID()

getByUID(  $uid,   $calendars = null,   $getAll = false) 

Stub to be overridden in the child class.

Parameters

$uid
$calendars
$getAll

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

listAlarms()

listAlarms(  $date,   $fullevent = false) 

Stub to be overridden in the child class.

Parameters

$date
$fullevent

listEvents()

listEvents(\Horde_Date  $startDate = null, \Horde_Date  $endDate = null, array  $options = array()) 

Lists all events in the time range, optionally restricting results to only events with alarms.

Parameters

\Horde_Date $startDate

The start of range date.

\Horde_Date $endDate

The end of date range.

array $options

Additional options:

  • show_recurrence: (boolean) Return every instance of a recurring event? DEFAULT: false (Only return recurring events once inside $startDate - $endDate range)
  • has_alarm: (boolean) Only return events with alarms. DEFAULT: false (Return all events)
  • json: (boolean) Store the results of the event's toJson() method? DEFAULT: false
  • cover_dates: (boolean) Add the events to all days that they cover? DEFAULT: true
  • hide_exceptions: (boolean) Hide events that represent exceptions to a recurring event. DEFAULT: false (Do not hide exception events)
  • fetch_tags: (boolean) Fetch tags for all events. DEFAULT: false (Do not fetch event tags)

Throws

\Kronolith_Exception

saveEvent()

saveEvent(\Kronolith_Event  $event) : string

Saves an event in the backend.

If it is a new event, it is added, otherwise the event is updated.

Parameters

\Kronolith_Event $event

The event to save.

Throws

\Horde_Mime_Exception
\Kronolith_Exception

Returns

string —

The event id.

exists()

exists(  $uid,   $calendar_id = null) 

Stub for child class to override if it can implement.

Parameters

$uid
$calendar_id

Throws

\Kronolith_Exception

move()

move(string  $eventId, string  $newCalendar) 

Moves an event to a new calendar.

Parameters

string $eventId

The event to move.

string $newCalendar

The new calendar.

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

delete()

delete(  $calendar) 

Stub to be overridden in the child class.

Note: This method only "Purges" the calendar - removing the events, it doesn't remove the calendar itself.

Parameters

$calendar

Throws

\Kronolith_Exception

deleteEvent()

deleteEvent(mixed  $eventId, boolean  $silent = false) 

Deletes an event.

Parameters

mixed $eventId

Either the event id to delete, or the event object.

boolean $silent

Don't send notifications, used when deleting events in bulk from maintenance tasks.

Throws

\Kronolith_Exception
\Horde_Exception_NotFound
\Horde_Mime_Exception

filterEventsByCalendar()

filterEventsByCalendar(  $uids,   $calendar) 

Stub to be overridden in the child class if it can implement.

Parameters

$uids
$calendar

Throws

\Kronolith_Exception

removeUserData()

removeUserData(  $user) 

Stub for child class to override if it can implement.

Parameters

$user

Throws

\Kronolith_Exception

synchronize()

synchronize(boolean  $force = false, string  $token = false) 

Synchronize if driver needs to.

Parameters

boolean $force

If true, forces synchronization, even if we have already done so.

string $token

A synchroniziation token, if available.

getRemoteCalendar()

getRemoteCalendar(boolean  $cache = true) : \Horde_Icalendar

Fetches a remote calendar into the cache and return the data.

Parameters

boolean $cache

Whether to return data from the cache.

Throws

\Kronolith_Exception

Returns

\Horde_Icalendar —

The calendar data.

isCalDAV()

isCalDAV() : boolean

Returns whether the remote calendar is a CalDAV server, and propagates the $_davSupport propery with the server's DAV capabilities.

Throws

\Kronolith_Exception

Returns

boolean —

True if the remote calendar is a CalDAV server.

getCalendarInfo()

getCalendarInfo() : array

Returns calendar information.

Returns

array —

A hash with the keys 'name', 'desc', and 'color'.

getPermission()

getPermission() : integer

Returns the permissions for the current calendar.

Returns

integer —

A Horde_Perms permission bit mask.

_listEvents()

_listEvents(\Horde_Date  $startDate = null, \Horde_Date  $endDate = null, array  $options = array()) 

Lists all events in the time range, optionally restricting results to only events with alarms.

Parameters

\Horde_Date $startDate

The start of range date.

\Horde_Date $endDate

The end of date range.

array $options

Additional options:

  • show_recurrence: (boolean) Return every instance of a recurring event? DEFAULT: false (Only return recurring events once inside $startDate - $endDate range)
  • has_alarm: (boolean) Only return events with alarms. DEFAULT: false (Return all events)
  • json: (boolean) Store the results of the event's toJson() method? DEFAULT: false
  • cover_dates: (boolean) Add the events to all days that they cover? DEFAULT: true
  • hide_exceptions: (boolean) Hide events that represent exceptions to a recurring event. DEFAULT: false (Do not hide exception events)
  • fetch_tags: (boolean) Fetch tags for all events. DEFAULT: false (Do not fetch event tags)

Throws

\Kronolith_Exception

_addEvent()

_addEvent(\Kronolith_Event  $event) : string

Adds an event to the backend.

Parameters

\Kronolith_Event $event

The event to save.

Throws

\Horde_Mime_Exception
\Kronolith_Exception

Returns

string —

The event id.

_updateEvent()

_updateEvent(\Kronolith_Event  $event) : string

Updates an existing event in the backend.

Parameters

\Kronolith_Event $event

The event to save.

Throws

\Horde_Mime_Exception
\Kronolith_Exception

Returns

string —

The event id.

_move()

_move(  $eventId,   $newCalendar) 

Stub to be overridden in the child class.

Parameters

$eventId
$newCalendar

Throws

\Kronolith_Exception

_deleteEvent()

_deleteEvent(string  $eventId, boolean  $silent = false) : \Kronolith_Event

Deletes an event.

Parameters

string $eventId

The ID of the event to delete.

boolean $silent

Don't send notifications, used when deleting events in bulk from maintenance tasks.

Throws

\Kronolith_Exception
\Horde_Exception_NotFound
\Horde_Mime_Exception

Returns

\Kronolith_Event

Returns the deleted event.

_handleNotifications()

_handleNotifications(\Kronolith_Event  $event, string  $action) 

Wrapper for sending notifications, so that we can overwrite this action in Kronolith_Driver_Resource.

Parameters

\Kronolith_Event $event
string $action

_updateTags()

_updateTags(\Kronolith_Event  $event) 

Helper function to update an existing event's tags to tagger storage.

Parameters

\Kronolith_Event $event

The event to update

_addTags()

_addTags(\Kronolith_Event  $event) 

Helper function to add tags from a newly creted event to the tagger.

Parameters

\Kronolith_Event $event

The event to save tags to storage for.

_listWebDAVEvents()

_listWebDAVEvents(  $startDate = null,   $endDate = null, boolean  $showRecurrence = false, boolean  $hasAlarm = false, boolean  $json = false, boolean  $coverDates = true,   $hideExceptions = false) : array

Lists all events in the time range, optionally restricting results to only events with alarms.

Parameters

$startDate
$endDate
boolean $showRecurrence

Return every instance of a recurring event? If false, will only return recurring events once inside the $startDate - $endDate range.

boolean $hasAlarm

Only return events with alarms?

boolean $json

Store the results of the events' toJson() method?

boolean $coverDates

Whether to add the events to all days that they cover. $param boolean $hideExceptions Hide events that represent exceptions to a recurring event.

$hideExceptions

Throws

\Kronolith_Exception

Returns

array —

Events in the given time range.

_listCalDAVEvents()

_listCalDAVEvents(  $startDate = null,   $endDate = null, boolean  $showRecurrence = false, boolean  $hasAlarm = false, boolean  $json = false, boolean  $coverDates = true,   $hideExceptions = false) : array

Lists all events in the time range, optionally restricting results to only events with alarms.

Parameters

$startDate
$endDate
boolean $showRecurrence

Return every instance of a recurring event? If false, will only return recurring events once inside the $startDate - $endDate range.

boolean $hasAlarm

Only return events with alarms?

boolean $json

Store the results of the events' toJson() method?

boolean $coverDates

Whether to add the events to all days that they cover. $param boolean $hideExceptions Hide events that represent exceptions to a recurring event.

$hideExceptions

Throws

\Kronolith_Exception

Returns

array —

Events in the given time range.

_convertEvents()

_convertEvents(\Horde_Icalendar  $ical) : array

Converts all components of a Horde_Icalendar container into a Kronolith_Event list.

Parameters

\Horde_Icalendar $ical

A Horde_Icalendar container.

Throws

\Kronolith_Exception

Returns

array —

List of Kronolith_Event_Ical objects.

_processComponents()

_processComponents(array  $results, array  $events,   $startDate,   $endDate, boolean  $showRecurrence, boolean  $json, boolean  $coverDates, boolean  $hideExceptions, string  $id = null) 

Processes the components of a Horde_Icalendar container into an event list.

Parameters

array $results

Gets filled with the events in the given time range.

array $events

A list of Kronolith_Event_Ical objects.

$startDate
$endDate
boolean $showRecurrence

Return every instance of a recurring event? If false, will only return recurring events once inside the $startDate - $endDate range.

boolean $json

Store the results of the events' toJson() method?

boolean $coverDates

Whether to add the events to all days that they cover.

boolean $hideExceptions

Hide events that represent exceptions to a recurring event.

string $id

Enforce a certain event id (not UID).

Throws

\Kronolith_Exception

_saveEvent()

_saveEvent(\Kronolith_Event  $event) : \Sabre\HTTP\ResponseInterface

Updates an existing event in the backend.

Parameters

\Kronolith_Event $event

The event to save.

Throws

\Horde_Mime_Exception
\Kronolith_Exception

Returns

\Sabre\HTTP\ResponseInterface —

The HTTP response.

_getRemoteEvents()

_getRemoteEvents() : array

Fetches a remote calendar and converts it to Kronolith_Event objects.

The converted event objects will be cached for an hour.

Throws

\Kronolith_Exception

Returns

array —

List of Kronolith_Event_Ical objects.

_request()

_request(string  $method, string  $url, \XMLWriter  $xml = null, array  $headers = array()) : array

Sends a CalDAV request.

Parameters

string $method

A request method.

string $url

A request URL.

\XMLWriter $xml

An XMLWriter object with the body content.

array $headers

A hash with additional request headers.

Throws

\Kronolith_Exception

Returns

array —

The Horde_Http_Response object and the parsed SimpleXMLElement results.

_getUrl()

_getUrl() : string

Returns the URL of this calendar.

Does any necessary trimming and URL scheme fixes on the user-provided calendar URL.

Returns

string —

The URL of this calendar.

_getClient()

_getClient(string  $uri) : \Sabre\DAV\Client

Returns a configured, cached DAV client.

Parameters

string $uri

The base URI for any requests.

Throws

\Sabre\DAV\Exception
\Sabre\HTTP\ClientException

Returns

\Sabre\DAV\Client —

A DAV client.