Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Event_Manager Class Reference
Inheritance diagram for Event_Manager:
MySource_Object

Public Member Functions

 Event_Manager ()
 
 addEventListener (&$listener, $events=Array(), $broadcast_polling_events=true)
 
 _broadcastRuntimeEvents (&$broadcaster, $event_name, $vars=Array())
 
 broadcastEvent (&$broadcaster, $event_name='', $vars=Array())
 
 _getDiscreteAssets ($assetid='', $type_code='', $side_of_link='minor', $info=Array())
 
 writeStaticEventsCacheFile ()
 
 installStaticEvents ($listeners=Array(), $listener_type_code='', $recursive_call=false)
 
 _loadCachedEventListeners ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $_runtime_event_listeners = Array()
 
 $_runtime_listener_objects = Array()
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Detailed Description

Definition at line 59 of file event_manager.inc.

Member Function Documentation

_broadcastRuntimeEvents ( $broadcaster,
  $event_name,
  $vars = Array() 
)

Broadcast events to the listeners that we added at runtime

Parameters
&objectAsset $broadcaster the broadcaster of this event
string$event_namethe event name being broadcasted
Array$varsvars to be past to the listener

private

Returns
boolean

Definition at line 128 of file event_manager.inc.

_getDiscreteAssets (   $assetid = '',
  $type_code = '',
  $side_of_link = 'minor',
  $info = Array() 
)

Traverse up or down the tree for asset information

Collects all assets of the wanted type_code

Parameters
integer$assetidthe assetid of the broadcaster
string$type_codethe type_code of the listener
string$side_of_linkthe size of link where the broadcaster exists
array$infosome information about the discretion of assets to return

public

Returns
Array(integer) assetid

Definition at line 340 of file event_manager.inc.

_loadCachedEventListeners ( )

Load event listeners from the cache file to our _tmp array

private

Returns
void

Definition at line 573 of file event_manager.inc.

addEventListener ( $listener,
  $events = Array(),
  $broadcast_polling_events = true 
)

Allows an object to listen to a runtime event

If the listener does not want to receive broadcasts from events that are currently polling, set the broadcast_polling_events to FALSE.

Parameters
object&$objectthe object that is listening (use $this for yourself)
array$eventsan array of events that the object wants to listen to
boolean$broadcast_polling_eventsif TRUE any events that are polling will be broadcasted to this listener
Returns
boolean public

Definition at line 98 of file event_manager.inc.

broadcastEvent ( $broadcaster,
  $event_name = '',
  $vars = Array() 
)

To call an event function on an object that that has signed up to hear a particular event

eg.

$em = $GLOBALS['SQ_SYSTEM']->getEventManager();
$em->broadcastEvent($asset, 'eventName', Array('assetid' => $asset->id));
Parameters
&objectAsset $asset the asset that triggered the event
string$event_namethe name of the event that the asset is triggering
Array$varsany information that the event want to tell the listener

public

Returns
boolean

These will get filled in as necessary (once per broadcast event) Only need to fill them in if we need the data, otherwise we could do it at the top here.

Definition at line 170 of file event_manager.inc.

Constructor

Definition at line 78 of file event_manager.inc.

installStaticEvents (   $listeners = Array(),
  $listener_type_code = '',
  $recursive_call = false 
)

Add static event listeners

This function gets called from package manager of each package that has any management classes that have events to be installed

Parameters
array$listenersarray of listeners
string$listener_type_codethe type code of the listener
boolean$recursive_callif TRUE this call is recursive

private

Returns
boolean

Definition at line 504 of file event_manager.inc.

writeStaticEventsCacheFile ( )

Write the cache file of the current static events in the system

This occurs after all the packages have written their listeners to the system

Returns
boolean public

Definition at line 471 of file event_manager.inc.


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