\Kronolith_Resource_Base

Base class for Kronolith resources.

Partially presents a Horde_Share_Object interface.

Summary

Methods
Properties
Constants
__construct()
lock()
unlock()
getId()
set()
hasPermission()
getPermission()
setPermission()
get()
save()
share()
getDriver()
getResponse()
toJson()
isFree()
addEvent()
removeEvent()
getFreeBusy()
getResponseType()
No public properties found
No constants found
No protected methods found
$_params
$_share
$_id
$_lock
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Instance copy of parameters.

Contains:

  • name: Display name of resource.
  • calendar: The calendar associated with this resource.
  • description: Resource description.
  • email: An email address for the resource. (Currently not used)
  • members: Member resources, if this is a group.
  • responsetype: A RESPONSETYPE* constant

Type

array

$_share

$_share : \Horde_Share_Object

Type

\Horde_Share_Object

$_id

$_id : integer

Resource's internal id

Type

integer

$_lock

$_lock : boolean|integer

Cache the lock of this resource. If not locked, is false.

Type

boolean|integer

Methods

__construct()

__construct(array  $params = array()) : \Kronolith_Resource_Base

Const'r

Parameters

array $params

Returns

\Kronolith_Resource_Base

lock()

lock() : boolean

Locks the resource.

Returns

boolean —

True if lock succeeded, otherwise false.

unlock()

unlock() 

Remove a previous lock.

getId()

getId() : string

Obtain the resource's internal identifier.

Returns

string —

The id.

set()

set(string  $property, mixed  $value) : void

Allow setting of properties

Parameters

string $property

The property to set

mixed $value

The value to set to

hasPermission()

hasPermission(string  $user, integer  $permission = \Horde_Perms::READ,   $restrict = null) : boolean

Return permission for the specified user for this Resource.

Parameters

string $user

The user to check for.

integer $permission

The permission to check.

$restrict

Returns

boolean

getPermission()

getPermission() 

setPermission()

setPermission(  $perm) 

Parameters

$perm

get()

get(string  $property) : mixed

Implemented to stand in as a share object.

Parameters

string $property

The property to get

Returns

mixed —

The value of $property

share()

share() 

getDriver()

getDriver() : \Kronolith_Driver_Resource_*

Get a storage driver instance for the resource.

Returns

\Kronolith_Driver_Resource_* —

object.

getResponse()

getResponse(\Kronolith_Event  $event) : integer

Check availability and return an appropriate Kronolith response code.

Parameters

\Kronolith_Event $event

The event to check on

Returns

integer —

Kronolith::RESPONSE* constant

toJson()

toJson() : array

Return this resource's parameters in a hash.

Returns

array —

A hash suitable for JSON encoding.

isFree()

isFree(\Kronolith_Event  $event) : boolean

Determine if event is free for specified time

Parameters

\Kronolith_Event $event

The event we want to check the resource's availability for.

Returns

boolean —

True if the resource is free, false if not.

addEvent()

addEvent(\Kronolith_Event  $event) 

Adds $event to this resource's calendar - thus blocking the time for any other event.

Parameters

\Kronolith_Event $event

The event to add to this resource's calendar, thus blocking it's availability.

Throws

\Kronolith_Exception

removeEvent()

removeEvent(\Kronolith_Event  $event) 

Remove this event from resource's calendar

Parameters

\Kronolith_Event $event

The event to remove from the resource's calendar.

getFreeBusy()

getFreeBusy(integer  $startstamp = null, integer  $endstamp = null, boolean  $asObject = false, boolean  $json = false) : mixed

Obtain the freebusy information for this resource. Takes into account if this is a group of resources or not. (Returns the cumulative FB info for all the resources in the group.

Parameters

integer $startstamp

The starting timestamp of the fb interval.

integer $endstamp

The ending timestamp of the fb interval.

boolean $asObject

Return the fb info as an object?

boolean $json

Return the fb info as JSON?

Returns

mixed —

string|Horde_Icalendar_Vfreebusy The Freebusy object or the iCalendar text.

getResponseType()

getResponseType() : integer

Get ResponseType for this resource.

Returns

integer —

The response type for this resource. A Kronolith_Resource::RESPONSETYPE* constant.