ultimix
default_controllers_1_0_0 Class Reference

Public Member Functions

 __construct ()
 set_constants (&$ContextSet, &$Options)
 delete (&$Options)
 multy_call (&$Options)
 create (&$Options)
 get_update_record (&$Options, $Ids, $RecordOriginal)
 update (&$Options)
 copy (&$Options)

Data Fields

 $ContextSetUtilities = false
 $GUI = false
 $SecurityParser = false
 $Prefix = false
 $Provider = false

Detailed Description

Class of the default controllers.

Author
Dodonov A.A.

Definition at line 26 of file default_controllers.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

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

Definition at line 80 of file default_controllers.php.

{
try
{
$this->ContextSetUtilities = get_package(
'gui::context_set::context_set_utilities' , 'last' , __FILE__
);
$this->GUI = get_package( 'gui' , 'last' , __FILE__ );
$this->SecurityParser = get_package( 'security::security_parser' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

copy ( $Options)

Function copies record.

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

Definition at line 508 of file default_controllers.php.

{
try
{
$Options->set_setting( 'create_func' , $Options->get_setting( 'copy_func' ) );
$this->create( $Options );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
create ( $Options)

Function creates record.

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

Definition at line 276 of file default_controllers.php.

{
try
{
list( $Record , $FunctionName , $Provider ) = $this->get_creation_data( $Options );
if( method_exists( $Provider , $FunctionName ) === true )
{
$id = call_user_func( array( $Provider , $FunctionName ) , $Record , $Options );
$this->GUI->set_var( 'record_id' , $id );
}
else
{
$ClassName = $Provider ? get_class( $Provider ) : 'undefined_class';
throw( new Exception( "Method \"$FunctionName\" was not found in the class \"$ClassName.\"" ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
delete ( $Options)

Function deletes record.

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

Definition at line 149 of file default_controllers.php.

{
try
{
$Provider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
$FunctionName = $Options->get_setting( 'delete_func' , 'delete' );
$Ids = $this->ContextSetUtilities->get_posted_ids( $this->Prefix );
if( method_exists( $Provider , $FunctionName ) === true )
{
call_user_func( array( $Provider , $FunctionName ) , implode( ',' , $Ids ) , $Options );
}
else
{
$ClassName = $Provider ? get_class( $Provider ) : 'undefined_class';
throw( new Exception( "Method \"$FunctionName\" was not found in the class \"$ClassName.\"" ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_update_record ( $Options,
  $Ids,
  $RecordOriginal 
)

Function returns records to update.

Parameters
$Options- Execution parameters.
$Ids- Ids of the updating records.
$RecordOriginal- Original record.
Returns
Updating records.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 379 of file default_controllers.php.

{
try
{
$GetPostValidation = $Options->get_setting( 'get_post_validation' , false );
$ValidationScript = $Options->get_setting( 'custom_get_post_validation' , $GetPostValidation );
if( $ValidationScript === false )
{
throw( new Exception( 'There is no script to extract data from http headers' ) );
}
$RecordNew = $this->SecurityParser->parse_http_parameters( $ValidationScript );
return( $this->compile_update_record( $RecordNew , $RecordOriginal ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
multy_call ( $Options)

Function for massive processing.

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

Definition at line 191 of file default_controllers.php.

{
try
{
$Ids = $this->ContextSetUtilities->get_posted_ids( $this->Prefix );
$Provider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
if( $Options->get_setting( 'id_list_accept' , 1 ) == '1' )
{
call_user_func(
array( $Provider , $Options->get_setting( 'func_name' ) ) , implode( $Ids ) , $Options
);
}
else
{
foreach( $Ids as $id )
{
call_user_func( array( $Provider , $Options->get_setting( 'func_name' ) ) , $id , $Options );
}
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set_constants ( $ContextSet,
$Options 
)

Function sets all necessary parameters.

Parameters
$ContextSet- Set of contexts.
$Options- Execution parameters.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 118 of file default_controllers.php.

{
try
{
$this->Prefix = $ContextSet->Prefix;
$this->Provider = $ContextSet->Provider;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
update ( $Options)

Function updates records.

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

Definition at line 461 of file default_controllers.php.

{
try
{
list( $Ids , $UpdateRecord ) = $this->get_update_data( $Options );
$Provider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
$FunctionName = $Options->get_setting( 'update_func' , 'update' );
if( method_exists( $Provider , $FunctionName ) === true )
{
$Func = array( $Provider , $FunctionName );
call_user_func( $Func , implode( ',' , $Ids ) , $UpdateRecord , $Options );
}
else
{
$ClassName = $Provider ? get_class( $Provider ) : 'undefined_class';
throw( new Exception( "Method \"$FunctionName\" was not found in the class \"$ClassName.\"" ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$ContextSetUtilities = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file default_controllers.php.

$GUI = false

Definition at line 39 of file default_controllers.php.

$Prefix = false

Prefix.

Author
Dodonov A.A.

Definition at line 52 of file default_controllers.php.

$Provider = false

Object of the class wich provides all handlers.

Author
Dodonov A.A.

Definition at line 64 of file default_controllers.php.

$SecurityParser = false

Definition at line 40 of file default_controllers.php.


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