ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

package_manager_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
26 class package_manager_view_1_0_0{
27
38 var $CachedMultyFS = false;
39
54 function __construct()
55 {
56 try
57 {
58 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
59 }
60 catch( Exception $e )
61 {
62 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
63 }
64 }
65
76 var $Output = false;
77
104 function compile_package_tree_branch( $Branch , $Package )
105 {
106 try
107 {
108 $Title = $Package[ 'package_name' ].'.'.$Package[ 'package_version' ];
109
110 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_item_start.tpl' );
111
112 $Brunch = str_replace( '{title}' , $Title , $Brunch );
113
114 $Brunch .= $this->show_package_tree_rec( $Package[ 'subpackages' ] );
115
116 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_item_end.tpl' );
117 }
118 catch( Exception $e )
119 {
120 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
121 }
122 }
123
146 function show_package_tree_rec( $Packages )
147 {
148 try
149 {
150 if( isset( $Packages[ 0 ] ) == false )
151 {
152 return( '' );
153 }
154
155 $Brunch = $this->CachedMultyFS->get_template( __FILE__ , 'package_branch_start.tpl' );
156
157 foreach( $Packages as $i => $Package )
158 {
159 $Branch = $this->compile_package_tree_branch( $Branch , $Package );
160 }
161
162 return( $Brunch.$this->CachedMultyFS->get_template( __FILE__ , 'package_branch_end.tpl' ) );
163 }
164 catch( Exception $e )
165 {
166 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
167 }
168 }
169
188 function show_package_tree( $Options )
189 {
190 try
191 {
192 $PackageAlgorithms = get_package( 'core::package_algorithms' , 'last' , __FILE__ );
193 $Packages = $PackageAlgorithms->get_packages_tree();
194
195 $this->Output = $this->CachedMultyFS->get_template( __FILE__ , 'package_start.tpl' );
196
197 foreach( $Packages as $i => $Package )
198 {
199 $this->Output = $this->compile_package_tree_brunch( $this->Output , $Package );
200 }
201
202 $this->Output .= $this->CachedMultyFS->get_template( __FILE__ , 'package_end.tpl' );
203 }
204 catch( Exception $e )
205 {
206 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
207 }
208 }
209
232 function show_system_tree_meta_rec( $MetaFiles )
233 {
234 try
235 {
236 if( isset( $MetaFiles[ 0 ] ) == false )
237 {
238 return( '' );
239 }
240
241 $Brunch = $this->CachedMultyFS->get_template( __FILE__ , 'package_meta_start.tpl' );
242
243 foreach( $MetaFiles as $i => $File )
244 {
245 $Title = basename( $File );
246
247 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_meta_item.tpl' );
248
249 $Brunch = str_replace( '{title}' , $Title , $Brunch );
250 }
251
252 return( $Brunch.$this->CachedMultyFS->get_template( __FILE__ , 'package_meta_end.tpl' ) );
253 }
254 catch( Exception $e )
255 {
256 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
257 }
258 }
259
282 function show_system_tree_conf_rec( $ConfigFiles )
283 {
284 try
285 {
286 if( isset( $ConfigFiles[ 0 ] ) == false )
287 {
288 return( '' );
289 }
290
291 $Brunch = $this->CachedMultyFS->get_template( __FILE__ , 'package_conf_start.tpl' );
292
293 foreach( $ConfigFiles as $i => $File )
294 {
295 $Title = basename( $File );
296
297 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_conf_item.tpl' );
298
299 $Brunch = str_replace( '{title}' , $Title , $Brunch );
300 }
301
302 return( $Brunch.$this->CachedMultyFS->get_template( __FILE__ , 'package_conf_end.tpl' ) );
303 }
304 catch( Exception $e )
305 {
306 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
307 }
308 }
309
336 function compile_system_tree_branch( $Branch , $Package )
337 {
338 try
339 {
340 $Title = $Package[ 'package_name' ].'.'.$Package[ 'package_version' ];
341
342 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_system_item_start.tpl' );
343
344 $Brunch = str_replace( '{title}' , $Title , $Brunch );
345
346 $Brunch .= $this->show_system_tree_rec( $Package[ 'subpackages' ] );
347
348 $Brunch .= $this->show_system_tree_meta_rec( $Package[ 'meta' ] );
349
350 $Brunch .= $this->show_system_tree_conf_rec( $Package[ 'conf' ] );
351
352 $Brunch .= $this->CachedMultyFS->get_template( __FILE__ , 'package_system_item_end.tpl' );
353 }
354 catch( Exception $e )
355 {
356 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
357 }
358 }
359
382 function show_system_tree_rec( $Packages )
383 {
384 try
385 {
386 if( isset( $Packages[ 0 ] ) == false )
387 {
388 return( '' );
389 }
390
391 $Brunch = $this->CachedMultyFS->get_template( __FILE__ , 'package_system_start.tpl' );
392
393 foreach( $Packages as $i => $Package )
394 {
395 $Brunch = $this->compile_system_tree_branch( $Branch , $Package );
396 }
397
398 return( $Brunch.$this->CachedMultyFS->get_template( __FILE__ , 'package_system_end.tpl' ) );
399 }
400 catch( Exception $e )
401 {
402 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
403 }
404 }
405
424 function show_system_tree( $Options )
425 {
426 try
427 {
428 $PackageAlgorithms = get_package( 'core::package_algorithms' , 'last' , __FILE__ );
429 $Packages = $PackageAlgorithms->get_packages_tree();
430
431 $this->Output = $this->CachedMultyFS->get_template( __FILE__ , 'system_start.tpl' );
432
433 foreach( $Packages as $i => $Package )
434 {
435 $this->Output = $this->compile_system_tree_branch( $this->Output , $Package );
436 }
437
438 $this->Output .= $this->CachedMultyFS->get_template( __FILE__ , 'system_end.tpl' );
439 }
440 catch( Exception $e )
441 {
442 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
443 }
444 }
445
468 function view( $Options )
469 {
470 try
471 {
472 $Context = get_package( 'gui::context' , 'last' , __FILE__ );
473
474 $Context->load_config( dirname( __FILE__ ).'/conf/cfcx_show_package_tree' );
475 if( $Context->execute( $Options , $this ) )return( $this->Output );
476
477 $Context->load_config( dirname( __FILE__ ).'/conf/cfcx_show_system_tree' );
478 if( $Context->execute( $Options , $this ) )return( $this->Output );
479 }
480 catch( Exception $e )
481 {
482 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
483 }
484 }
485 }
486
487 ?>