Kronolith_Resource_Base
in package
Base class for Kronolith resources.
Partially presents a Horde_Share_Object interface.
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
- __construct() : Kronolith_Resource_Base
- Const'r
- addEvent() : mixed
- Adds $event to this resource's calendar - thus blocking the time for any other event.
- 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. Takes into account if this is a group of resources or not. (Returns the cumulative FB info for all the resources in the group.
- 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 event is free for specified time
- 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
- setPermission() : mixed
- share() : mixed
- toJson() : array<string|int, mixed>
- Return this resource's parameters in a hash.
- unlock() : mixed
- Remove a previous lock.
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
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 - thus blocking the time for any other event.
public
abstract addEvent(Kronolith_Event $event) : mixed
Parameters
- $event : Kronolith_Event
-
The event to add to this resource's calendar, thus blocking it's availability.
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. Takes into account if this is a group of resources or not. (Returns the cumulative FB info for all the resources in the group.
public
abstract getFreeBusy([int $startstamp = null ][, int $endstamp = null ][, bool $asObject = false ][, bool $json = false ]) : mixed
Parameters
- $startstamp : int = null
-
The starting timestamp of the fb interval.
- $endstamp : int = null
-
The ending timestamp of the fb interval.
- $asObject : bool = false
-
Return the fb info as an object?
- $json : bool = 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
abstract 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 event is free for specified time
public
abstract isFree(Kronolith_Event $event) : bool
Parameters
- $event : Kronolith_Event
-
The event we want to check the resource's availability for.
Return values
bool —True if the resource is free, false if not.
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
abstract removeEvent(Kronolith_Event $event) : mixed
Parameters
- $event : Kronolith_Event
-
The event to remove from the resource's calendar.
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 —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