ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
context_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| load_config ($ConfigFilePath)
| load_hinted_config (&$Options, $ContextFolder, $Contexts)
| load_raw_config ($Config)
| load_config_from_object (&$Config)
| compile_call_params_filter (&$Options)
| compile_permits_filter (&$Options)
| compile_permits_validation (&$Options)
| compile_custom_validation (&$Options)
| compile_error_func (&$Owner, &$Options)
| check_success_function (&$Owner, $Func)
| compile_package_success_func (&$Options, &$Owner, $Func)
| execute (&$Options, &$Owner)

## Data Fields
| $Config = false
| $CachedMultyFS = false
| $ContextUtilities = false
| $CustomValidations = false
| $Messages = false
| $PermitAlgorithms = false
| $Security = false
| $SecurityValidator = false
| $Settings = false
| $Trace = false

## Detailed Description

Class for rapid controllers and viewes development.

Author
  Dodonov A.A.

Definition at line 26 of file context.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 74 of file context.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->ContextUtilities = get_package( 'gui::context::context_utilities' , 'last' , __FILE__ );
$this->CustomValidations = get_package( 'gui::context::custom_validations' , 'last' , __FILE__ );
$this->Messages = get_package( 'page::messages' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->SecurityValidator = get_package( 'security::security_validator' , 'last' , __FILE__ );
$this->Trace = get_package( 'trace' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

check_success_function | ( | & | $Owner,
|  |  | $Func
| ) |  |

Function checks custom context method.

Parameters

  $Options | - Execution parameters.
  $Owner | - Object of the class wich provides all handlers.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 546 of file context.php.

{
try
{
if( method_exists( $Owner , $Func ) === false )
{
throw( new Exception( "Method \"$Func\" was not found in class ".get_class( $Owner ) ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_call_params_filter | ( | & | $Options | ) |

Function validates call parameters.

Parameters

  $Options | - Execution parameters.

Returns
  false if the condition was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 257 of file context.php.

{
try
{
if( $this->ContextUtilities->section_exists( $this->Config , 'call_params_filter' ) )
{
$Filter = $this->ContextUtilities->get_section( $this->Config , 'call_params_filter' );
if( $this->SecurityValidator->validate_custom_fields( $Options->get_raw_settings() ,
$Filter ) === false )
{
$this->Trace->add_trace_string(
"{lang:call_params_filter_not_passed} : $Filter" , COMMON
);
return( false );
}
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_custom_validation | ( | & | $Options | ) |

Custom validations.

Parameters

  $Options | - Execution parameters.

Returns
  false if the validation was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 400 of file context.php.

{
try
{
if( $this->ContextUtilities->section_exists( $this->Config , 'custom_validation' ) )
{
$CustomValidation = $this->ContextUtilities->get_section( $this->Config , 'custom_validation' );
if( $this->CustomValidations->custom_validation( $CustomValidation , $Options ) === false )
{
$TraceString = "{lang:custom_validation_not_passed} : $CustomValidation";
$this->Trace->add_trace_string( $TraceString , COMMON );
return( false );
}
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_error_func | ( | & | $Owner,
|  | & | $Options
| ) |  |

Function processes errors.

Parameters

  $Options | - Execution parameters.
  $Owner | - Object of the class wich provides all handlers.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 498 of file context.php.

{
try
{
$Func = $this->ContextUtilities->get_section( $this->Config , 'error_func' , false );
if( $Func === false )
{
$ErrMsg = $this->SecurityValidator->get_error_message();
$ErrMsg = $ErrMsg === '' ? 'an_error_occured' : $ErrMsg;
$this->Messages->add_error_message( $ErrMsg );
$this->Trace->add_trace_string( "{lang:_std_error_message} : ".$ErrMsg , COMMON );
}
else
{
$FuncBody = 'return( $Owner->'.$Func.'( $Options ) );';
$NewFunc = create_function( '$OwnerObject , $Options' , $FuncBody );
$NewFunc( $Owner , $Options );
}
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_package_success_func | ( | & | $Options,
|  | & | $Owner,
|  |  | $Func
| ) |  |

Function processes custom context method.

Parameters

  $Options | - Execution parameters.
  $Owner | - Object of the class wich provides all handlers.
  $Func | - Function name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 622 of file context.php.

{
try
{
$this->check_success_function( $Owner , $Func );
$FunctionBody = 'return( $OwnerObject->'.$Func.'( $Options ) );';
$NewFunc = create_function( '$OwnerObject , $Options' , $FunctionBody );
$this->Trace->add_trace_string( "{lang:calling_method} ".get_class( $Owner )."->$Func" , COMMON );
if( $NewFunc( $Owner , $Options ) !== false )
{
$this->cleanup_fields();
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_permits_filter | ( | & | $Options | ) |

Function validates permits filters.

Parameters

  $Options | - Execution parameters.

Returns
  false if the filtration was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 304 of file context.php.

{
try
{
$this->PermitAlgorithms = get_package( 'permit::permit_algorithms' , 'last' , __FILE__ );
if( $this->ContextUtilities->section_exists( $this->Config , 'permits_filter' ) )
{
$Filter = $this->ContextUtilities->get_section( $this->Config , 'permits_filter' );
if( $this->PermitAlgorithms->fetch_permits_for_object( false , 'user' , $Filter ) === false )
{
$this->Trace->add_trace_string( "{lang:permits_filter_not_passed} : $Filter" , COMMON );
return( false );
}
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_permits_validation | ( | & | $Options | ) |

Function validates permits.

Parameters

  $Options | - Execution parameters.

Returns
  false if the validation was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 351 of file context.php.

{
try
{
if( $this->ContextUtilities->section_exists( $this->Config , 'permits_validation' ) )
{
$Validation = $this->ContextUtilities->get_section( $this->Config , 'permits_validation' );
if( $this->PermitAlgorithms->fetch_permits_for_object( false , 'user' , $Validation ) === false )
{
$this->Trace->add_trace_string(
"{lang:permits_validation_was_not_passed} : $Validation" , COMMON
);
$this->ContextUtilities->compile_no_permits( $Validation );
return( false );
}
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

execute | ( | & | $Options,
|  | & | $Owner
| ) |  |

Function starts controller/view.

Parameters

  $Options | - Execution parameters.
  $Owner | - Object of the class wich provides all handlers.

Returns
  True if the contoller/view started correctly, false otherwise.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 834 of file context.php.

{
try
{
$this->Trace->start_group( "Context::execute for class \"".get_class( $Owner )."\"" );
$Result = $this->run_execution( $Options , $Owner );
$Msg = '{lang:'.( $Result ? 'state_was_processed' : 'state_was_not_processed' ).'}';
$this->Trace->add_trace_string( $Msg , COMMON );
$this->Trace->end_group();
return( $Result );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

load_config | ( |  | $ConfigFilePath | ) |

Function loads config.

Parameters

  $ConfigFilePath | - Execution config's file name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 110 of file context.php.

{
try
{
$Tmp = $this->CachedMultyFS->file_get_contents( $ConfigFilePath );
$this->load_raw_config( $Tmp );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

load_config_from_object | ( | & | $Config | ) |

Function loads config.

Parameters

  $Config | - Config.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 223 of file context.php.

{
try
{
$this->Config = $Config->get_raw_settings();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

load_hinted_config | ( | & | $Options,
|  |  | $ContextFolder,
|  |  | $Contexts
| ) |  |

Method adds non-standart contexts.

Parameters

  $Options | - Options.
  $ContextFolder | - Path to the directory.
  $Contexts | - Contexts.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 149 of file context.php.

{
try
{
$Hint = $Options->get_setting( 'context' , false );
if( $Hint !== false && in_array( $Hint , $Contexts ) )
{
$this->load_config( "$ContextFolder/conf/$Hint" );
}
else
{
throw( new Exception( 'Config was not hinted' ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

load_raw_config | ( |  | $Config | ) |

Function loads config.

Parameters

  $Config | - Config.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 188 of file context.php.

{
try
{
if( $this->Settings === false )
{
$this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
}
$this->Settings->load_settings( $Config );
$this->Config = $this->Settings->get_raw_settings();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$CachedMultyFS = false

Cached packages.

Author
  Dodonov A.A.

Definition at line 50 of file context.php.

$Config = false

Execution config.

Author
  Dodonov A.A.

Definition at line 38 of file context.php.

$ContextUtilities = false

Definition at line 51 of file context.php.

$CustomValidations = false

Definition at line 52 of file context.php.

$Messages = false

Definition at line 53 of file context.php.

$PermitAlgorithms = false

Definition at line 54 of file context.php.

$Security = false

Definition at line 55 of file context.php.

$SecurityValidator = false

Definition at line 56 of file context.php.

$Settings = false

Definition at line 57 of file context.php.

$Trace = false

Definition at line 58 of file context.php.

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

- packages/gui/packages/context/context.php