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

$_db

$_db : \Horde_Db_Adapter

The object handle for the current database connection.

Type

\Horde_Db_Adapter

$_columns

$_columns : array

Column information as Horde_Db_Adapter_Base_Column objects.

Type

array

$_cache

$_cache : array

Cache events as we fetch them to avoid fetching the same event from the DB twice.

Type

array

$_eventClass

$_eventClass : string

The class name of the event object to instantiate.

Can be overwritten by sub-classes.

Type

string

$_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) : mixed

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

mixed —

An array of Kronolith_Events.

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

Attempts to open a connection to the SQL server.

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(string  $uid, array  $calendars = null, boolean  $getAll = false) : \Kronolith_Event

Get an event or events with the given UID value.

Parameters

string $uid

The UID to match

array $calendars

A restricted array of calendar ids to search

boolean $getAll

Return all matching events?

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

Returns

\Kronolith_Event

listAlarms()

listAlarms(\Horde_Date  $date, boolean  $fullevent = false) : array

Stub to be overridden in the child class.

Parameters

\Horde_Date $date

The date to list alarms for

boolean $fullevent

Return the full event objects?

Throws

\Kronolith_Exception

Returns

array —

An array of event ids, or Kronolith_Event objects

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(string  $uid, string  $calendar_id = null) : string|boolean

Checks if the event's UID already exists and returns all event ids with that UID.

Parameters

string $uid

The event's uid.

string $calendar_id

Calendar to search in.

Throws

\Kronolith_Exception

Returns

string|boolean —

Returns a string with event_id or false if not found.

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(string  $calendar) 

Delete all of a calendar's events.

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

Parameters

string $calendar

The name of the calendar to delete.

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(array  $uids, array  $calendar) : array

Filters a list of events to return only those that belong to certain calendars.

Parameters

array $uids

A list of event UIDs.

array $calendar

A list of calendar IDs.

Throws

\Kronolith_Exception

Returns

array —

Event UIDs filtered by calendar IDs.

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.

convertFromDriver()

convertFromDriver(mixed  $value) : mixed

Converts a value from the driver's charset to the default charset.

Parameters

mixed $value

A value to convert.

Returns

mixed —

The converted value.

convertToDriver()

convertToDriver(mixed  $value) : mixed

Converts a value from the default charset to the driver's charset.

Parameters

mixed $value

A value to convert.

Returns

mixed —

The converted value.

convertBlobs()

convertBlobs(array  $event) : array

Converts TEXT/CLOB fields in an event.

Parameters

array $event

An event hash with TEXT/CLOB columns.

Returns

array —

The event with TEXT/CLOB columns converted to strings.

_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(string  $eventId, string  $newCalendar) : \Kronolith_Event

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

Returns

\Kronolith_Event

The old event.

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

_buildEventHistory()

_buildEventHistory(\Kronolith_Event  $event) : array

Builds a history hash for a modified event.

We don't write it in here because we don't want to commit history before the actual changes are made.

Parameters

\Kronolith_Event $event

The event to log.

Throws

\Horde_Mime_Exception
\Kronolith_Exception

Returns

array —

The change log.

_listEventsConditional()

_listEventsConditional(\Horde_Date  $startInterval = null, \Horde_Date  $endInterval = null, string  $conditions = '', array  $vals = array()) : array

Lists all events that satisfy the given conditions.

Parameters

\Horde_Date $startInterval

Start of range date object.

\Horde_Date $endInterval

End of range data object.

string $conditions

Conditions, given as SQL clauses.

array $vals

SQL bind variables for use with $conditions clauses.

Throws

\Kronolith_Exception

Returns

array —

Events in the given time range satisfying the given conditions.