PHP Class Horde_Alarm, horde

Author: Jan Schneider ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_errors array A list of errors, exceptions etc. that occured during notify() calls.
$_handlers array All registered notification handlers.
$_handlersLoaded boolean Whether handler classes have been dynamically loaded already.
$_loader mixed Alarm loader callback.
$_logger Horde_Log_Logger Logger.
$_params array Hash containing connection parameters.

Méthodes publiques

Méthode Description
__construct ( array $params = [] ) Constructor.
addHandler ( string $name, Horde_Alarm_Handler $handler ) Registers a notification handler.
delete ( string $id, string $user = null ) Deletes an alarm from the backend.
exists ( string $id, string $user, string $instanceid = null ) : boolean Returns whether an alarm with the given id exists already.
gc ( boolean $force = false ) Garbage collects old alarms in the backend.
get ( string $id, string $user ) : array Returns an alarm hash from the backend.
getErrors ( ) : array Returns a list of errors, exceptions etc. that occured during notify() calls.
globalAlarms ( ) : array Returns a list of all global alarms from the backend.
handlers ( ) : array Returns a list of available notification handlers and parameters.
initialize ( ) Attempts to initialize the backend.
internal ( string $id, string $user, array $internal ) Updates internal alarm properties, i.e. properties not determined by the application setting the alarm.
isSnoozed ( string $id, string $user, Horde_Date $time = null ) : boolean Returns whether an alarm is snoozed.
listAlarms ( string $user = null, Horde_Date $time = null, boolean $load = false, boolean $preload = true ) : array Returns a list of alarms from the backend.
notify ( string $user = null, boolean $load = true, boolean $preload = true, array $exclude = [] ) Notifies the user about any active alarms.
set ( array $alarm, boolean $keep = false ) Stores an alarm hash in the backend.
snooze ( string $id, string $user, integer $minutes ) Delays (snoozes) an alarm for a certain period.

Méthodes protégées

Méthode Description
_add ( array $alarm ) Adds an alarm hash to the backend.
_delete ( string $id, string $user = null ) Deletes an alarm from the backend.
_dismiss ( string $id, string $user ) Dismisses an alarm.
_exists ( string $id, string $user, string $instanceid = null ) : boolean Returns whether an alarm with the given id exists already.
_fromDriver ( mixed $value ) : mixed Converts a value from the driver's charset.
_gc ( ) Garbage collects old alarms in the backend.
_get ( string $id, string $user ) : array Returns an alarm hash from the backend.
_global ( ) : array Returns a list of all global alarms from the backend.
_isSnoozed ( string $id, string $user, Horde_Date $time ) : boolean Returns whether an alarm is snoozed.
_list ( string $user, Horde_Date $time ) : array Returns a list of alarms from the backend.
_snooze ( string $id, string $user, Horde_Date $snooze ) Delays (snoozes) an alarm for a certain period.
_toDriver ( mixed $value ) : mixed Converts a value to the driver's charset.
_update ( array $alarm, boolean $keepsnooze = false ) Updates an alarm hash in the backend.

Method Details

__construct() public méthode

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters:
'logger' - (Horde_Log_Logger) A logger instance.
'ttl' - (integer) Time to live value, in seconds.

_add() abstract protected méthode

Adds an alarm hash to the backend.
abstract protected _add ( array $alarm )
$alarm array An alarm hash.

_delete() abstract protected méthode

Deletes an alarm from the backend.
abstract protected _delete ( string $id, string $user = null )
$id string The alarm's unique id.
$user string The alarm's user. All users' alarms if null.

_dismiss() abstract protected méthode

Dismisses an alarm.
abstract protected _dismiss ( string $id, string $user )
$id string The alarm's unique id.
$user string The alarm's user

_exists() abstract protected méthode

Returns whether an alarm with the given id exists already.
abstract protected _exists ( string $id, string $user, string $instanceid = null ) : boolean
$id string The alarm's unique id.
$user string The alarm's user
$instanceid string An optional instanceid to match.
Résultat boolean True if the specified alarm exists.

_fromDriver() abstract protected méthode

Converts a value from the driver's charset.
abstract protected _fromDriver ( mixed $value ) : mixed
$value mixed Value to convert.
Résultat mixed Converted value.

_gc() abstract protected méthode

Garbage collects old alarms in the backend.
abstract protected _gc ( )

_get() abstract protected méthode

Returns an alarm hash from the backend.
abstract protected _get ( string $id, string $user ) : array
$id string The alarm's unique id.
$user string The alarm's user
Résultat array An alarm hash.

_global() abstract protected méthode

Returns a list of all global alarms from the backend.
abstract protected _global ( ) : array
Résultat array A list of alarm hashes.

_isSnoozed() abstract protected méthode

Returns whether an alarm is snoozed.
abstract protected _isSnoozed ( string $id, string $user, Horde_Date $time ) : boolean
$id string The alarm's unique id.
$user string The alarm's user
$time Horde_Date The time when the alarm may be snoozed.
Résultat boolean True if the alarm is snoozed.

_list() abstract protected méthode

Returns a list of alarms from the backend.
abstract protected _list ( string $user, Horde_Date $time ) : array
$user string Return alarms for this user, all users if null, or global alarms if empty.
$time Horde_Date The time when the alarms should be active.
Résultat array A list of alarm hashes.

_snooze() abstract protected méthode

Delays (snoozes) an alarm for a certain period.
abstract protected _snooze ( string $id, string $user, Horde_Date $snooze )
$id string The alarm's unique id.
$user string The alarm's user
$snooze Horde_Date The snooze time.

_toDriver() abstract protected méthode

Converts a value to the driver's charset.
abstract protected _toDriver ( mixed $value ) : mixed
$value mixed Value to convert.
Résultat mixed Converted value.

_update() abstract protected méthode

Updates an alarm hash in the backend.
abstract protected _update ( array $alarm, boolean $keepsnooze = false )
$alarm array An alarm hash.
$keepsnooze boolean Whether to keep the snooze value unchanged.

addHandler() public méthode

Registers a notification handler.
public addHandler ( string $name, Horde_Alarm_Handler $handler )
$name string A handler name.
$handler Horde_Alarm_Handler A notification handler.

delete() public méthode

Deletes an alarm from the backend.
public delete ( string $id, string $user = null )
$id string The alarm's unique id.
$user string The alarm's user. All users' alarms if null.

exists() public méthode

Returns whether an alarm with the given id exists already.
public exists ( string $id, string $user, string $instanceid = null ) : boolean
$id string The alarm's unique id.
$user string The alarm's user
$instanceid string An optional instanceid to check for. @since 2.2.0
Résultat boolean True if the specified alarm exists.

gc() public méthode

Garbage collects old alarms in the backend.
public gc ( boolean $force = false )
$force boolean Force garbace collection? If false, GC happens with a 1% chance.

get() public méthode

Returns an alarm hash from the backend.
public get ( string $id, string $user ) : array
$id string The alarm's unique id.
$user string The alarm's user
Résultat 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.
instanceid: Holds an instance identifier for recurring alarms.
            (@since 2.2.0)

getErrors() public méthode

Returns a list of errors, exceptions etc. that occured during notify() calls.
public getErrors ( ) : array
Résultat array Error list.

globalAlarms() public méthode

Returns a list of all global alarms from the backend.
public globalAlarms ( ) : array
Résultat array A list of alarm hashes.

handlers() public méthode

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.
public handlers ( ) : array
Résultat array List of methods and parameters.

initialize() abstract public méthode

Attempts to initialize the backend.
abstract public initialize ( )

internal() abstract public méthode

Updates internal alarm properties, i.e. properties not determined by the application setting the alarm.
abstract public internal ( string $id, string $user, array $internal )
$id string The alarm's unique id.
$user string The alarm's user
$internal array A hash with the internal data.

isSnoozed() public méthode

Returns whether an alarm is snoozed.
public isSnoozed ( string $id, string $user, Horde_Date $time = null ) : boolean
$id string The alarm's unique id.
$user string The alarm's user
$time Horde_Date The time when the alarm may be snoozed. Defaults to now.
Résultat boolean True if the alarm is snoozed.

listAlarms() public méthode

Returns a list of alarms from the backend.
public listAlarms ( string $user = null, Horde_Date $time = null, boolean $load = false, boolean $preload = true ) : array
$user string Return alarms for this user, all users if null, or global alarms if empty.
$time Horde_Date The time when the alarms should be active. Defaults to now.
$load boolean Update active alarms from all applications?
$preload boolean Preload alarms that go off within the next ttl time span?
Résultat array A list of alarm hashes.

notify() public méthode

Notifies the user about any active alarms.
public notify ( string $user = null, boolean $load = true, boolean $preload = true, array $exclude = [] )
$user string Notify this user, all users if null, or guest users if empty.
$load boolean Update active alarms from all applications?
$preload boolean Preload alarms that go off within the next ttl time span?
$exclude array Don't notify with these methods.

set() public méthode

The alarm will be added if it doesn't exist, and updated otherwise.
public set ( array $alarm, boolean $keep = false )
$alarm array An alarm hash. See self::get() for format.
$keep boolean 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.

snooze() public méthode

Delays (snoozes) an alarm for a certain period.
public snooze ( string $id, string $user, integer $minutes )
$id string The alarm's unique id.
$user string The notified user.
$minutes integer The delay in minutes. A negative value dismisses the alarm completely.

Property Details

$_errors protected_oe property

A list of errors, exceptions etc. that occured during notify() calls.
protected array $_errors
Résultat array

$_handlers protected_oe property

All registered notification handlers.
protected array $_handlers
Résultat array

$_handlersLoaded protected_oe property

Whether handler classes have been dynamically loaded already.
protected bool $_handlersLoaded
Résultat boolean

$_loader protected_oe property

Alarm loader callback.
protected mixed $_loader
Résultat mixed

$_logger protected_oe property

Logger.
protected Horde_Log_Logger $_logger
Résultat Horde_Log_Logger

$_params protected_oe property

Hash containing connection parameters.
protected array $_params
Résultat array