Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
NotificationCenter Class Reference
Collaboration diagram for NotificationCenter:
Collaboration graph

Static Public Member Functions

static addObserver ($observer, $method, $event, $object=NULL)
static removeObserver ($observer, $event=NULL, $object=NULL)
static postNotification ($event, $object, $user_data=NULL)

Detailed Description

The NotificationCenter class is the central event dispatcher for Stud.IP. Objects interested in receiving notifications for particular events need to register with the NotificationCenter:

NotificationCenter::addObserver($this, 'update', 'shutdown');

Event notifications are sent via the postNotification() method:

NotificationCenter::postNotification('shutdown', $sender);

Member Function Documentation

static addObserver (   $observer,
  $method,
  $event,
  $object = NULL 
)
static

Register an object to be notified. The same object may be registered several times (e.g. for different notifications).

Parameters
object$observerobject to be notified
string$methodmethod that will be called
string$eventname of event (may be NULL)
mixed$objectsubject to observe (may be NULL)
static postNotification (   $event,
  $object,
  $user_data = NULL 
)
static

Post an event notification to all registered observers. Only observers registered for this event type and subject are notified.

Parameters
string$eventname of this notification
mixed$objectsubject of this notification
mixed$user_dataadditional information (optional)
Exceptions
NotificationVetoExceptionon observer veto

Here is the caller graph for this function:

static removeObserver (   $observer,
  $event = NULL,
  $object = NULL 
)
static

Remove an object registered with the NotificationCenter. Trying to remove an observer that was not registered is allowed and has no effect.

Parameters
object$observerobject to be removed
string$eventname of event (may be NULL)
mixed$objectsubject to observe (may be NULL)

The documentation for this class was generated from the following file: