\Kronolith_Resource_Single

Kronolith_Resource implementation to represent a single resource.

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
_copyEvent()
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

$_type

$_type : 

Type

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 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 this resource's calendar or updates the current entry of the event in the calendar.

Parameters

\Kronolith_Event $event

The event to add to the resource. Note this is the base driver event.

Throws

\Kronolith_Exception

removeEvent()

removeEvent(\Kronolith_Event  $event) 

Remove this event from resource's calendar

Parameters

\Kronolith_Event $event

The event to remove.

Throws

\Kronolith_Exception
\Horde_Exception_NotFound

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?

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.

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

_copyEvent()

_copyEvent(\Kronolith_Event  $from, \Kronolith_Event  $to) : void

Utility function to copy select event properties from $from to $to in order to add an event to the resource calendar.

Parameters

\Kronolith_Event $from
\Kronolith_Event $to