PHP 클래스 Horde_Alarm, horde

저자: Jan Schneider ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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