ultimix
context_set_1_0_0 Class Reference

Public Member Functions

 __construct ()
 pre_generation ($Options)
 clear ()
 add_context ($ContextPath)
 add_contexts (&$Options, $ContextFolder, $Contexts)
 get_update_record ($New, $Original)
 compile_prefix ($Str, $Changed)
 set_locations (&$Options, $AutoRedirect)
 run_execution ($Options, $Provider, $AutoRedirect=0)
 run_custom_states (&$Options)
 execute (&$Options, $Provider, $FilePath)
 compile_special_macro (&$Options, $Str, &$Changed)
 __toString ()

Data Fields

 $CachedMultyFS = false
 $CommonStateStartup = false
 $ContextSetConfigs = false
 $CustomStateStartup = false
 $Context = false
 $ContextSetSettings = false
 $CustomSettings = false
 $Messages = false
 $PageJS = false
 $Security = false
 $String = false
 $Trace = false
 $Prefix
 $Provider
 $Contexts = array()

Detailed Description

Class for rapid controllers and viewes development.

Author
Dodonov A.A.

Definition at line 26 of file context_set.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 162 of file context_set.php.

{
try
{
$this->CommonStateStartup = get_package( 'gui::context_set::common_state_startup' , 'last' , __FILE__ );
$this->ContextSetConfigs = get_package( 'gui::context_set::context_set_configs' , 'last' , __FILE__ );
$this->CustomStateStartup = get_package( 'gui::context_set::custom_state_startup' , 'last' , __FILE__ );
$this->get_main_packages();
$this->get_additional_packages();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

__toString ( )

Method converts object to string.

Returns
string with the object's description.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 813 of file context_set.php.

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

Method adds non-standart context.

Parameters
$ContextPath- Path to the context's config.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 253 of file context_set.php.

{
try
{
$this->Contexts [] = $ContextPath;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
add_contexts ( $Options,
  $ContextFolder,
  $Contexts 
)

Method adds non-standart contexts.

Parameters
$Options- Options.
$ContextFolder- Path to the directory.
$Contexts- Contexts.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 291 of file context_set.php.

{
try
{
$HintedContext = $Options->get_setting( 'context' , false );
if( $HintedContext !== false && in_array( $HintedContext , $Contexts ) )
{
$this->Trace->add_trace_string( "Hinted context : $ContextFolder/conf/$HintedContext" , COMMON );
$this->Contexts [] = "$ContextFolder/conf/$HintedContext";
}
else
{
$this->Trace->add_trace_string( "Hinted context : all contexts" , COMMON );
foreach( $Contexts as $i => $Context )
{
$this->Contexts [] = "$ContextFolder/conf/$Context";
}
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
clear ( )

Method clears system structures.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 223 of file context_set.php.

{
try
{
$this->Contexts = array();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_prefix (   $Str,
  $Changed 
)

Method processes macro 'prefix'.

Parameters
$Str- String to process.
$Changed- true if any of the page's elements was compiled.
Returns
array( Processed string , Was the string changed ).
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 398 of file context_set.php.

{
try
{
if( strpos( $Str , '{prefix}' ) !== false )
{
$Str = str_replace( '{prefix}' , $this->Prefix ,$Str );
$Changed = true;
}
return( array( $Str , $Changed ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_special_macro ( $Options,
  $Str,
$Changed 
)

Method processes string.

Parameters
$Options- Settings.
$Str- String to process.
$Changed- true if any of the page's elements was compiled.
Returns
Processed string.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 779 of file context_set.php.

{
try
{
list( $Str , $Changed ) = $this->ContextSetMarkup->compile_options( $Options , $Str , $Changed );
$Str = str_replace( '{prefix}' , $this->Prefix , $Str );
return( $Str );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
execute ( $Options,
  $Provider,
  $FilePath 
)

Method starts controller/view.

Parameters
$Options- Execution parameters.
$Provider- Object of the class wich provides all handlers.
$FilePath- Path tp the component. Must be equal to FILE
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 728 of file context_set.php.

{
try
{
$this->Trace->start_group( "ContextSet::execute for class \"".get_class( $Provider )."\"" );
$this->Trace->add_trace_string( serialize( $Options->get_raw_settings() ) , COMMON );
$Options->set_setting( 'file_path' , $FilePath );
$this->Provider = $Provider;
$this->Provider->Output = false;
$this->execute_do( $Options , $Provider , $FilePath );
$this->Trace->end_group();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_update_record (   $New,
  $Original 
)

Method returns update record.

Parameters
$New- Record.
$Original- Record.
Returns
- Record.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 343 of file context_set.php.

{
try
{
$Update = array();
foreach( $New as $Field => $NewValue )
{
$Field = str_replace( $this->Prefix.'_' , '' , $Field );
if( @$Original->$Field == $NewValue )
{
continue;
}
if( @$Original->$Field != $this->Security->get( $NewValue , 'unsafe_string' ) )
{
@$Update[ $Field ] = $NewValue;
continue;
}
}
return( $Update );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
pre_generation (   $Options)

Method executes before any page generating actions took place.

Parameters
$Options- Settings.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 196 of file context_set.php.

{
try
{
$Path = _get_package_relative_path_ex( 'gui::context_set' , '1.0.0' );
$this->PageJS->add_javascript( "{http_host}/$Path/include/js/context_set.js" );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_custom_states ( $Options)

Method starts controller/view.

Parameters
$Options- Execution parameters.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 585 of file context_set.php.

{
try
{
$this->Trace->start_group( "custom_configs_processing" , COMMON );
foreach( $this->Contexts as $i => $ContextPath )
{
$this->Trace->add_trace_string( "Processing context $ContextPath" , COMMON );
$Config = $this->load_custom_settings( $ContextPath , $Options );
$Result = $this->CustomStateStartup->run_config_processors(
$this , $Config , $this->CustomSettings , $Options
);
if( $Result )
{
break;
}
}
$this->Trace->end_group();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_execution (   $Options,
  $Provider,
  $AutoRedirect = 0 
)

Method starts controller/view.

Parameters
$Options- Execution parameters.
$Provider- Object of the class wich provides all handlers.
$AutoRedirect- Redirect page.
Returns
true if the execution was successfull.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 494 of file context_set.php.

{
try
{
$GUI = get_package( 'gui' , 'last' , __FILE__ );
if( $this->Context->execute( $Options , $Provider ) )
{
$this->set_locations( $Options , $AutoRedirect );
$GUI->set_var( 'last_context_set_execution_code' , 0 );
$GUI->set_var(
'last_context_set_execution_message' , $this->Messages->get_last_success_message()
);
return( true );
}
$GUI->set_var( 'last_context_set_execution_code' , 1 );
$GUI->set_var(
'last_context_set_execution_message' , $this->Messages->get_last_error_message()
);
return( false );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_locations ( $Options,
  $AutoRedirect 
)

Function tries to redirect on another page.

Parameters
$Options- Redirect settings.
$AutoRedirect- Should be redirected.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 438 of file context_set.php.

{
try
{
$AutoRedirect = intval( $Options->get_setting( 'auto_redirect' , $AutoRedirect ) );
$AutoRedirect = $this->Security->get_gp( 'auto_redirect' , 'integer' , $AutoRedirect );
if( $AutoRedirect && $this->Security->get_srv( 'HTTP_REFERER' , 'set' ) )
{
header( $_SERVER[ 'SERVER_PROTOCOL' ].' 303 See Other' );
if( $Options->get_setting( 'redirect_page' , false ) )
{
header( "Location: ".$Options->get_setting( 'redirect_page' ) );
}
else
{
header( "Location: ".$this->Security->get_srv( 'HTTP_REFERER' , 'raw' ) );
}
exit( 0 );
}
}
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 38 of file context_set.php.

$CommonStateStartup = false

Definition at line 39 of file context_set.php.

$Context = false

Definition at line 42 of file context_set.php.

$Contexts = array()

Paths to the non-standart contexts.

Author
Dodonov A.A.

Definition at line 85 of file context_set.php.

$ContextSetConfigs = false

Definition at line 40 of file context_set.php.

$ContextSetSettings = false

Definition at line 43 of file context_set.php.

$CustomSettings = false

Definition at line 44 of file context_set.php.

$CustomStateStartup = false

Definition at line 41 of file context_set.php.

$Messages = false

Definition at line 45 of file context_set.php.

$PageJS = false

Definition at line 46 of file context_set.php.

$Prefix

Prefix.

Author
Dodonov A.A.

Definition at line 61 of file context_set.php.

$Provider

Class'es object wich provides methods.

Author
Dodonov A.A.

Definition at line 73 of file context_set.php.

$Security = false

Definition at line 47 of file context_set.php.

$String = false

Definition at line 48 of file context_set.php.

$Trace = false

Definition at line 49 of file context_set.php.


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