71 $this->Cache =
get_package(
'cache' ,
'last' , __FILE__ );
72 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
73 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
74 $this->Settings =
get_package(
'settings::package_settings' ,
'last' , __FILE__ );
75 $this->PageAccess =
get_package(
'page::page_access' ,
'last' , __FILE__ );
76 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
110 foreach( $Items as $i => $v )
112 if( $v->page == $v->root_page )
120 catch( Exception $e )
156 foreach( $Items as $i => $v )
158 if( $v->page == $MainItem->root_page )
166 catch( Exception $e )
202 foreach( $Items as $i => $v )
204 if( $v->page == $Page )
212 catch( Exception $e )
254 foreach( $Items as $i )
256 if( $i->root_page == $RootItem->page && $i->root_page != $i->page )
258 if( $MapPart ===
'' )
260 $MapPart .= $this->CachedMultyFS->get_template( __FILE__ ,
'map_start.tpl' );
266 if( $MapPart !==
'' )
268 $MapPart .= $this->CachedMultyFS->get_template( __FILE__ ,
'map_end.tpl' );
273 catch( Exception $e )
311 $PageDescription = $this->PageAccess->get_page_description( $RootItem->page );
313 $Map .= $this->CachedMultyFS->get_template( __FILE__ ,
'map_item_start.tpl' ).
314 ( strlen( $RootItem->navigation ) ? $RootItem->navigation :
315 '{href:tpl=std;page=./'.$RootItem->page.
'.html;raw_text='.$PageDescription[
'title' ].
'}' );
319 $Map .= $this->CachedMultyFS->get_template( __FILE__ ,
'map_item_end.tpl' );
323 catch( Exception $e )
355 $Data = $this->Cache->get_data(
'full_map' );
356 if( $Data ===
false )
358 $Access =
get_package(
'system_structure::system_structure_access' ,
'last' , __FILE__ );
360 $Items = $Access->unsafe_select();
363 $Map = $this->CachedMultyFS->get_template( __FILE__ ,
'map_start.tpl' );
365 $Map .= $this->CachedMultyFS->get_template( __FILE__ ,
'map_end.tpl' );
367 $this->Cache->add_data(
'full_map' , $Map );
369 $this->Output = $Map;
373 $this->Output = $Data;
376 catch( Exception $e )
400 private function get_separator()
404 $Separator = $this->Settings->get_package_setting(
405 'system_structure::system_structure_view' ,
'last' ,
'cf_system_structure' ,
406 'bread_crumbs_separator' ,
' > '
409 return( $Separator );
411 catch( Exception $e )
447 private function compile_item_loop( $Str , $MainItem , $Items )
452 $Separator = $this->get_separator();
454 while( $MainItem !==
false && $MainItem->page != $MainItem->root_page )
456 $Str = $Separator.$Str;
457 $MainItem = $this->
get_item( $MainItem->root_page , $Items );
458 $PageDescription = $this->PageAccess->get_page_description( $MainItem->page );
460 strlen( $MainItem->navigation ) != 0 ? $MainItem->navigation :
'{href:tpl=std;page=./'.
461 $MainItem->page.
'.html;raw_text='.$PageDescription[
'title' ].
'}'
466 return( array( $Str , $Counter ) );
468 catch( Exception $e )
504 private function compile_items( &$Options , $MainItem , $Items )
508 $PageDescription = $this->PageAccess->get_page_description( $MainItem->page );
509 $Str = strlen( $MainItem->navigation ) != 0 ? $MainItem->navigation :
'{href:tpl=std;page=./'.
510 $MainItem->page.
'.html;raw_text='.$PageDescription[
'title' ].
'}';
512 list( $Str , $Counter ) = $this->compile_item_loop( $Str , $MainItem , $Items );
514 if( $Options->get_setting(
'show_on_root_page' ,
false ) == false )
524 catch( Exception $e )
552 private function compile_bread_crumbs( &$Options )
556 $PageName = $this->Security->get_g(
'page_name' ,
'command' );
557 $Access =
get_package(
'system_structure::system_structure_access' ,
'last' , __FILE__ );
558 $Items = $Access->unsafe_select();
559 $MainItem = $this->
get_item( $PageName , $Items );
561 if( $MainItem !==
false )
563 $Str = $this->compile_items( $Options , $MainItem , $Items );
572 catch( Exception $e )
604 $PageName = $this->Security->get_g(
'page_name' ,
'command' );
605 $Data = $this->Cache->get_data(
"bread_crumbs_for_$PageName" );
607 if( $Data ===
false )
609 $Str = $this->compile_bread_crumbs( $Options );
611 $this->Cache->add_data(
"bread_crumbs_for_$PageName" , $Str );
613 $this->Output = $Str;
617 $this->Output = $Data;
620 catch( Exception $e )
654 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_map' );
656 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_bread_crumbs' );
658 $ContextSet->execute( $Options , $this , __FILE__ );
660 return( $this->Output );
662 catch( Exception $e )