ultimix
event_manager_1_0_0 Class Reference

Public Member Functions

 __construct ()
 register_event ($Event, $PackageName, $PackageVersion, $Handler=false)
 register_events ($ConfigPath)
 trigger_event ($Event, $Parameters)

Data Fields

 $LoadedBindings = array()
 $CachedMultyFS = false
 $String = false
 $Settings = false

Detailed Description

Class for event processing.

Author
Dodonov A.A.

Definition at line 26 of file event_manager.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Author
Dodonov A.A.

Definition at line 54 of file event_manager.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->register_events( dirname( __FILE__ ).'/conf/cf_event_manager_binded_events' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

register_event (   $Event,
  $PackageName,
  $PackageVersion,
  $Handler = false 
)

Function registers event handler.

Parameters
$Event- Event's name.
$PackageName- Package's name.
$PackageVersion- Package's version.
$Handler- Event's handler.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 99 of file event_manager.php.

{
try
{
if( isset( $this->LoadedBindings[ $Event ] ) === false )
{
$this->LoadedBindings[ $Event ] = array();
}
if( isset( $this->LoadedBindings[ $Event ][ $PackageName ] ) === false )
{
$this->LoadedBindings[ $Event ][ $PackageName ] = array();
}
if( isset( $this->LoadedBindings[ $Event ][ $PackageName ][ $PackageVersion ] ) === false )
{
$this->LoadedBindings[ $Event ][ $PackageName ][ $PackageVersion ] = array();
}
$this->LoadedBindings[ $Event ][ $PackageName ][ $PackageVersion ] [] = $Handler;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
register_events (   $ConfigPath)

Function registers event handlers.

Parameters
$ConfigPath- Path to the config with event bindings.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 144 of file event_manager.php.

{
try
{
$Bindings = $this->CachedMultyFS->file_get_contents( $ConfigPath , 'cleaned' );
if( $Bindings != '' )
{
$Bindings = explode( "\n" , $Bindings );
foreach( $Bindings as $k => $v )
{
$this->Settings->load_settings( $v );
$this->register_event( $this->Settings->get_setting( 'event' ) ,
$this->Settings->get_setting( 'package_name' ) ,
$this->Settings->get_setting( 'package_version' ) ,
$this->Settings->get_setting( 'handler' , false ) );
}
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
trigger_event (   $Event,
  $Parameters 
)

Function runs event handler.

Parameters
$Event- Event's name.
$Parameters- Event's parameters.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 194 of file event_manager.php.

{
try
{
$Return = array();
if( isset( $this->LoadedBindings[ $Event ] ) )
{
foreach( $this->LoadedBindings[ $Event ] as $PackageName => $PackageVersions )
{
foreach( $PackageVersions as $PackageVersion => $FunctionNames )
{
foreach( $FunctionNames as $k => $FunctionName )
{
$Object = get_package( $PackageName , $PackageVersion , __FILE__ );
$Return [] = call_user_func( array( $Object , $FunctionName ) , $Parameters );
}
}
}
}
return( $Return );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$CachedMultyFS = false

Cached objects.

Author
Dodonov A.A.

Definition at line 40 of file event_manager.php.

$LoadedBindings = array()

Definition at line 28 of file event_manager.php.

$Settings = false

Definition at line 42 of file event_manager.php.

$String = false

Definition at line 41 of file event_manager.php.


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