Methods summary
public
|
#
__construct( array $params = array() )
Constructor.
Parameters
- $params
- Configuration parameters:
<pre><span class="php-quote">'logger'</span> - (Horde_Log_Logger) A logger instance.
<span class="php-quote">'ttl'</span> - (integer) <span class="php-keyword2">Time</span> to live value, in seconds.</pre>
|
public
array
|
#
listAlarms( string $user = null, Horde_Date $time = null, boolean $load = false, boolean $preload = true )
Returns a list of alarms from the backend.
Returns a list of alarms from the backend.
Parameters
- $user
- <p>Return alarms for this user, all users if
null, or global alarms if empty.</p>
- $time
- <p>The time when the alarms should be active.
Defaults to now.</p>
- $load
- Update active alarms from all applications?
- $preload
- <p>Preload alarms that go off within the next
ttl time span?</p>
Returns
array A list of alarm hashes.
Throws
|
public
array
|
#
globalAlarms( )
Returns a list of all global alarms from the backend.
Returns a list of all global alarms from the backend.
Returns
array A list of alarm hashes.
Throws
|
public
array
|
#
get( string $id, string $user )
Returns an alarm hash from the backend.
Returns an alarm hash from the backend.
Parameters
- $id
- The alarm's unique id.
- $user
- The alarm's user
Returns
array An alarm hash. Contains the following:
id: Unique alarm id.
user: The alarm's user. Empty if a global alarm.
start: The alarm start as a Horde_Date.
end: The alarm end as a Horde_Date.
methods: The notification methods for this alarm.
params: The paramters for the notification methods.
title: The alarm title.
text: An optional alarm description.
snooze: The snooze time (next time) of the alarm as a Horde_Date.
internal: Holds internally used data.
Throws
|
public
|
#
set( array $alarm, boolean $keep = false )
Stores an alarm hash in the backend.
Stores an alarm hash in the backend.
The alarm will be added if it doesn't exist, and updated otherwise.
Parameters
- $alarm
- An alarm hash. See self::get() for format.
- $keep
- <p>Whether to keep the snooze value and notification
status unchanged. If true, the alarm will get
"un-snoozed", and notifications (like mails) are
sent again.</p>
Throws
|
abstract public
|
#
internal( string $id, string $user, array $internal )
Updates internal alarm properties, i.e. properties not determined by
the application setting the alarm.
Updates internal alarm properties, i.e. properties not determined by
the application setting the alarm.
Parameters
- $id
- The alarm's unique id.
- $user
- The alarm's user
- $internal
- A hash with the internal data.
Throws
|
public
boolean
|
#
exists( string $id, string $user )
Returns whether an alarm with the given id exists already.
Returns whether an alarm with the given id exists already.
Parameters
- $id
- The alarm's unique id.
- $user
- The alarm's user
Returns
boolean True if the specified alarm exists.
|
public
|
#
snooze( string $id, string $user, integer $minutes )
Delays (snoozes) an alarm for a certain period.
Delays (snoozes) an alarm for a certain period.
Parameters
- $id
- The alarm's unique id.
- $user
- The notified user.
- $minutes
- <p>The delay in minutes. A negative value
dismisses the alarm completely.</p>
Throws
|
public
boolean
|
#
isSnoozed( string $id, string $user, Horde_Date $time = null )
Returns whether an alarm is snoozed.
Returns whether an alarm is snoozed.
Parameters
- $id
- The alarm's unique id.
- $user
- The alarm's user
- $time
- <p>The time when the alarm may be snoozed.
Defaults to now.</p>
Returns
boolean True if the alarm is snoozed.
Throws
|
public
|
#
delete( string $id, string $user = null )
Deletes an alarm from the backend.
Deletes an alarm from the backend.
Parameters
- $id
- The alarm's unique id.
- $user
- The alarm's user. All users' alarms if null.
Throws
|
public
|
#
notify( string $user = null, boolean $load = true, boolean $preload = true, array $exclude = array() )
Notifies the user about any active alarms.
Notifies the user about any active alarms.
Parameters
- $user
- <p>Notify this user, all users if null, or guest
users if empty.</p>
- $load
- Update active alarms from all applications?
- $preload
- <p>Preload alarms that go off within the next
ttl time span?</p>
- $exclude
- Don't notify with these methods.
Throws
|
public
|
#
addHandler( string $name, Horde_Alarm_Handler $handler )
Registers a notification handler.
Registers a notification handler.
Parameters
- $name
- A handler name.
- $handler
- A notification handler.
|
public
array
|
#
handlers( )
Returns a list of available notification handlers and parameters.
Returns a list of available notification handlers and parameters.
The returned list is a hash with method names as the keys and
optionally associated parameters as values. The parameters are hashes
again with parameter names as keys and parameter information as
values. The parameter information is hash with the following keys:
'desc' contains a parameter description; 'required' specifies whether
this parameter is required.
Returns
array List of methods and parameters.
|
public
|
#
gc( boolean $force = false )
Garbage collects old alarms in the backend.
Garbage collects old alarms in the backend.
Parameters
- $force
- <p>Force garbace collection? If false, GC happens
with a 1% chance.</p>
Throws
|
abstract public
|
#
initialize( )
Attempts to initialize the backend.
Attempts to initialize the backend.
Throws
|