Per project overruleable event processing engine

As these classes may need setting of values this subclass implements the checkRegistryRequestsAnswers() easy access to resources.

package Gems
subpackage Event
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.4
inherited_from \Gems_Loader_TargetLoaderAbstract

 Methods

__construct()

__construct(mixed $container, array $dirs) 
Inherited

Parameters

$container

mixed

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__get()

__get($name) 
Inherited

Parameters

$name

Add prefixed paths to the registry of paths

addPrefixPath(string $prefix, $path, boolean $prepend = true) : \Gems_Loader_LoaderAbstract
Inherited

Parameters

$prefix

string

$path

$prepend

boolean

Put path at the beginning of the stack (has no effect when prefix / dir already set)

Returns

\Gems_Loader_LoaderAbstract(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

Allows the loader to set resources.

answerRegistryRequest(string $name, mixed $resource) : boolean
Inherited

Parameters

$name

string

Name of resource to set

$resource

mixed

The resource.

Returns

booleanTrue if $resource was OK

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean
Inherited

Returns

booleanFalse if required values are missing.

Allows the loader to know the resources to set.

getRegistryRequests() : array
Inherited

Returns those object variables defined by the subclass but not at the level of this definition.

Can be overruled.

Returns

arrayof string names

listRoundChangedEvents()

listRoundChangedEvents() : array

Returns

arrayeventname => string

listSurveyBeforeAnsweringEvents()

listSurveyBeforeAnsweringEvents() : array

Returns

arrayeventname => string

listSurveyCompletionEvents()

listSurveyCompletionEvents() : array

Returns

arrayeventname => string

listSurveyDisplayEvents()

listSurveyDisplayEvents() : array

Returns

arrayeventname => string

listTrackCalculationEvents()

listTrackCalculationEvents() : array

Returns

arrayeventname => string

listTrackCompletionEvents()

listTrackCompletionEvents() : array

Returns

arrayeventname => string

listTrackFieldUpdateEvents()

listTrackFieldUpdateEvents() : array

Returns

arrayeventname => string

loadRoundChangedEvent()

loadRoundChangedEvent(string $eventName) : \Gems_Event_RoundChangedEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_RoundChangedEventInterface

loadSurveyBeforeAnsweringEvent()

loadSurveyBeforeAnsweringEvent(string $eventName) : \Gems_Event_SurveyBeforeAnsweringEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_SurveyBeforeAnsweringEventInterface

loadSurveyCompletionEvent()

loadSurveyCompletionEvent(string $eventName) : \Gems_Event_SurveyCompletedEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_SurveyCompletedEventInterface

loadSurveyDisplayEvent()

loadSurveyDisplayEvent(string $eventName) : \Gems_Event_SurveyDisplayEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_SurveyDisplayEventInterface

loadTrackCalculationEvent()

loadTrackCalculationEvent(string $eventName) : \Gems_Event_TrackCalculationEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_TrackCalculationEventInterface

loadTrackCompletionEvent()

loadTrackCompletionEvent(string $eventName) : \Gems_Event_TrackCompletedEventInterface

Parameters

$eventName

string

Returns

\Gems_Event_TrackCompletedEventInterface

loadTrackFieldUpdateEvent()

loadTrackFieldUpdateEvent(string $eventName) : \Gems_TrackFieldUpdateEventInterface

Parameters

$eventName

string

Returns

\Gems_TrackFieldUpdateEventInterface

Add a subdirectory / sub name to a list of class load paths

_cascadedDirs(array $dirs, string $cascade, boolean $fullClassnameFallback = true) : array
Inherited

Parameters

$dirs

array

prefix => path

$cascade

string

The sub directories to cascade to

$fullClassnameFallback

boolean

Allows full class name specification instead of just plugin name part

Returns

arrayprefix => path

Returns $this->$name, creating the item if it does not yet exist.

_getClass(string $name, string $className = null, array $arguments = array()) : mixed
Inherited

Parameters

$name

string

The $name of the variable to store this object in.

$className

string

Class name or null if the same as $name, prepending $this->_dirs.

$arguments

array

Class initialization arguments.

Returns

mixedInstance of $className

Lookup event class for an event type. This class or interfce should at the very least implement the EventInterface.

_getEventClass(string $eventType) : string
see

Parameters

$eventType

string

The type (i.e. lookup directory) to find the associated class for

Returns

stringClass/interface name associated with the type

_getEventDirs()

_getEventDirs(string $eventType) : array

Parameters

$eventType

string

An event subdirectory (may contain multiple levels split by '/'

Returns

arrayAn array of type prefix => classname

Returns a list of selectable events with an empty element as the first option.

_listEvents(string $eventType) : \Gems_tracker_TrackerEventInterface

Parameters

$eventType

string

The type (i.e. lookup directory with an associated class) of the events to list

Returns

\Gems_tracker_TrackerEventInterfaceor more specific a $eventClass type object

Create or loads the class. When only loading, this function returns a StaticCall object that can be invoked lazely.

_loadClass(string $name, boolean $create = false, array $arguments = array()) : mixed
Inherited
see
see

Parameters

$name

string

The class name, minus the part in $this->_dirs.

$create

boolean

Create the object, or only when an \MUtil_Registry_TargetInterface instance.

$arguments

array

Class initialization arguments.

Returns

mixedA class instance or a \MUtil_Lazy_StaticCall object

Loads and initiates an event class and returns the class (without triggering the event itself).

_loadEvent(string $eventName, string $eventType) : \Gems_tracker_TrackerEventInterface

Parameters

$eventName

string

The class name of the individual event to load

$eventType

string

The type (i.e. lookup directory with an associated class) of the event

Returns

\Gems_tracker_TrackerEventInterfaceor more specific a $eventClass type object

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

 Properties

 

The prefix/path location to look for classes.

$_dirs : array

Default

The standard value is

  • => application/classes
  • Gems => library/Gems/classes

But an alternative could be:

  • Demopulse => application/classes
  • Pulse => application/classes
  • Gems => library/Gems/classes
 

Each event type must implement an event class or interface derived from EventInterface specified in this array.

$_eventClasses : array

Default

array(self::TRACK_CALCULATION_EVENT => 'Gems_Event_TrackCalculationEventInterface', self::TRACK_COMPLETION_EVENT => 'Gems_Event_TrackCompletedEventInterface', self::TRACK_FIELDUPDATE_EVENT => 'Gems_Event_TrackFieldUpdateEventInterface', self::ROUND_CHANGED_EVENT => 'Gems_Event_RoundChangedEventInterface', self::SURVEY_BEFORE_ANSWERING_EVENT => 'Gems_Event_SurveyBeforeAnsweringEventInterface', self::SURVEY_COMPLETION_EVENT => 'Gems_Event_SurveyCompletedEventInterface', self::SURVEY_DISPLAY_EVENT => 'Gems_Event_SurveyDisplayEventInterface')
see
 

$_loader

$_loader : \MUtil_Loader_PluginLoader

Default

 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

null
 

$util

$util : \Gems_Util

Default

 Constants

 

ROUND_CHANGED_EVENT

ROUND_CHANGED_EVENT = 'Round/Changed' 
 

SURVEY_BEFORE_ANSWERING_EVENT

SURVEY_BEFORE_ANSWERING_EVENT = 'Survey/BeforeAnswering' 
 

SURVEY_COMPLETION_EVENT

SURVEY_COMPLETION_EVENT = 'Survey/Completed' 
 

SURVEY_DISPLAY_EVENT

SURVEY_DISPLAY_EVENT = 'Survey/Display' 
 

TRACK_CALCULATION_EVENT

TRACK_CALCULATION_EVENT = 'Track/Calculate' 
 

TRACK_COMPLETION_EVENT

TRACK_COMPLETION_EVENT = 'Track/Completed' 
 

TRACK_FIELDUPDATE_EVENT

TRACK_FIELDUPDATE_EVENT = 'Track/FieldUpdate'