ultimix
context_set_configs_1_0_0 Class Reference

Public Member Functions

 __construct ()
 load_context_set_config (&$ContextSetSettings, &$Options, $FilePath)
 get_common_state_config (&$Settings, $SettingName, $Default, $ComponentPath)
 load_common_state_config (&$Settings, $SettingName, $Default, $ComponentPath)
 get_context_set_prefix ($PackageName, $PackageVersion= 'last')
 get_context_permits ($Context, $PackageName, $PackageVersion= 'last')

Data Fields

 $CachedMultyFS = false
 $ContextSetConfig = false
 $Trace = false

Detailed Description

Class with context_set utilities.

Author
Dodonov A.A.

Definition at line 26 of file context_set_configs.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

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

Definition at line 56 of file context_set_configs.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->ContextSetConfig = get_package_object( 'settings::settings' , '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 ( $Settings,
  $SettingName,
  $Default,
  $ComponentPath 
)

Function load state's config (for the corresponding button).

Parameters
$Settings- States settings.
$SettingName- Setting's name.
$Default- Default value of the setting.
$ComponentPath- Path to the component.
Returns
Config. false if the config was not loaded.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 146 of file context_set_configs.php.

{
try
{
$Message = "{lang:attempt_to_load_config} : \"$SettingName\" or default \"$Default\"";
$this->Trace->add_trace_string( $Message , COMMON );
$Config = $Settings->get_setting( $SettingName , $Default );
$this->Trace->add_trace_string( "{lang:searching_file} : \"$Config\"" , COMMON );
$Path = dirname( $ComponentPath )."/conf/$Config";
if( $this->CachedMultyFS->file_exists( $Path ) === false )
{
return( false );
}
$Config = $this->CachedMultyFS->file_get_contents( $Path );
$Config = str_replace( '{prefix}' , $Settings->get_setting( 'prefix' , '' ) , $Config );
return( $Config );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_context_permits (   $Context,
  $PackageName,
  $PackageVersion = 'last' 
)

Function returns prefix.

Parameters
$PackageName- Package name.
$PackageVersion- Package version.
Returns
Prefix.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 299 of file context_set_configs.php.

{
try
{
$this->ContextSetConfig->clear();
$FilePath = _get_package_relative_path_ex( $PackageName , $PackageVersion ).'/unexisting_script';
$this->load_context_set_config( $this->ContextSetConfig , $this->ContextSetConfig , $FilePath );
$CommonStateConfig = $this->load_common_state_config(
$this->ContextSetConfig , 'common_state_config_'.$Context.'_form' ,
'cfcxs_'.$Context.'_form' , $FilePath
);
$PermitsFilter = $CommonStateConfig->get_setting( 'permits_filter' , 'admin' );
return( $CommonStateConfig->get_setting( 'permits_validation' , $PermitsFilter ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_context_set_prefix (   $PackageName,
  $PackageVersion = 'last' 
)

Function returns prefix.

Parameters
$PackageName- Package name.
$PackageVersion- Package version.
Returns
Prefix.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 255 of file context_set_configs.php.

{
try
{
$this->ContextSetConfig->clear();
$FilePath = _get_package_relative_path_ex( $PackageName , $PackageVersion ).'/unexisting_script';
$this->load_context_set_config( $this->ContextSetConfig , $this->ContextSetConfig , $FilePath );
return( $this->ContextSetConfig->get_setting( 'prefix' ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
load_common_state_config ( $Settings,
  $SettingName,
  $Default,
  $ComponentPath 
)

Function load state's config (for the corresponding button).

Parameters
$Settings- Set of contexts settings.
$SettingName- Setting's name.
$Default- Default value of the setting.
$ComponentPath- Path to the component.
Returns
true if the config was loaded.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 211 of file context_set_configs.php.

{
try
{
$Config = $this->get_common_state_config( $Settings , $SettingName , $Default , $ComponentPath );
$Config = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$Config->load_settings( $Config );
return( $Config );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
load_context_set_config ( $ContextSetSettings,
$Options,
  $FilePath 
)

Method loads config.

Parameters
$Options- Execution parameters.
$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 92 of file context_set_configs.php.

{
try
{
$FileName = $Options->get_setting( 'common_settings_config' , 'cfcxs_context_set' );
$FilePath = dirname( $FilePath )."/conf/$FileName";
if( $this->CachedMultyFS->file_exists( $FilePath ) )
{
$File = $this->CachedMultyFS->file_get_contents( $FilePath );
$this->Trace->add_trace_string( '{lang:common_settings_config} : '.$File , COMMON );
$ContextSetSettings->load_settings( $File );
}
}
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_configs.php.

$ContextSetConfig = false

Definition at line 39 of file context_set_configs.php.

$Trace = false

Definition at line 40 of file context_set_configs.php.


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