66 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
67 $this->PageComposer =
get_package(
'page::page_composer' ,
'last' , __FILE__ );
68 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
69 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
70 $this->SecurityUtilities =
get_package(
'security::security_utilities' ,
'last' , __FILE__ );
71 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
72 $this->Trace =
get_package(
'trace' ,
'last' , __FILE__ );
106 $FileName = $Options->get_setting(
'header' , $Prefix.
'_header.tpl' );
107 $Path = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$FileName";
108 $Header = $this->CachedMultyFS->file_get_contents( $Path );
110 $Paging->set(
'Header' , $Header );
112 catch( Exception $e )
144 $FileName = $Options->get_setting(
'item' , $Prefix.
'_item.tpl' );
145 $Path = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$FileName";
146 $Item = $this->CachedMultyFS->file_get_contents( $Path );
148 $Paging->set(
'ItemTemplate' , $Item );
150 catch( Exception $e )
182 if( $FileName = $Options->get_setting(
'no_data_found_message' ,
false ) )
184 $Path = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$FileName";
188 $Path = dirname( __FILE__ ).
"/res/templates/default_no_data_found_message.tpl";
191 $NoDataFoundTemplate = $this->CachedMultyFS->file_get_contents( $Path );
193 $Paging->set(
'NoDataFoundMessage' , $NoDataFoundTemplate );
195 catch( Exception $e )
227 $FileName = $Options->get_setting(
'footer' , $Prefix.
'_footer.tpl' );
228 $Path = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$FileName";
229 $Footer = $this->CachedMultyFS->file_get_contents( $Path );
231 $Paging->set(
'Footer' , $Footer );
233 catch( Exception $e )
265 $Paging->set(
'RecordsPerPage' , $Options->get_setting(
'records_per_page' , 20 ) );
267 $Paging->set(
'PageField' , $Options->get_setting(
'page_field' ,
'page' ) );
269 catch( Exception $e )
307 if( method_exists( $Provider ,
'select_list' ) ===
false )
309 $ClassName = $Provider ? get_class( $Provider ) :
'undefined_class';
310 throw(
new Exception(
'Method "select_list" was not found in the class "'.$ClassName.
"'" ) );
313 $Records = call_user_func( array( $Provider ,
'select_list' ) , implode(
',' , $IdList ) );
317 catch( Exception $e )
355 $Record = $Records[ 0 ];
357 if( intval( $Options->get_setting(
'massive_processing' , 1 ) ) )
359 $c = count( $Records );
360 for( $i = 1 ; $i < $c ; $i++ )
362 foreach( $Records[ $i ] as $k => $v )
374 catch( Exception $e )
418 if( $Options->get_setting( $SettingName ,
false ) )
420 $Parameter = $Options->get_setting( $SettingName );
421 $PostedRecord = $this->SecurityParser->parse_http_parameters( $Parameter );
423 foreach( $PostedRecord as $k => $v )
425 $k = str_replace( $Prefix.
'_' ,
'' , $k );
436 catch( Exception $e )
468 if( $Options->get_setting(
'access_package_name' ,
false ) )
470 $PackageName = $Options->get_setting(
'access_package_name' );
471 $PackageVersion = $Options->get_setting(
'access_package_version' ,
'last' );
473 return(
get_package( $PackageName , $PackageVersion , __FILE__ ) );
477 return( $DefaultProvider );
480 catch( Exception $e )
512 if( $this->Security->get_gp( $Prefix.
'_record_id' ,
'command' ,
false ) !==
false &&
513 $this->Security->get_gp( $Prefix.
'_record_id' ,
'command' ) != -1 )
515 $Ids = array( $this->Security->get_gp( $Prefix.
'_record_id' ,
'command' ) );
520 $Ids = $this->SecurityUtilities->get_global(
'_id_' ,
'string' , $Mode , array() );
525 catch( Exception $e )
557 private function get_form_value( &$Settings , $Data )
561 $Name = $Settings->get_setting(
'name' );
562 $Type = $Settings->get_setting(
'type' ,
'string' );
564 if( $this->Security->get_gp( $Name ,
'set' ) )
566 $Value = $this->Security->get_gp( $Name , $Type );
570 $Value =
get_field( $Data , $Name ,
'' );
573 if( is_array( $Value ) )
575 $Value = serialize( $Value );
576 $Value = $this->Security->get( $Value ,
'string' );
581 catch( Exception $e )
617 for( ; $Parameters = $this->String->get_macro_parameters( $Form ,
'form_value' ) ; )
619 $this->BlockSettings->load_settings( $Parameters );
620 $FormValue = $this->get_form_value( $this->BlockSettings , $Data );
621 $Form = str_replace(
"{form_value:$Parameters}" , $FormValue , $Form );
624 $Form = $this->String->print_record( $Form , $Data );
625 foreach( $Data as $k => $v )
627 if( is_array( $v ) ===
false && is_object( $v ) ===
false )
629 $Form = str_replace(
'{'.$k.
'_original}' , $v , $Form );
635 catch( Exception $e )
667 private function set_data_accessor( $Options , &$Paging , $QueryString =
'1 = 1' )
671 $PackageName = $Options->get_setting(
'access_package_name' );
672 $PackageVersion = $Options->get_setting(
'access_package_version' ,
'last' );
673 $Method = $Options->get_setting(
'select_func' ,
'select' );
675 $this->Trace->add_trace_string(
676 "{lang:data_accessor} : $PackageName.$PackageVersion->$Method" , COMMON
679 $Paging->set(
'DataAccessor' , create_function(
'$Start , $Limit , $Field , $Order , $Options' ,
680 "\$Object = get_package( '$PackageName' , '$PackageVersion' , __FILE__ );
681 return( \$Object->$Method( \$Start , \$Limit , \$Field , \$Order ,
682 \"$QueryString\" , \$Options ) );" ) );
684 catch( Exception $e )
720 $this->set_data_accessor( $Options , $Paging , $QueryString );
722 if( $Options->get_setting(
'draw_package_name' ,
false ) )
724 $DrawPackageName = $Options->get_setting(
'draw_package_name' );
725 $DrawPackageVersion = $Options->get_setting(
'draw_package_version' ,
'last' );
726 $DrawFunction = $Options->get_setting(
'draw_func' ,
'select' );
728 $Paging->set(
'CallbackFunc' , create_function(
'$Template , $Record' ,
729 "\$Object = get_package( '$DrawPackageName' , '$DrawPackageVersion' , __FILE__ );
730 return( \$Object->$DrawFunction( \$Template , \$Record ) );" ) );
733 catch( Exception $e )
777 function get_form( &$Options , $IdList , $FormFileName , $Prefix , $State )
781 $FormFileName = $Options->get_setting(
'form_template' , $FormFileName );
782 $FormFilePath = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$FormFileName.tpl";
783 $Form = $this->CachedMultyFS->file_get_contents( $FormFilePath );
784 $Form = str_replace(
'{prefix}' , $Prefix , $Form );
785 $Form = str_replace(
'{state}' , $State , $Form );
786 $Form = str_replace(
'{ids}' , implode(
',' , $IdList ) , $Form );
790 catch( Exception $e )