ultimix
default_views_1_0_0 Class Reference

Public Member Functions

 __construct ()
 set_constants (&$ContextSet, &$Options)
 list_form (&$Options)
 create_form (&$Options)
 update_form (&$Options)
 copy_form (&$Options)
 get_grid_templates (&$Options)
 last_records_form (&$Options)
 get_select_condition (&$Options)
 dependent_records_form (&$Options)
 record_view_form (&$Options)
 simple_form (&$Options)
 list_view (&$Options)

Data Fields

 $AutoMarkup = false
 $CachedMultyFS = false
 $ContextSetUtilities = false
 $DefaultViewsUtilities = false
 $Security = false
 $String = false
 $UserAlgorithms = false
 $Prefix = false
 $Provider = false
 $ContextSet = false

Detailed Description

Class of the default views.

Author
Dodonov A.A.

Definition at line 26 of file default_views.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

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

Definition at line 96 of file default_views.php.

{
try
{
$this->AutoMarkup = get_package( 'page::auto_markup' , 'last' , __FILE__ );
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->ContextSetUtilities = get_package(
'gui::context_set::context_set_utilities' , 'last' , __FILE__
);
$this->DefaultViewsUtilities = get_package(
'gui::context_set::default_views::default_views_utilities' , 'last' , __FILE__
);
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->String = get_package( 'string' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

copy_form ( $Options)

Function draws record copy form.

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

Definition at line 356 of file default_views.php.

{
try
{
$Form = $this->get_copy_form( $Options );
$this->Provider->Output = $this->ContextSetUtilities->set_form_data( $Form , $Record );
$this->DefaultViewsUtilities->compile_form( $Options , $this->Provider->Output );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
create_form ( $Options)

Function draws record creation form.

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

Definition at line 213 of file default_views.php.

{
try
{
if( $Options->get_setting( 'default_form' , 1 ) == 0 )
{
call_user_func( array( $this->Provider , 'create_form' ) , $Options );
}
else
{
$this->Provider->Output = $this->ContextSetUtilities->get_form(
$Options , array() , 'create_form' , $this->Prefix , 'create_record'
);
}
$this->Provider->Output = $this->DefaultViewsUtilities->apply_posted_data_for_create_form(
$Options , $this->Provider->Output
);
$this->DefaultViewsUtilities->compile_form( $Options , $this->Provider->Output );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
dependent_records_form ( $Options)

Function draws dependent records form.

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

Definition at line 527 of file default_views.php.

{
try
{
$DataProvider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
$FunctionName = $Options->get_setting( 'select_func' , 'select' );
$Condition = $this->get_select_condition( $Options );
$Records = call_user_func(
array( $DataProvider , $FunctionName ) , false , false , false , false , $Condition
);
list( $Header , $Item , $Footer ) = $this->get_grid_templates( $Options );
$Items = '';
foreach( $Records as $i => $Record )
{
$Items .= $this->String->print_record( $Item , $Record );
}
$this->Provider->Output = $Header.$Items.$Footer;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_grid_templates ( $Options)

Function returns templates.

Parameters
$Options- Execution parameters.
Returns
array( $Header , $Item , $Footer )
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 394 of file default_views.php.

{
try
{
$Header = $this->DefaultViewsUtilities->get_template( $Options , 'header' );
$Item = $Options->get_setting( 'item' );
$Item = dirname( $Options->get_setting( 'file_path' ) )."/res/templates/$Item.tpl";
$Item = $this->CachedMultyFS->file_get_contents( $Item );
$Footer = $this->DefaultViewsUtilities->get_template( $Options , 'footer' );
return( array( $Header , $Item , $Footer ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_select_condition ( $Options)

Function compiles record selection condition.

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

Definition at line 483 of file default_views.php.

{
try
{
$MasterType = $Options->get_setting( 'master_type' , 'user' );
if( $MasterType == 'user' && $MasterId == false )
{
if( $this->UserAlgorithms === false )
{
$this->UserAlgorithms = get_package( 'user::user_algorithms' , 'last' , __FILE__ );
}
return( "owner = ".$this->UserAlgorithms->get_id() );
}
else
{
throw( new Exception( "Illegal parameters of dependent records detection" ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
last_records_form ( $Options)

Function draws last records form.

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

Definition at line 432 of file default_views.php.

{
try
{
$DataProvider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
$FunctionName = $Options->get_setting( 'select_func' , 'select' );
$Limit = $Options->get_setting( 'records_count' , 3 );
$Records = call_user_func( array( $DataProvider , $FunctionName ) , 0 , $Limit , 'id' , 'DESC' );
list( $Header , $Item , $Footer ) = $this->get_grid_templates( $Options );
$Items = '';
foreach( $Records as $i => $Record )
{
$Items .= $this->String->print_record( $Item , $Record );
}
$this->Provider->Output = $Header.$Items.$Footer;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
list_form ( $Options)

Function draws list of records.

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

Definition at line 173 of file default_views.php.

{
try
{
$Paging = get_package( 'gui::paging' , 'last' , __FILE__ );
$this->DefaultViewsUtilities->construct_paging( $Options , $Paging );
$this->Provider->Output = $Paging->draw( false , $Options );
$this->Provider->Output = $this->DefaultViewsUtilities->compile_form(
$Options , $this->Provider->Output
);
$this->Provider->Output = $this->AutoMarkup->compile_string( $this->Provider->Output );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
list_view ( $Options)

Method draws custom record list.

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

Definition at line 735 of file default_views.php.

{
try
{
$Paging = get_package( 'gui::paging' , 'last' , __FILE__ );
$Paging->set( 'FormId' , $this->Prefix.'_form' );
$Paging->set( 'Prefix' , $this->Prefix );
$this->set_list_view_parts( $Options , $Paging );
$Str = $Paging->draw( false , $Options );
$Str = $this->ContextSet->compile_special_macro( $Options , $Str , $Changed );
list( $this->Provider->Output , $Changed ) = $this->ContextSet->compile_prefix( $Str , $Changed );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
record_view_form ( $Options)

Method draws record.

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

Definition at line 576 of file default_views.php.

{
try
{
$TemplateName = $Options->get_setting( 'form_template' , $this->ContextSet->Prefix.'_view_form.tpl' );
$ComponentPath = dirname( $Options->get_setting( 'file_path' ) ).'/unexisting_script';
$Template = $this->CachedMultyFS->get_template( $ComponentPath , $TemplateName );
$Provider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
$id = $this->Security->get_gp( $this->Prefix.'_record_id' , 'integer' );
$Records = call_user_func( array( $Provider , 'select_list' ) , $id );
$Template = $this->String->print_record( $Template , $Records[ 0 ] );
$this->Provider->Output = $Template;
}
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 139 of file default_views.php.

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

Method draws record editing form.

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

Definition at line 616 of file default_views.php.

{
try
{
$FormTemplateFileName = $Options->get_setting( 'form_template' );
$FilePath = $Options->get_setting( 'file_path' );
$Form = $this->CachedMultyFS->get_template( $FilePath , "$FormTemplateFileName.tpl" );
$Changed = false;
$Form = $this->ContextSet->compile_special_macro( $Options , $Form , $Changed );
list( $Form , $Changed ) = $this->ContextSet->compile_prefix( $Form , $Changed );
$this->Provider->Output = $Form;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
update_form ( $Options)

Function draws record update form.

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

Definition at line 258 of file default_views.php.

{
try
{
$IdList = $this->ContextSetUtilities->get_posted_ids( $this->Prefix );
if( $Options->get_setting( 'default_form' , 1 ) == 0 )
{
call_user_func( array( $this->Provider , 'update_form' ) , $Options );
}
else
{
$this->Provider->Output = $this->ContextSetUtilities->get_form(
$Options , $IdList , 'update_form' , $this->Prefix , 'update_record'
);
}
$this->Provider->Output = $this->DefaultViewsUtilities->compile_form(
$Options , $this->Provider->Output , $IdList
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$AutoMarkup = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file default_views.php.

$CachedMultyFS = false

Definition at line 39 of file default_views.php.

$ContextSet = false

Set of contexts.

Author
Dodonov A.A.

Definition at line 80 of file default_views.php.

$ContextSetUtilities = false

Definition at line 40 of file default_views.php.

$DefaultViewsUtilities = false

Definition at line 41 of file default_views.php.

$Prefix = false

Prefix.

Author
Dodonov A.A.

Definition at line 56 of file default_views.php.

$Provider = false

Object of the class wich provides all handlers.

Author
Dodonov A.A.

Definition at line 68 of file default_views.php.

$Security = false

Definition at line 42 of file default_views.php.

$String = false

Definition at line 43 of file default_views.php.

$UserAlgorithms = false

Definition at line 44 of file default_views.php.


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