PHP Class Kronolith_Driver_Resource, horde

Copyright 1999-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Author: Michael J Rubinsky ([email protected])
Inheritance: extends Kronolith_Driver
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_driver Kronolith_Driver The main event storage driver.
$_eventClass string The class name of the event object to instantiate.

Public Methods

Method Description
_deleteResourceCalendar ( string $calendar ) Delete the resource calendar
convertFromDriver ( mixed $value ) : mixed Converts a value from the driver's charset to the default charset.
convertToDriver ( mixed $value ) : mixed Converts a value from the default charset to the driver's charset.
delete ( Kronolith_Resource_Base $resource ) Removes a resource from storage, along with any events in the resource's calendar.
deleteEvent ( string | Kronolith_Event_Resource $eventId, boolean $silent = false, boolean $keep_bound = false ) Delete an event.
getByUID ( string $uid, array $calendars = null, boolean $getAll = false ) : Kronolith_Event Get an event or events with the given UID value.
getEvent ( $eventId = null )
getGroupMemberships ( integer $resource_id ) : array Obtain the group id for each group the specified resource is a member of.
getResource ( integer $id ) : Kronolith_Resource_Base Obtain a Kronolith_Resource by the resource's id
getResourceIdByCalendar ( string $calendar ) : integer Obtain the resource id associated with the given calendar uid.
initialize ( )
isResourceCalendar ( string $calendar ) : boolean Determine if the provided calendar id represents a resource's calendar.
listEvents ( Horde_Date $startDate = null, Horde_Date $endDate = null, array $options = [] ) Lists all events in the time range, optionally restricting results to only events with alarms.
listResources ( integer $perms = Horde_Perms::READ, array $filter = [], string $orderby = null ) : an Return a list of Kronolith_Resources
open ( string $calendar ) Selects a calendar as the currently opened calendar.
save ( Kronolith_Resource_Base $resource ) : Kronolith_Resource Save or update a Kronolith_Resource
saveEvent ( Kronolith_Event $event ) : string Saves an event in the backend.

Protected Methods

Method Description
_addTags ( Kronolith_Event $event ) Helper function to add tags from a newly creted event to the tagger.
_buildResourceEvent ( $driver_event )
_handleNotifications ( Kronolith_Event $event, $action )
_updateTags ( Kronolith_Event $event ) Helper function to update an existing event's tags to tagger storage.

Method Details

_addTags() protected method

Helper function to add tags from a newly creted event to the tagger.
protected _addTags ( Kronolith_Event $event )
$event Kronolith_Event The event to save tags to storage for.

_buildResourceEvent() protected method

protected _buildResourceEvent ( $driver_event )

_deleteResourceCalendar() public method

Delete the resource calendar
public _deleteResourceCalendar ( string $calendar )
$calendar string The calendar id.

_handleNotifications() protected method

protected _handleNotifications ( Kronolith_Event $event, $action )
$event Kronolith_Event

_updateTags() protected method

Helper function to update an existing event's tags to tagger storage.
protected _updateTags ( Kronolith_Event $event )
$event Kronolith_Event The event to update

convertFromDriver() public method

Converts a value from the driver's charset to the default charset.
public convertFromDriver ( mixed $value ) : mixed
$value mixed A value to convert.
return mixed The converted value.

convertToDriver() public method

Converts a value from the default charset to the driver's charset.
public convertToDriver ( mixed $value ) : mixed
$value mixed A value to convert.
return mixed The converted value.

delete() public method

Removes a resource from storage, along with any events in the resource's calendar.
public delete ( Kronolith_Resource_Base $resource )
$resource Kronolith_Resource_Base The kronolith resource to remove

deleteEvent() public method

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...
public deleteEvent ( string | Kronolith_Event_Resource $eventId, boolean $silent = false, boolean $keep_bound = false )
$eventId string | Kronolith_Event_Resource The ID of the event to delete.
$silent boolean Don't send notifications, used when deleting events in bulk from maintenance tasks.
$keep_bound boolean If true, does not remove the resource from the bound event. @since 4.2.2

getByUID() public method

Get an event or events with the given UID value.
public getByUID ( string $uid, array $calendars = null, boolean $getAll = false ) : Kronolith_Event
$uid string The UID to match
$calendars array A restricted array of calendar ids to search
$getAll boolean Return all matching events?
return Kronolith_Event

getEvent() public method

public getEvent ( $eventId = null )

getGroupMemberships() public method

Obtain the group id for each group the specified resource is a member of.
public getGroupMemberships ( integer $resource_id ) : array
$resource_id integer The resource id to check for.
return array An array of group ids.

getResource() public method

Obtain a Kronolith_Resource by the resource's id
public getResource ( integer $id ) : Kronolith_Resource_Base
$id integer The key for the Kronolith_Resource
return Kronolith_Resource_Base

getResourceIdByCalendar() public method

Obtain the resource id associated with the given calendar uid.
public getResourceIdByCalendar ( string $calendar ) : integer
$calendar string The calendar's uid.
return integer The Kronolith_Resource id.

initialize() public method

public initialize ( )

isResourceCalendar() public method

Determine if the provided calendar id represents a resource's calendar.
public isResourceCalendar ( string $calendar ) : boolean
$calendar string The calendar identifier to check.
return boolean

listEvents() public method

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 $options = [] )
$startDate Horde_Date The start of range date.
$endDate Horde_Date The end of date range.
$options 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)

listResources() public method

Right now, all users have Horde_Perms::READ, but only system admins have Horde_Perms::EDIT | Horde_Perms::DELETE
public listResources ( integer $perms = Horde_Perms::READ, array $filter = [], string $orderby = null ) : an
$perms integer A Horde_Perms::* constant.
$filter array A hash of field/values to filter on.
$orderby string Field to order results by. Null for no ordering.
return an array of Kronolith_Resource objects.

open() public method

Selects a calendar as the currently opened calendar.
public open ( string $calendar )
$calendar string A calendar identifier.

save() public method

Save or update a Kronolith_Resource
public save ( Kronolith_Resource_Base $resource ) : Kronolith_Resource
$resource Kronolith_Resource_Base
return Kronolith_Resource object

saveEvent() public method

If it is a new event, it is added, otherwise the event is updated.
public saveEvent ( Kronolith_Event $event ) : string
$event Kronolith_Event The event to save.
return string The event id.

Property Details

$_driver protected property

The main event storage driver.
protected Kronolith_Driver $_driver
return Kronolith_Driver

$_eventClass protected property

The class name of the event object to instantiate.
protected string $_eventClass
return string