PHP Класс Horde_Alarm, horde

Автор: Jan Schneider ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
_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.

Описание методов

__construct() публичный Метод

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() абстрактный защищенный Метод

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

_delete() абстрактный защищенный Метод

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() абстрактный защищенный Метод

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

_exists() абстрактный защищенный Метод

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.
Результат boolean True if the specified alarm exists.

_fromDriver() абстрактный защищенный Метод

Converts a value from the driver's charset.
abstract protected _fromDriver ( mixed $value ) : mixed
$value mixed Value to convert.
Результат mixed Converted value.

_gc() абстрактный защищенный Метод

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

_get() абстрактный защищенный Метод

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
Результат array An alarm hash.

_global() абстрактный защищенный Метод

Returns a list of all global alarms from the backend.
abstract protected _global ( ) : array
Результат array A list of alarm hashes.

_isSnoozed() абстрактный защищенный Метод

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.
Результат boolean True if the alarm is snoozed.

_list() абстрактный защищенный Метод

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.
Результат array A list of alarm hashes.

_snooze() абстрактный защищенный Метод

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() абстрактный защищенный Метод

Converts a value to the driver's charset.
abstract protected _toDriver ( mixed $value ) : mixed
$value mixed Value to convert.
Результат mixed Converted value.

_update() абстрактный защищенный Метод

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() публичный Метод

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() публичный Метод

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() публичный Метод

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
Результат boolean True if the specified alarm exists.

gc() публичный Метод

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() публичный Метод

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
Результат 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() публичный Метод

Returns a list of errors, exceptions etc. that occured during notify() calls.
public getErrors ( ) : array
Результат array Error list.

globalAlarms() публичный Метод

Returns a list of all global alarms from the backend.
public globalAlarms ( ) : array
Результат array A list of alarm hashes.

handlers() публичный Метод

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
Результат array List of methods and parameters.

initialize() абстрактный публичный Метод

Attempts to initialize the backend.
abstract public initialize ( )

internal() абстрактный публичный Метод

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() публичный Метод

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.
Результат boolean True if the alarm is snoozed.

listAlarms() публичный Метод

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?
Результат array A list of alarm hashes.

notify() публичный Метод

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() публичный Метод

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() публичный Метод

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.

Описание свойств

$_errors защищенное свойство

A list of errors, exceptions etc. that occured during notify() calls.
protected array $_errors
Результат array

$_handlers защищенное свойство

All registered notification handlers.
protected array $_handlers
Результат array

$_handlersLoaded защищенное свойство

Whether handler classes have been dynamically loaded already.
protected bool $_handlersLoaded
Результат boolean

$_loader защищенное свойство

Alarm loader callback.
protected mixed $_loader
Результат mixed

$_logger защищенное свойство

Logger.
protected Horde_Log_Logger $_logger
Результат Horde_Log_Logger

$_params защищенное свойство

Hash containing connection parameters.
protected array $_params
Результат array