\Kronolith_Resource_Group

Kronolith_Resource implementation to represent a group of similar resources.

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

Summary

Methods
Properties
Constants
__construct()
lock()
unlock()
getId()
set()
hasPermission()
getPermission()
setPermission()
get()
save()
share()
getDriver()
getResponse()
toJson()
isFree()
addEvent()
removeEvent()
getFreeBusy()
getResponseType()
setId()
No public properties found
No constants found
No protected methods found
$_params
$_share
$_id
$_lock
$_type
N/A
No private methods found
$_driver
$_selectedResource
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

$_type

$_type : 

Type

$_selectedResource

$_selectedResource : \Kronolith_Resource_Single

Local cache for event that accepts the invitation.

Type

\Kronolith_Resource_Single

Methods

__construct()

__construct(array  $params) : \Kronolith_Resource

Const'r

Parameters

array $params

Returns

\Kronolith_Resource

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, taking into account whether or not we have validated/selected a resource for this group yet.

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

Override the get method to see if we have a selected resource. If so, return the resource's property value, otherwise, return the group's property value.

Parameters

string $property

The property to get.

Returns

mixed —

The requested property's value.

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 the resource is free during the time period for the supplied event.

Parameters

\Kronolith_Event $event

The event to check availability for.

Throws

\Kronolith_Exception

Returns

boolean

addEvent()

addEvent(\Kronolith_Event  $event) 

Adds $event to an available member resource's calendar.

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.

Throws

\Kronolith_Exception

getFreeBusy()

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

Obtain the freebusy information for this resource.

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?

Throws

\Kronolith_Exception

Returns

mixed —

string|Horde_Icalendar_Vfreebusy The Freebusy object or the iCalendar text.

getResponseType()

getResponseType() : integer

Group resources only make sense for RESPONSETYPE_AUTO

Returns

integer —

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

setId()

setId(integer  $id) 

Sets the current resource's id. Must not be an existing resource.

Parameters

integer $id

The id for this resource

Throws

\Kronolith_Exception