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

$_driver

$_driver : \Kronolith_Driver

The main event storage driver.

Type

\Kronolith_Driver

$_eventClass

$_eventClass : string

The class name of the event object to instantiate.

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) : 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.

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(  $date,   $fullevent = false) 

Stub to be overridden in the child class.

Parameters

$date
$fullevent

Throws

\Kronolith_Exception

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(\Kronolith_Resource_Base  $resource) 

Removes a resource from storage, along with any events in the resource's calendar.

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

Parameters

\Kronolith_Resource_Base $resource

The kronolith resource to remove

Throws

\Kronolith_Exception,

Horde_Exception_PermissionDenied

deleteEvent()

deleteEvent(string|\Kronolith_Event_Resource  $eventId, boolean  $silent = false, boolean  $keep_bound = false) 

Delete an event.

Since this is the Kronolith_Resource's version of the event, if we delete it, we must also make sure to remove it from the event that it is attached to. Not sure if there is a better way to do this...

Parameters

string|\Kronolith_Event_Resource $eventId

The ID of the event to delete.

boolean $silent

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

boolean $keep_bound

If true, does not remove the resource from the bound event. @since 4.2.2

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

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.

save()

save(\Kronolith_Resource_Base  $resource) : \Kronolith_Resource

Save or update a Kronolith_Resource

Parameters

\Kronolith_Resource_Base $resource

Throws

\Kronolith_Exception,

Horde_Exception_PermissionDenied

Returns

\Kronolith_Resource

object

getResource()

getResource(integer  $id) : \Kronolith_Resource_Base

Obtain a Kronolith_Resource by the resource's id

Parameters

integer $id

The key for the Kronolith_Resource

Throws

\Kronolith_Exception

Returns

\Kronolith_Resource_Base

getResourceIdByCalendar()

getResourceIdByCalendar(string  $calendar) : integer

Obtain the resource id associated with the given calendar uid.

Parameters

string $calendar

The calendar's uid.

Throws

\Kronolith_Exception

Returns

integer —

The Kronolith_Resource id.

isResourceCalendar()

isResourceCalendar(string  $calendar) : boolean

Determine if the provided calendar id represents a resource's calendar.

Parameters

string $calendar

The calendar identifier to check.

Returns

boolean

listResources()

listResources(integer  $perms = \Horde_Perms::READ, array  $filter = array(), string  $orderby = null) : \an

Return a list of Kronolith_Resources

Right now, all users have Horde_Perms::READ, but only system admins have Horde_Perms::EDIT | Horde_Perms::DELETE

Parameters

integer $perms

A Horde_Perms::* constant.

array $filter

A hash of field/values to filter on.

string $orderby

Field to order results by. Null for no ordering.

Throws

\Kronolith_Exception

Returns

\an —

array of Kronolith_Resource objects.

getGroupMemberships()

getGroupMemberships(integer  $resource_id) : array

Obtain the group id for each group the specified resource is a member of.

Parameters

integer $resource_id

The resource id to check for.

Throws

\Kronolith_Exception

Returns

array —

An array of group ids.

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.

_deleteResourceCalendar()

_deleteResourceCalendar(string  $calendar) 

Delete the resource calendar

Parameters

string $calendar

The calendar id.

_listEvents()

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

Stub to be overridden in concrete class.

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  $event) 

Stub to be overridden in the child class.

Parameters

\Kronolith_Event $event

Throws

\Kronolith_Exception

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

_buildResourceEvent()

_buildResourceEvent(  $driver_event) 

Parameters

$driver_event