The Horde_Notification:: package provides a subject-observer pattern for
raising and showing messages of different types and to different
listeners.
Copyright 2001-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
Methods summary
public
|
|
public
Horde_Notification_Listener
|
#
attach( string $listener, array $params = null, string $class = null )
Registers a listener with the notification object and includes
the necessary library file dynamically.
Registers a listener with the notification object and includes
the necessary library file dynamically.
Parameters
- $listener
- <p>The name of the listener to attach. These
names must be unique; further listeners with
the same name will be ignored.</p>
- $params
- <p>A hash containing any additional configuration
or connection parameters a listener driver
might need.</p>
- $class
- <p>The class name from which the driver was
instantiated if not the default one. If given
you have to include the library file
containing this class yourself. This is useful
if you want the listener driver to be
overriden by an application's implementation</p>
Returns
Throws
Horde_Exception
|
public
|
#
detach( string $listener )
Remove a listener from the notification list.
Remove a listener from the notification list.
Parameters
- $listener
- $listner The name of the listener to detach.
Throws
Horde_Exception
|
public
|
#
clear( string $listener = null )
Clear any notification events that may exist in a listener.
Clear any notification events that may exist in a listener.
Parameters
- $listener
- <p>The name of the listener to flush. If null,
clears all unattached events.</p>
|
public
mixed
|
#
get( string $type )
Returns the current Listener object for a given listener type.
Returns the current Listener object for a given listener type.
Parameters
Returns
mixed A Horde_Notification_Listener object, or null if
$type listener is not attached.
|
public
mixed
|
#
getListener( string $listener )
Returns a listener object given a listener name.
Returns a listener object given a listener name.
Parameters
- $listener
- The listener name.
Returns
mixed Either a Horde_Notification_Listener or null.
|
public
|
#
addType( string $listener, string $type, string $class )
Adds a type handler to a given Listener.
To change the default listener, use the following:
$ob->addType('default', '*', $classname);
Adds a type handler to a given Listener.
To change the default listener, use the following:
$ob->addType('default', '*', $classname);
Parameters
- $listener
- The listener name.
- $type
- The listener type.
- $class
- The Event class to use.
|
public
|
|
public
|
#
push( mixed $event, integer $type = null, array $flags = array(), array $options = array() )
Add an event to the Horde message stack.
Add an event to the Horde message stack.
Parameters
- $event
- <p>Horde_Notification_Event object or message
string.</p>
- $type
- The type of message.
- $flags
- <p>Array of optional flags that will be passed to
the registered listeners.</p>
- $options
- Additional options:
<pre><span class="php-quote">'immediate'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, immediately tries to attach to a
listener. <span class="php-keyword1">If</span> no listener exists <span class="php-keyword1">for</span> this type, the
message will be dropped.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> (message will be attached to available
handler at the <span class="php-keyword2">time</span> notify() is called).</pre>
|
public
|
#
notify( array $options = array() )
Passes the message stack to all listeners and asks them to
handle their messages.
Passes the message stack to all listeners and asks them to
handle their messages.
Parameters
- $options
- <p>An array containing display options for the
listeners. Any options not contained in this
list will be passed to the listeners.</p>
<pre>listeners - (<span class="php-keyword1">array</span>) The <span class="php-keyword1">list</span> of listeners to notify.
raw - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, does not call the listener<span class="php-quote">'s notify()
function.</span></pre>
|
public
integer
|
#
count( string $my_listener = null )
Return the number of notification messages in the stack.
Return the number of notification messages in the stack.
Parameters
- $my_listener
- The name of the listener.
Returns
integer The number of messages in the stack.
Author
|