ultimix
menu_view.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $Cache = false;
39  var $CachedMultyFS = false;
40  var $Database = false;
41  var $DatabaseAlgorithms = false;
42  var $MenuAccess = false;
43  var $Security = false;
44 
59  function __construct()
60  {
61  try
62  {
63  $this->Cache = get_package( 'cache' , 'last' , __FILE__ );
64  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
65  $this->Database = get_package( 'database' , 'last' , __FILE__ );
66  $this->DatabaseAlgorithms = get_package( 'database::database_algorithms' , 'last' , __FILE__ );
67  $this->MenuAccess = get_package( 'menu::menu_access' , 'last' , __FILE__ );
68  $this->Security = get_package( 'security' , 'last' , __FILE__ );
69  }
70  catch( Exception $e )
71  {
72  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
73  }
74  }
75 
86  var $Output = false;
87 
106  function show_menu( $Options )
107  {
108  try
109  {
110  $MenuName = $Options->get_setting( 'menu_name' );
111  $DataName = "menu_$MenuName";
112  $this->Output = $this->Cache->get_data( $DataName );
113 
114  if( $this->Output === false )
115  {
116  $this->Output = $this->CachedMultyFS->get_template( __FILE__ , 'menu_header.tpl' );
117  $Result = $this->MenuAccess->get_menu_items( $MenuName );
118  foreach( $Result as $r )
119  {
120  $this->Output .= get_field( $r , 'href' );
121  }
122  $this->Output .= $this->CachedMultyFS->get_template( __FILE__ , 'menu_footer.tpl' );
123  $this->Cache->add_data( $DataName , $this->Output );
124  }
125  }
126  catch( Exception $e )
127  {
128  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
129  }
130  }
131 
150  function view( $Options )
151  {
152  try
153  {
154  $ContextSet = get_package( 'gui::context_set' , 'last' , __FILE__ );
155 
156  $ContextSet->add_context( dirname( __FILE__ ).'/conf/show_menu' );
157 
158  if( $ContextSet->execute( $Options , $this ) )return( $this->Output );
159 
160  return( $this->Output );
161  }
162  catch( Exception $e )
163  {
164  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
165  }
166  }
167  }
168 
169 ?>