ultimix
common_state_startup_utilities_1_0_0 Class Reference

Public Member Functions

 __construct ()
 get_common_state_config (&$ContextSet, $Options, $StateName, $Suffix= '')
 trace_no_need_to_run_state_message ($StateName, $Prefix, $ContextAction)
 trace_config_was_not_found_message ($StateName)
 prepare_config (&$ContextSet, $Config, $StateName)
 run_controller_state (&$ContextSet, $Options, $StateName, $Config)
 prepare_options ($Options, $StateName, $Config)
 run_view_state (&$ContextSet, $Options, $StateName, $Config)
 try_run_controller_state (&$ContextSet, $Options, $StateName)
 try_run_view_state (&$ContextSet, $Options, $StateName)

Data Fields

 $ContextSetConfigs = false
 $DefaultControllers = false
 $DefaultViews = false
 $LocalOptions = false
 $Security = false
 $Trace = false

Detailed Description

Class for rapid buttons creation.

Author
Dodonov A.A.

Definition at line 26 of file common_state_startup_utilities.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 59 of file common_state_startup_utilities.php.

{
try
{
$this->ContextSetConfigs = get_package( 'gui::context_set::context_set_configs' , 'last' , __FILE__ );
$this->DefaultControllers = get_package( 'gui::context_set::default_controllers' , 'last' , __FILE__ );
$this->DefaultViews = get_package( 'gui::context_set::default_views' , 'last' , __FILE__ );
$this->LocalOptions = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , '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

get_common_state_config ( $ContextSet,
  $Options,
  $StateName,
  $Suffix = '' 
)

Function loads common state's config.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
$StateName- State's name.
$Suffix- Suffix.
Returns
State's config.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 110 of file common_state_startup_utilities.php.

{
try
{
$FieldName = 'common_state_config_'.$StateName.$Suffix;
$FileName = 'cfcxs_'.$StateName.$Suffix;
return(
$this->ContextSetConfigs->get_common_state_config(
$ContextSet->ContextSetSettings , $FieldName , $FileName , $Options->get_setting( 'file_path' )
)
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
prepare_config ( $ContextSet,
  $Config,
  $StateName 
)

Function prepares.

Parameters
$ContextSet- Set of contexts.
$Config- State's config.
$StateName- State's name.
Returns
Config.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 283 of file common_state_startup_utilities.php.

{
try
{
if( strpos( $Config , 'success_message=' ) === false )
{
$Config .= "\r\nsuccess_message=".$ContextSet->Prefix.'_'.$StateName.'_was_completed';
}
if( strpos( $Config , 'cleanup_fields=' ) === false )
{
$Config .= "\r\ncleanup_fields=".$ContextSet->Prefix."_action,".
$ContextSet->Prefix."_context_action";
}
if( strpos( $Config , 'success_func=' ) === false )
{
$Config .= "\r\nsuccess_func=$StateName";
}
return( $Config );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
prepare_options (   $Options,
  $StateName,
  $Config 
)

Function prepares run options.

Parameters
$Options- Execution parameters.
$StateName- State's name.
$Config- State's config.
Returns
State's config.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 399 of file common_state_startup_utilities.php.

{
try
{
$this->LocalOptions->clear();
$this->LocalOptions->append_settings( $Config );
$this->LocalOptions->add_settings_from_object( $Options );
$this->LocalOptions->set_undefined( 'access_package_version' , 'last' );
if( strpos( $Config , 'success_func' ) === false )
{
$Suffix = '_form';
$Config .= "\r\nsuccess_func=".$StateName.$Suffix;
$this->LocalOptions->set_undefined( 'success_func' , $StateName.$Suffix );
}
return( $Config );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_controller_state ( $ContextSet,
  $Options,
  $StateName,
  $Config 
)

Function runs state-controller.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
$StateName- State's name.
$Config- State's config.
Returns
true if the state was executed.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 343 of file common_state_startup_utilities.php.

{
try
{
$Config = $this->prepare_config( $ContextSet , $Config , $StateName );
$this->LocalOptions->clear();
$this->LocalOptions->append_settings( $Config );
$this->LocalOptions->add_settings_from_object( $Options );
$this->LocalOptions->set_undefined( 'access_package_version' , 'last' );
$this->LocalOptions->set_undefined( $StateName.'_func' , $StateName == 'copy' ? 'create' : $StateName );
$ContextSet->Context->load_raw_config( $Config );
if( $ContextSet->run_execution( $this->LocalOptions , $this->DefaultControllers , 1 ) )
{
return( true );
}
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_view_state ( $ContextSet,
  $Options,
  $StateName,
  $Config 
)

Function runs state-view.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
$StateName- State's name.
$Config- State's config.
Returns
true if the state was executed.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 457 of file common_state_startup_utilities.php.

{
try
{
$this->Trace->add_trace_string( '{lang:run_view_state}' , COMMON );
$Config = $this->prepare_options( $Options , $StateName , $Config );
$ContextSet->Context->load_raw_config( $Config );
if( $ContextSet->Context->execute( $this->LocalOptions , $this->DefaultViews ) )
{
$this->Trace->add_trace_string( '{lang:run_view_state_true}' , COMMON );
return( true );
}
$this->Trace->add_trace_string( '{lang:run_view_state_false}' , COMMON );
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
trace_config_was_not_found_message (   $StateName)

Trace function.

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

Definition at line 241 of file common_state_startup_utilities.php.

{
try
{
$this->Trace->add_trace_string( "State config was not found ( $StateName )" );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
trace_no_need_to_run_state_message (   $StateName,
  $Prefix,
  $ContextAction 
)

Trace function.

Parameters
$StateName- State name.
$Prefix- Prefix.
$ContextAction- Context action.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 201 of file common_state_startup_utilities.php.

{
try
{
$this->Trace->add_trace_string( '{lang:no_need_to_run_trace_message}' , COMMON );
if( strpos( $ContextAction , '_form' ) !== false )
{
$this->trace_field( $Prefix , 'context_action' , $ContextAction );
}
if( strpos( $ContextAction , '_form' ) === false )
{
$this->trace_field( $Prefix , 'action' , $StateName );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
try_run_controller_state ( $ContextSet,
  $Options,
  $StateName 
)

Function processes state-controller.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
$StateName- State's name.
Returns
true if the state was processed.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 512 of file common_state_startup_utilities.php.

{
try
{
$Config = $this->get_common_state_config( $ContextSet , $Options , $StateName );
if( $Config !== false )
{
return( $this->run_controller_state( $ContextSet , $Options , $StateName , $Config ) );
}
else
{
$this->trace_config_was_not_found_message( $StateName );
}
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
try_run_view_state ( $ContextSet,
  $Options,
  $StateName 
)

Function processes state-view.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
$StateName- State's name.
Returns
true if the state was processed.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 565 of file common_state_startup_utilities.php.

{
try
{
$Config = $this->get_common_state_config( $ContextSet , $Options , $StateName , '_form' );
if( $Config !== false )
{
return( $this->run_view_state( $ContextSet , $Options , $StateName , $Config ) );
}
else
{
$this->trace_config_was_not_found_message( $StateName );
}
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$ContextSetConfigs = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file common_state_startup_utilities.php.

$DefaultControllers = false

Definition at line 39 of file common_state_startup_utilities.php.

$DefaultViews = false

Definition at line 40 of file common_state_startup_utilities.php.

$LocalOptions = false

Definition at line 41 of file common_state_startup_utilities.php.

$Security = false

Definition at line 42 of file common_state_startup_utilities.php.

$Trace = false

Definition at line 43 of file common_state_startup_utilities.php.


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