\Kronolith_Driver_Horde

The Kronolith_Driver_Horde class implements the Kronolith_Driver API for time objects retrieved from other Horde applications.

Possible driver parameters:

Copyright 2009-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Summary

Methods
Properties
Constants
__construct()
getParam()
setParam()
setParams()
open()
backgroundColor()
colors()
supportsTimezones()
search()
nextRecurrence()
countEvents()
initialize()
getEvent()
getByUID()
listAlarms()
listEvents()
saveEvent()
exists()
move()
delete()
deleteEvent()
filterEventsByCalendar()
removeUserData()
synchronize()
$calendar
$backgroundColor
$foregroundColor
$api
No constants found
_listEvents()
_addEvent()
_updateEvent()
_move()
_deleteEvent()
_handleNotifications()
_updateTags()
_addTags()
$_params
N/A
No private methods found
$_errormsg
N/A

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

$api

$api : string

The API (application) of the current calendar.

Type

string

$_params

$_params : array

A hash containing any parameters for the current driver.

Type

array

$_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,   $start = null) 

Stub to be overridden in the child class.

Parameters

$eventId
$start

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.

_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) 

Stub to be overridden in the child class.

Parameters

\Kronolith_Event $event

Throws

\Kronolith_Exception

_updateEvent()

_updateEvent(\Kronolith_Event_Horde  $event) : string

Updates an existing event in the backend.

Parameters

\Kronolith_Event_Horde $event

The event to save.

Throws

\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(mixed  $eventId) : \Kronolith_Event

Stub to be overridden in the child class.

Parameters

mixed $eventId

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

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.