ultimix
context_set_utilities_1_0_0 Class Reference

Public Member Functions

 __construct ()
 set_header_template ($Options, &$Paging, $Prefix)
 set_item_template ($Options, &$Paging, $Prefix)
 set_no_data_found_message ($Options, &$Paging)
 set_footer_template ($Options, &$Paging, $Prefix)
 set_main_settings ($Options, &$Paging)
 get_original_records (&$Options, $IdList)
 get_data_record (&$Options, $IdList)
 extract_data_from_request (&$Options, $Record, $SettingName, $Prefix)
 get_data_provider (&$Options, &$DefaultProvider)
 get_posted_ids ($Prefix)
 set_form_data ($Form, $Data)
 set_grid_data ($Options, &$Paging, $QueryString= '1=1')
 get_form (&$Options, $IdList, $FormFileName, $Prefix, $State)

Data Fields

 $BlockSettings = false
 $CachedMultyFS = false
 $PageComposer = false
 $Security = false
 $SecurityParser = false
 $SecurityUtilities = false
 $String = false
 $Trace = false

Detailed Description

Class with context_set utilities.

Author
Dodonov A.A.

Definition at line 26 of file context_set_utilities.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

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

Definition at line 61 of file context_set_utilities.php.

{
try
{
$this->BlockSettings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->PageComposer = get_package( 'page::page_composer' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->SecurityParser = get_package( 'security::security_parser' , 'last' , __FILE__ );
$this->SecurityUtilities = get_package( 'security::security_utilities' , 'last' , __FILE__ );
$this->String = get_package( 'string' , '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

extract_data_from_request ( $Options,
  $Record,
  $SettingName,
  $Prefix 
)

Function fetches id' from the request.

Parameters
$Options- Execution parameters.
$Record- This record will be extended with the data from request.
$SettingName- Setting name with the extraction script.
$Prefix- Entity prefix.
Returns
String with id list.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 414 of file context_set_utilities.php.

{
try
{
if( $Options->get_setting( $SettingName , false ) )
{
$Parameter = $Options->get_setting( $SettingName );
$PostedRecord = $this->SecurityParser->parse_http_parameters( $Parameter );
foreach( $PostedRecord as $k => $v )
{
$k = str_replace( $Prefix.'_' , '' , $k );
if( $v !== false )
{
set_field( $Record , $k , $v );
}
}
}
return( $Record );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_data_provider ( $Options,
$DefaultProvider 
)

Function returns data access object.

Parameters
$Options- Execution parameters.
$DefaultProvider- Default data access object.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 464 of file context_set_utilities.php.

{
try
{
if( $Options->get_setting( 'access_package_name' , false ) )
{
$PackageName = $Options->get_setting( 'access_package_name' );
$PackageVersion = $Options->get_setting( 'access_package_version' , 'last' );
return( get_package( $PackageName , $PackageVersion , __FILE__ ) );
}
else
{
return( $DefaultProvider );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_data_record ( $Options,
  $IdList 
)

Function returns superposition of the records.

Parameters
$Options- Execution parameters.
$IdList- List of identificators.
Returns
Object.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 349 of file context_set_utilities.php.

{
try
{
$Records = $this->get_original_records( $Options , $IdList );
$Record = $Records[ 0 ];
if( intval( $Options->get_setting( 'massive_processing' , 1 ) ) )
{
$c = count( $Records );
for( $i = 1 ; $i < $c ; $i++ )
{
foreach( $Records[ $i ] as $k => $v )
{
if( get_field( $Record , $k ) !== $v )
{
set_field( $Record , $k , false );
}
}
}
}
return( $Record );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_form ( $Options,
  $IdList,
  $FormFileName,
  $Prefix,
  $State 
)

Function returns form's template.

Parameters
$Options- Execution parameters.
$IdList- Ids of the processing records.
$FormFileName- Form template file.
$Prefix- Entity prefix.
$State- Стейт.
Returns
Form's code.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 777 of file context_set_utilities.php.

{
try
{
$FormFileName = $Options->get_setting( 'form_template' , $FormFileName );
$FormFilePath = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$FormFileName.tpl";
$Form = $this->CachedMultyFS->file_get_contents( $FormFilePath );
$Form = str_replace( '{prefix}' , $Prefix , $Form );
$Form = str_replace( '{state}' , $State , $Form );
$Form = str_replace( '{ids}' , implode( ',' , $IdList ) , $Form );
return( $Form );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_original_records ( $Options,
  $IdList 
)

Function returns records from the DB.

Parameters
$Options- Execution parameters.
$IdList- List of identificators.
Returns
Object.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 301 of file context_set_utilities.php.

{
try
{
$Provider = $this->get_data_provider( $Options , $this->Provider );
if( method_exists( $Provider , 'select_list' ) === false )
{
$ClassName = $Provider ? get_class( $Provider ) : 'undefined_class';
throw( new Exception( 'Method "select_list" was not found in the class "'.$ClassName."'" ) );
}
$Records = call_user_func( array( $Provider , 'select_list' ) , implode( ',' , $IdList ) );
return( $Records );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_posted_ids (   $Prefix)

Function returns id's of the selected records.

Parameters
$Prefix- Entity prefix.
Returns
Identificators of the selected records.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 508 of file context_set_utilities.php.

{
try
{
if( $this->Security->get_gp( $Prefix.'_record_id' , 'command' , false ) !== false &&
$this->Security->get_gp( $Prefix.'_record_id' , 'command' ) != -1 )
{
$Ids = array( $this->Security->get_gp( $Prefix.'_record_id' , 'command' ) );
}
else
{
$Mode = POST | PREFIX_NAME | KEYS;
$Ids = $this->SecurityUtilities->get_global( '_id_' , 'string' , $Mode , array() );
}
return( $Ids );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_footer_template (   $Options,
$Paging,
  $Prefix 
)

Function inits grid template.

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

Definition at line 223 of file context_set_utilities.php.

{
try
{
$FileName = $Options->get_setting( 'footer' , $Prefix.'_footer.tpl' );
$Path = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$FileName";
$Footer = $this->CachedMultyFS->file_get_contents( $Path );
$Paging->set( 'Footer' , $Footer );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_form_data (   $Form,
  $Data 
)

Function sets data in the form.

Parameters
$Form- Form's code.
$Data- Record with processing data.
Returns
Form's code.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 613 of file context_set_utilities.php.

{
try
{
for( ; $Parameters = $this->String->get_macro_parameters( $Form , 'form_value' ) ; )
{
$this->BlockSettings->load_settings( $Parameters );
$FormValue = $this->get_form_value( $this->BlockSettings , $Data );
$Form = str_replace( "{form_value:$Parameters}" , $FormValue , $Form );
}
$Form = $this->String->print_record( $Form , $Data );
foreach( $Data as $k => $v )
{
if( is_array( $v ) === false && is_object( $v ) === false )
{
$Form = str_replace( '{'.$k.'_original}' , $v , $Form );
}
}
return( $Form );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_grid_data (   $Options,
$Paging,
  $QueryString = '1 = 1' 
)

Function inits grid's data.

Parameters
$Options- Execution parameters.
$Paging- Grid object.
$QueryString- Query string.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 716 of file context_set_utilities.php.

{
try
{
$this->set_data_accessor( $Options , $Paging , $QueryString );
if( $Options->get_setting( 'draw_package_name' , false ) )
{
$DrawPackageName = $Options->get_setting( 'draw_package_name' );
$DrawPackageVersion = $Options->get_setting( 'draw_package_version' , 'last' );
$DrawFunction = $Options->get_setting( 'draw_func' , 'select' );
$Paging->set( 'CallbackFunc' , create_function( '$Template , $Record' ,
"\$Object = get_package( '$DrawPackageName' , '$DrawPackageVersion' , __FILE__ );
return( \$Object->$DrawFunction( \$Template , \$Record ) );" ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_header_template (   $Options,
$Paging,
  $Prefix 
)

Function inits grid template.

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

Definition at line 102 of file context_set_utilities.php.

{
try
{
$FileName = $Options->get_setting( 'header' , $Prefix.'_header.tpl' );
$Path = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$FileName";
$Header = $this->CachedMultyFS->file_get_contents( $Path );
$Paging->set( 'Header' , $Header );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_item_template (   $Options,
$Paging,
  $Prefix 
)

Function inits grid template.

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

Definition at line 140 of file context_set_utilities.php.

{
try
{
$FileName = $Options->get_setting( 'item' , $Prefix.'_item.tpl' );
$Path = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$FileName";
$Item = $this->CachedMultyFS->file_get_contents( $Path );
$Paging->set( 'ItemTemplate' , $Item );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_main_settings (   $Options,
$Paging 
)

Function inits grid's main settings.

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

Definition at line 261 of file context_set_utilities.php.

{
try
{
$Paging->set( 'RecordsPerPage' , $Options->get_setting( 'records_per_page' , 20 ) );
$Paging->set( 'PageField' , $Options->get_setting( 'page_field' , 'page' ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_no_data_found_message (   $Options,
$Paging 
)

Function inits grid.

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

Definition at line 178 of file context_set_utilities.php.

{
try
{
if( $FileName = $Options->get_setting( 'no_data_found_message' , false ) )
{
$Path = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$FileName";
}
else
{
$Path = dirname( __FILE__ )."/res/templates/default_no_data_found_message.tpl";
}
$NoDataFoundTemplate = $this->CachedMultyFS->file_get_contents( $Path );
$Paging->set( 'NoDataFoundMessage' , $NoDataFoundTemplate );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$BlockSettings = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file context_set_utilities.php.

$CachedMultyFS = false

Definition at line 39 of file context_set_utilities.php.

$PageComposer = false

Definition at line 40 of file context_set_utilities.php.

$Security = false

Definition at line 41 of file context_set_utilities.php.

$SecurityParser = false

Definition at line 42 of file context_set_utilities.php.

$SecurityUtilities = false

Definition at line 43 of file context_set_utilities.php.

$String = false

Definition at line 44 of file context_set_utilities.php.

$Trace = false

Definition at line 45 of file context_set_utilities.php.


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