100 $this->AutoMarkup =
get_package(
'page::auto_markup' ,
'last' , __FILE__ );
101 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
103 'gui::context_set::context_set_utilities' ,
'last' , __FILE__
106 'gui::context_set::default_views::default_views_utilities' ,
'last' , __FILE__
108 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
109 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
111 catch( Exception $e )
147 $this->DefaultViewsUtilities->set_constants(
$ContextSet , $Options );
149 catch( Exception $e )
177 $Paging =
get_package(
'gui::paging' ,
'last' , __FILE__ );
179 $this->DefaultViewsUtilities->construct_paging( $Options , $Paging );
181 $this->Provider->Output = $Paging->draw(
false , $Options );
183 $this->Provider->Output = $this->DefaultViewsUtilities->compile_form(
184 $Options , $this->Provider->Output
187 $this->Provider->Output = $this->AutoMarkup->compile_string( $this->Provider->Output );
189 catch( Exception $e )
217 if( $Options->get_setting(
'default_form' , 1 ) == 0 )
219 call_user_func( array( $this->Provider ,
'create_form' ) , $Options );
223 $this->Provider->Output = $this->ContextSetUtilities->get_form(
224 $Options , array() ,
'create_form' , $this->Prefix ,
'create_record'
228 $this->Provider->Output = $this->DefaultViewsUtilities->apply_posted_data_for_create_form(
229 $Options , $this->Provider->Output
232 $this->DefaultViewsUtilities->compile_form( $Options , $this->Provider->Output );
234 catch( Exception $e )
262 $IdList = $this->ContextSetUtilities->get_posted_ids( $this->Prefix );
264 if( $Options->get_setting(
'default_form' , 1 ) == 0 )
266 call_user_func( array( $this->Provider ,
'update_form' ) , $Options );
270 $this->Provider->Output = $this->ContextSetUtilities->get_form(
271 $Options , $IdList ,
'update_form' , $this->Prefix ,
'update_record'
275 $this->Provider->Output = $this->DefaultViewsUtilities->compile_form(
276 $Options , $this->Provider->Output , $IdList
279 catch( Exception $e )
307 private function get_copy_form( &$Options )
311 if( $this->Security->get_gp( $this->Prefix.
'_action' ,
'command' ,
'' ) !==
'' )
313 $Record = $IdList = array();
317 $IdList = $this->ContextSetUtilities->get_posted_ids( $this->Prefix );
319 $Record = $this->ContextSetUtilities->get_data_record( $Options , $IdList );
322 $Record = $this->ContextSetUtilities->extract_data_from_request(
323 $Options , $Record ,
'get_post_extraction_script' , $this->Prefix
326 $Form = $this->ContextSetUtilities->get_form(
327 $Options , $IdList ,
'copy_form' , $this->Prefix ,
'create_record'
332 catch( Exception $e )
360 $Form = $this->get_copy_form( $Options );
362 $this->Provider->Output = $this->ContextSetUtilities->set_form_data( $Form , $Record );
364 $this->DefaultViewsUtilities->compile_form( $Options , $this->Provider->Output );
366 catch( Exception $e )
398 $Header = $this->DefaultViewsUtilities->get_template( $Options ,
'header' );
400 $Item = $Options->get_setting(
'item' );
401 $Item = dirname( $Options->get_setting(
'file_path' ) ).
"/res/templates/$Item.tpl";
402 $Item = $this->CachedMultyFS->file_get_contents( $Item );
404 $Footer = $this->DefaultViewsUtilities->get_template( $Options ,
'footer' );
406 return( array( $Header , $Item , $Footer ) );
408 catch( Exception $e )
436 $DataProvider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
438 $FunctionName = $Options->get_setting(
'select_func' ,
'select' );
440 $Limit = $Options->get_setting(
'records_count' , 3 );
442 $Records = call_user_func( array( $DataProvider , $FunctionName ) , 0 , $Limit ,
'id' ,
'DESC' );
448 foreach( $Records as $i => $Record )
450 $Items .= $this->String->print_record( $Item , $Record );
453 $this->Provider->Output = $Header.$Items.$Footer;
455 catch( Exception $e )
487 $MasterType = $Options->get_setting(
'master_type' ,
'user' );
489 if( $MasterType ==
'user' && $MasterId ==
false )
491 if( $this->UserAlgorithms ===
false )
493 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
496 return(
"owner = ".$this->UserAlgorithms->get_id() );
500 throw(
new Exception(
"Illegal parameters of dependent records detection" ) );
503 catch( Exception $e )
531 $DataProvider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
533 $FunctionName = $Options->get_setting(
'select_func' ,
'select' );
537 $Records = call_user_func(
538 array( $DataProvider , $FunctionName ) ,
false ,
false ,
false ,
false , $Condition
545 foreach( $Records as $i => $Record )
547 $Items .= $this->String->print_record( $Item , $Record );
550 $this->Provider->Output = $Header.$Items.$Footer;
552 catch( Exception $e )
580 $TemplateName = $Options->get_setting(
'form_template' , $this->ContextSet->Prefix.
'_view_form.tpl' );
581 $ComponentPath = dirname( $Options->get_setting(
'file_path' ) ).
'/unexisting_script';
582 $Template = $this->CachedMultyFS->get_template( $ComponentPath , $TemplateName );
584 $Provider = $this->ContextSetUtilities->get_data_provider( $Options , $this->Provider );
586 $id = $this->Security->get_gp( $this->Prefix.
'_record_id' ,
'integer' );
587 $Records = call_user_func( array(
$Provider ,
'select_list' ) , $id );
589 $Template = $this->String->print_record( $Template , $Records[ 0 ] );
590 $this->Provider->Output = $Template;
592 catch( Exception $e )
620 $FormTemplateFileName = $Options->get_setting(
'form_template' );
621 $FilePath = $Options->get_setting(
'file_path' );
623 $Form = $this->CachedMultyFS->get_template( $FilePath ,
"$FormTemplateFileName.tpl" );
627 $Form = $this->ContextSet->compile_special_macro( $Options , $Form , $Changed );
629 list( $Form , $Changed ) = $this->ContextSet->compile_prefix( $Form , $Changed );
631 $this->Provider->Output = $Form;
633 catch( Exception $e )
661 private function set_list_view_custom_buttons( &$Options , $Paging )
666 '<input type="hidden" name="{prefix}_context_action" id="{prefix}_context_action" value="">
667 <input type="hidden" name="{prefix}_action" id="{prefix}_action" value="">
668 <input type="hidden" name="{prefix}_record_id" id="{prefix}_record_id" value="">';
669 $Paging->set(
'CustomButtons' , $HeaderFields );
671 catch( Exception $e )
699 private function set_list_view_parts( &$Options , $Paging )
703 $this->set_list_view_custom_buttons( $Options , $Paging );
704 $this->ContextSetUtilities->set_header_template( $Options , $Paging , $this->Prefix );
705 $this->ContextSetUtilities->set_item_template( $Options , $Paging , $this->Prefix );
706 $this->ContextSetUtilities->set_no_data_found_message( $Options , $Paging , $this->Prefix );
707 $this->ContextSetUtilities->set_footer_template( $Options , $Paging , $this->Prefix );
708 $this->ContextSetUtilities->set_main_settings( $Options , $Paging );
709 $this->ContextSetUtilities->set_grid_data( $Options , $Paging );
711 catch( Exception $e )
739 $Paging =
get_package(
'gui::paging' ,
'last' , __FILE__ );
740 $Paging->set(
'FormId' , $this->Prefix.
'_form' );
741 $Paging->set(
'Prefix' , $this->Prefix );
743 $this->set_list_view_parts( $Options , $Paging );
745 $Str = $Paging->draw(
false , $Options );
747 $Str = $this->ContextSet->compile_special_macro( $Options , $Str , $Changed );
748 list( $this->Provider->Output , $Changed ) = $this->ContextSet->compile_prefix( $Str , $Changed );
750 catch( Exception $e )