Documentation

Kronolith_Driver_Mock extends Kronolith_Driver
in package

The Kronolith_Driver_Mock class provides a Kronolith dummy driver.

Copyright 2011-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.

Tags
author

Gunnar Wrobel wrobel@pardus.de

Table of Contents

$backgroundColor  : string
The HTML background color to be used for this event.
$calendar  : string
The current calendar.
$foregroundColor  : string
The HTML foreground color to be used for this event.
$_params  : array<string|int, mixed>
A hash containing any parameters for the current driver.
$_errormsg  : string
An error message to throw when something is wrong.
__construct()  : mixed
Constructor.
backgroundColor()  : string
Returns the background color of the current calendar.
colors()  : array<string|int, mixed>
Returns the colors of the current calendar.
countEvents()  : int
Returns the number of events in the current calendar.
delete()  : mixed
Stub to be overridden in the child class.
deleteEvent()  : mixed
Deletes an event.
exists()  : mixed
Stub for child class to override if it can implement.
filterEventsByCalendar()  : mixed
Stub to be overridden in the child class if it can implement.
getByUID()  : mixed
Stub to be overridden in the child class.
getEvent()  : mixed
Stub to be overridden in the child class.
getParam()  : mixed
Returns a configuration for this driver.
initialize()  : mixed
Stub to initiate a driver.
listAlarms()  : array<string|int, mixed>
List all alarms.
listEvents()  : mixed
Lists all events in the time range, optionally restricting results to only events with alarms.
move()  : mixed
Moves an event to a new calendar.
nextRecurrence()  : Horde_Date|bool
Finds the next recurrence of $eventId that's after $afterDate.
open()  : mixed
Selects a calendar as the currently opened calendar.
removeUserData()  : mixed
Stub for child class to override if it can implement.
saveEvent()  : string
Saves an event in the backend.
search()  : array<string|int, mixed>
Searches a calendar.
setParam()  : mixed
Sets a configuration for this driver.
setParams()  : mixed
Sets all configuration parameters for this driver.
supportsTimezones()  : bool
Returns whether this driver supports per-event timezones.
synchronize()  : mixed
Synchronize if driver needs to.
_addEvent()  : mixed
Stub to be overridden in the child class.
_addTags()  : mixed
Helper function to add tags from a newly creted event to the tagger.
_deleteEvent()  : Kronolith_Event
Stub to be overridden in the child class.
_handleNotifications()  : mixed
Wrapper for sending notifications, so that we can overwrite this action in Kronolith_Driver_Resource.
_listEvents()  : mixed
Lists all events in the time range, optionally restricting results to only events with alarms.
_move()  : mixed
Stub to be overridden in the child class.
_updateEvent()  : mixed
Stub to be overridden in the child class.
_updateTags()  : mixed
Helper function to update an existing event's tags to tagger storage.

Properties

$backgroundColor

The HTML background color to be used for this event.

public string $backgroundColor = '#ddd'

$calendar

The current calendar.

public string $calendar

$foregroundColor

The HTML foreground color to be used for this event.

public string $foregroundColor = '#000'

$_params

A hash containing any parameters for the current driver.

protected array<string|int, mixed> $_params = array()

$_errormsg

An error message to throw when something is wrong.

private string $_errormsg

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ][, string $errormsg = null ]) : mixed

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

Parameters
$params : array<string|int, mixed> = array()

Any parameters needed for this driver.

$errormsg : string = null

A custom error message to use.

Return values
mixed

backgroundColor()

Returns the background color of the current calendar.

public backgroundColor() : string
Return values
string

The calendar color.

colors()

Returns the colors of the current calendar.

public colors() : array<string|int, mixed>
Return values
array<string|int, mixed>

The calendar background and foreground color.

countEvents()

Returns the number of events in the current calendar.

public countEvents() : int
Tags
throws
Kronolith_Exception
Return values
int

The number of events.

delete()

Stub to be overridden in the child class.

public delete(mixed $calendar) : mixed

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

Parameters
$calendar : mixed
Tags
throws
Kronolith_Exception
Return values
mixed

deleteEvent()

Deletes an event.

public deleteEvent(mixed $eventId[, bool $silent = false ]) : mixed
Parameters
$eventId : mixed

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

$silent : bool = false

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

Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
throws
Horde_Mime_Exception
Return values
mixed

exists()

Stub for child class to override if it can implement.

public exists(mixed $uid[, mixed $calendar_id = null ]) : mixed
Parameters
$uid : mixed
$calendar_id : mixed = null
Tags
throws
Kronolith_Exception
Return values
mixed

filterEventsByCalendar()

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

public filterEventsByCalendar(mixed $uids, mixed $calendar) : mixed
Parameters
$uids : mixed
$calendar : mixed
Tags
throws
Kronolith_Exception
Return values
mixed

getByUID()

Stub to be overridden in the child class.

public getByUID(mixed $uid[, mixed $calendars = null ][, mixed $getAll = false ]) : mixed
Parameters
$uid : mixed
$calendars : mixed = null
$getAll : mixed = false
Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
Return values
mixed

getEvent()

Stub to be overridden in the child class.

public getEvent([mixed $eventId = null ]) : mixed
Parameters
$eventId : mixed = null
Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
Return values
mixed

getParam()

Returns a configuration for this driver.

public getParam(string $param) : mixed
Parameters
$param : string

A parameter name.

Return values
mixed

The parameter value or null if not set.

listAlarms()

List all alarms.

public listAlarms(Horde_Date $date[, bool $fullevent = false ]) : array<string|int, mixed>
Parameters
$date : Horde_Date

The date to list alarms for

$fullevent : bool = false

Return the full event objects?

Tags
throws
Kronolith_Exception
Return values
array<string|int, mixed>

An array of event ids, or Kronolith_Event objects

listEvents()

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

public listEvents([Horde_Date $startDate = null ][, Horde_Date $endDate = null ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$startDate : Horde_Date = null

The start of range date.

$endDate : Horde_Date = null

The end of date range.

$options : array<string|int, mixed> = array()

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)
Tags
throws
Kronolith_Exception
Return values
mixed

move()

Moves an event to a new calendar.

public move(string $eventId, string $newCalendar) : mixed
Parameters
$eventId : string

The event to move.

$newCalendar : string

The new calendar.

Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
Return values
mixed

nextRecurrence()

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

public nextRecurrence(string $eventId, Horde_Date $afterDate) : Horde_Date|bool
Parameters
$eventId : string

The ID of the event to fetch.

$afterDate : Horde_Date

Return events after this date.

Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
Return values
Horde_Date|bool

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

open()

Selects a calendar as the currently opened calendar.

public open(string $calendar) : mixed
Parameters
$calendar : string

A calendar identifier.

Return values
mixed

removeUserData()

Stub for child class to override if it can implement.

public removeUserData(mixed $user) : mixed
Parameters
$user : mixed
Tags
todo

Remove in Kronolith 4.0

deprecated

Now lives in Kronolith_Application::

throws
Kronolith_Exception
Return values
mixed

saveEvent()

Saves an event in the backend.

public saveEvent(Kronolith_Event $event) : string

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

Parameters
$event : Kronolith_Event

The event to save.

Tags
throws
Horde_Mime_Exception
throws
Kronolith_Exception
Return values
string

The event id.

Searches a calendar.

public search(object $query[, bool $json = false ]) : array<string|int, mixed>
Parameters
$query : object

An object with the criteria to search for.

$json : bool = false

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

Tags
throws
Kronolith_Exception
Return values
array<string|int, mixed>

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

setParam()

Sets a configuration for this driver.

public setParam(string $param, mixed $value) : mixed
Parameters
$param : string

A parameter name.

$value : mixed

The parameter value.

Return values
mixed

setParams()

Sets all configuration parameters for this driver.

public setParams(string $params) : mixed
Parameters
$params : string

A parameters hash.

Return values
mixed

supportsTimezones()

Returns whether this driver supports per-event timezones.

public supportsTimezones() : bool
Return values
bool

Whether this drivers suppports per-event timezones.

synchronize()

Synchronize if driver needs to.

public synchronize([bool $force = false ][, string $token = false ]) : mixed
Parameters
$force : bool = false

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

$token : string = false

A synchroniziation token, if available.

Return values
mixed

_addTags()

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

protected _addTags(Kronolith_Event $event) : mixed
Parameters
$event : Kronolith_Event

The event to save tags to storage for.

Return values
mixed

_deleteEvent()

Stub to be overridden in the child class.

protected _deleteEvent(mixed $eventId) : Kronolith_Event
Parameters
$eventId : mixed

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

Tags
throws
Kronolith_Exception
throws
Horde_Exception_NotFound
throws
Horde_Mime_Exception
Return values
Kronolith_Event

Returns the deleted event.

_handleNotifications()

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

protected _handleNotifications(Kronolith_Event $event, string $action) : mixed
Parameters
$event : Kronolith_Event
$action : string
Return values
mixed

_listEvents()

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

protected _listEvents([Horde_Date $startDate = null ][, Horde_Date $endDate = null ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$startDate : Horde_Date = null

The start of range date.

$endDate : Horde_Date = null

The end of date range.

$options : array<string|int, mixed> = array()

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)
Tags
throws
Kronolith_Exception
Return values
mixed

_move()

Stub to be overridden in the child class.

protected _move(mixed $eventId, mixed $newCalendar) : mixed
Parameters
$eventId : mixed
$newCalendar : mixed
Tags
throws
Kronolith_Exception
Return values
mixed

_updateTags()

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

protected _updateTags(Kronolith_Event $event) : mixed
Parameters
$event : Kronolith_Event

The event to update

Return values
mixed

Search results