Kronolith_Resource_Single
extends Kronolith_Resource_Base
in package
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.
Tags
Table of Contents
- $_id : int
- Resource's internal id
- $_lock : bool|int
- Cache the lock of this resource. If not locked, is false.
- $_params : array<string|int, mixed>
- Instance copy of parameters.
- $_share : Horde_Share_Object
- $_type : mixed
- __construct() : Kronolith_Resource_Base
- Const'r
- addEvent() : mixed
- Adds $event to this resource's calendar or updates the current entry of the event in the calendar.
- get() : mixed
- Implemented to stand in as a share object.
- getDriver() : mixed
- Get a storage driver instance for the resource.
- getFreeBusy() : mixed
- Obtain the freebusy information for this resource.
- getId() : string
- Obtain the resource's internal identifier.
- getPermission() : mixed
- getResponse() : int
- Check availability and return an appropriate Kronolith response code.
- getResponseType() : int
- Get ResponseType for this resource.
- hasPermission() : bool
- Return permission for the specified user for this Resource.
- isFree() : bool
- Determine if the resource is free during the time period for the supplied event.
- lock() : bool
- Locks the resource.
- removeEvent() : mixed
- Remove this event from resource's calendar
- save() : Kronolith_Resource_Base
- Save resource to storage.
- set() : void
- Allow setting of properties
- setId() : mixed
- Sets the current resource's id. Must not be an existing resource.
- setPermission() : mixed
- share() : mixed
- toJson() : array<string|int, mixed>
- Return this resource's parameters in a hash.
- unlock() : mixed
- Remove a previous lock.
- _copyEvent() : void
- Utility function to copy select event properties from $from to $to in order to add an event to the resource calendar.
Properties
$_id
Resource's internal id
protected
int
$_id
= ''
$_lock
Cache the lock of this resource. If not locked, is false.
protected
bool|int
$_lock
$_params
Instance copy of parameters.
protected
array<string|int, mixed>
$_params
= array()
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.
- response_type: A RESPONSETYPE_* constant
$_share
protected
Horde_Share_Object
$_share
$_type
protected
mixed
$_type
= 'single'
Methods
__construct()
Const'r
public
__construct([array<string|int, mixed> $params = array() ]) : Kronolith_Resource_Base
Parameters
- $params : array<string|int, mixed> = array()
Return values
Kronolith_Resource_Base —addEvent()
Adds $event to this resource's calendar or updates the current entry of the event in the calendar.
public
addEvent(Kronolith_Event $event) : mixed
Parameters
- $event : Kronolith_Event
-
The event to add to the resource. Note this is the base driver event.
Tags
Return values
mixed —get()
Implemented to stand in as a share object.
public
get(string $property) : mixed
Parameters
- $property : string
-
The property to get
Return values
mixed —The value of $property
getDriver()
Get a storage driver instance for the resource.
public
getDriver() : mixed
Return values
mixed —getFreeBusy()
Obtain the freebusy information for this resource.
public
getFreeBusy([mixed $startstamp = null ][, mixed $endstamp = null ][, mixed $asObject = false ][, mixed $json = false ]) : mixed
Parameters
- $startstamp : mixed = null
-
The starting timestamp of the fb interval.
- $endstamp : mixed = null
-
The ending timestamp of the fb interval.
- $asObject : mixed = false
-
Return the fb info as an object?
- $json : mixed = false
-
Return the fb info as JSON?
Return values
mixed —string|Horde_Icalendar_Vfreebusy The Freebusy object or the iCalendar text.
getId()
Obtain the resource's internal identifier.
public
getId() : string
Return values
string —The id.
getPermission()
public
getPermission() : mixed
Return values
mixed —getResponse()
Check availability and return an appropriate Kronolith response code.
public
getResponse(Kronolith_Event $event) : int
Parameters
- $event : Kronolith_Event
-
The event to check on
Return values
int —Kronolith::RESPONSE* constant
getResponseType()
Get ResponseType for this resource.
public
getResponseType() : int
Return values
int —The response type for this resource. A Kronolith_Resource::RESPONSE_TYPE_* constant.
hasPermission()
Return permission for the specified user for this Resource.
public
hasPermission(string $user[, int $permission = Horde_Perms::READ ][, $restrict = null ]) : bool
Parameters
- $user : string
-
The user to check for.
- $permission : int = Horde_Perms::READ
-
The permission to check.
- $restrict : = null
Return values
bool —isFree()
Determine if the resource is free during the time period for the supplied event.
public
isFree(Kronolith_Event $event) : bool
Parameters
- $event : Kronolith_Event
-
The event to check availability for.
Tags
Return values
bool —lock()
Locks the resource.
public
lock() : bool
Return values
bool —True if lock succeeded, otherwise false.
removeEvent()
Remove this event from resource's calendar
public
removeEvent(Kronolith_Event $event) : mixed
Parameters
- $event : Kronolith_Event
-
The event to remove.
Tags
Return values
mixed —save()
Save resource to storage.
public
save() : Kronolith_Resource_Base
Return values
Kronolith_Resource_Base —set()
Allow setting of properties
public
set(string $property, mixed $value) : void
Parameters
- $property : string
-
The property to set
- $value : mixed
-
The value to set to
Return values
void —setId()
Sets the current resource's id. Must not be an existing resource.
public
setId(int $id) : mixed
Parameters
- $id : int
-
The id for this resource
Tags
Return values
mixed —setPermission()
public
setPermission(mixed $perm) : mixed
Parameters
- $perm : mixed
Return values
mixed —share()
public
share() : mixed
Return values
mixed —toJson()
Return this resource's parameters in a hash.
public
toJson() : array<string|int, mixed>
Return values
array<string|int, mixed> —A hash suitable for JSON encoding.
unlock()
Remove a previous lock.
public
unlock() : mixed
Return values
mixed —_copyEvent()
Utility function to copy select event properties from $from to $to in order to add an event to the resource calendar.
private
_copyEvent(Kronolith_Event $from, Kronolith_Event &$to) : void
Parameters
- $from : Kronolith_Event
- $to : Kronolith_Event