ultimix
object_list.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 $Output;
39 
50  var $CachedMultyFS = false;
51 
62  function __construct()
63  {
64  try
65  {
66  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
67  }
68  catch( Exception $e )
69  {
70  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
71  }
72  }
73 
96  private function get_templates( &$Options )
97  {
98  try
99  {
100  $DirPath = dirname( __FILE__ )."/res/templates/";
101 
102  $FileName = $Options->get_setting( 'header' , 'header' );
103  $Header = $this->CachedMultyFS->file_get_contents( "$DirPath$FileName.tpl" );
104 
105  $FileName = $Options->get_setting( 'item' , 'item' );
106  $Item = $this->CachedMultyFS->file_get_contents( "$DirPath$FileName.tpl" );
107 
108  $FileName = $Options->get_setting( 'footer' , 'footer' );
109  $Footer = $this->CachedMultyFS->file_get_contents( "$DirPath$FileName.tpl" );
110 
111  return( array( $Header , $Item , $Footer ) );
112  }
113  catch( Exception $e )
114  {
115  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
116  }
117  }
118 
137  function draw_object_list( &$Options )
138  {
139  try
140  {
141  $this->Output = '';
142 
143  $Name = $Options->get_setting( 'package_name' );
144  $Version = $Options->get_setting( 'package_version' , 'last' );
145  $Package = get_package( $Name , $Version , __FILE__ );
146  $FunctionName = $Options->get_setting( 'select_func_name' , 'select' );
147 
148  $Records = call_user_func( array( $Object , $FunctionName ) , 0 , 1000000 , false , false );
149 
150  list( $Header , $Item , $Footer ) = $this->get_templates( $Options );
151 
152  foreach( $Records as $i => $Record )
153  {
154  $this->Output .= $this->String->print_record( $Item , $Record );
155  }
156 
157  $this->Output = $Header.$this->Output.$Footer;
158  }
159  catch( Exception $e )
160  {
161  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
162  }
163  }
164 
183  function compile_object_list( &$Settings )
184  {
185  try
186  {
187  $this->draw_object_list( $Settings );
188 
189  return( $this->Output );
190  }
191  catch( Exception $e )
192  {
193  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
194  }
195  }
196 
219  function view( &$Options )
220  {
221  try
222  {
223  $ContextSet = get_package( 'gui::context_set' , 'last' , __FILE__ );
224 
225  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_object_list' );
226 
227  $ContextSet->execute( $Options , $this , __FILE__ );
228 
229  return( $this->Output );
230  }
231  catch( Exception $e )
232  {
233  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
234  }
235  }
236  }
237 
238 ?>