1 |
joko |
1.1 |
<?php |
2 |
joko |
1.2 |
/** |
3 |
|
|
* This file contains the TreeNav_PearHtmlTreeMenuBridge class. |
4 |
|
|
* |
5 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
|
|
* @package org.netfrag.patches |
7 |
|
|
* @name TreeNav::PearHtmlTreeMenuBridge |
8 |
|
|
* |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Cvs-Log: |
13 |
|
|
* |
14 |
joko |
1.3 |
* $Id: TreeNav_PearHtmlTreeMenuBridge.inc,v 1.2 2003/05/13 16:30:37 joko Exp $ |
15 |
|
|
* |
16 |
|
|
* $Log: TreeNav_PearHtmlTreeMenuBridge.inc,v $ |
17 |
|
|
* Revision 1.2 2003/05/13 16:30:37 joko |
18 |
|
|
* using built-in structure reader |
19 |
joko |
1.2 |
* |
20 |
|
|
* Revision 1.1 2003/04/18 13:53:05 joko |
21 |
|
|
* from com.newsblob.phphtmllib/widgets |
22 |
|
|
* |
23 |
|
|
* Revision 1.2 2003/02/27 16:55:51 joko |
24 |
|
|
* + fixed comment ;-) |
25 |
|
|
* |
26 |
|
|
* Revision 1.1 2003/02/27 16:55:08 joko |
27 |
|
|
* + initial commit, bridges phpHtmlLib and PEAR::HTML::TreeMenu |
28 |
|
|
* |
29 |
|
|
*/ |
30 |
|
|
|
31 |
|
|
/** |
32 |
|
|
* TreeNav::PearHtmlTreeMenuBridge |
33 |
|
|
* |
34 |
|
|
* This is a phpHtmlLib extension class handling nested trees. |
35 |
|
|
* |
36 |
|
|
* It acts as an intermediate bridging layer between PEAR::Tree holding the |
37 |
|
|
* tree data structure and PEAR's HTML_TreeMenu Class displaying it. |
38 |
|
|
* |
39 |
|
|
* PEAR::Tree has been written by Wolfram Kriesing <wolfram@kriesing.de> |
40 |
|
|
* - http://opensource.visionp.de/modules/project/tree.php |
41 |
|
|
* - http://pear.php.net/package-info.php?pacid=104 |
42 |
|
|
* |
43 |
|
|
* The Authors of the HTML_TreeMenu Class are Richard Heyes <richard@phpguru.org> |
44 |
|
|
* and Harald Radi <harald.radi@nme.at>, please visit: |
45 |
|
|
* - http://phpguru.org/treemenu.php |
46 |
|
|
* - http://pear.php.net/package-info.php?pacid=77 |
47 |
|
|
* |
48 |
|
|
* |
49 |
|
|
* PEAR::HTML::TreeMenu offers two rendering modes by now: |
50 |
|
|
* - DHTML: show nested deep tree in explorer like style |
51 |
|
|
* - Listbox: flatten tree into options of a html "select" form element |
52 |
|
|
* |
53 |
|
|
* All data conversion between these single stages is done using Data::Lift... |
54 |
|
|
* e.g.: |
55 |
|
|
* 1. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
56 |
|
|
* PEAR::HTML::TreeMenu::DHTML -> phpHtmlLib::DHTMLTreeNav |
57 |
|
|
* 2. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
58 |
|
|
* PEAR::HTML::TreeMenu::Listbox -> phpHtmlLib::SelectNav |
59 |
|
|
* |
60 |
|
|
* |
61 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
62 |
|
|
* @copyright (c) 2003 - All Rights reserved. |
63 |
|
|
* @license GNU LGPL (GNU Lesser General Public License) |
64 |
|
|
* |
65 |
|
|
* @link http://www.netfrag.org/~joko/ |
66 |
|
|
* @link http://www.gnu.org/licenses/lgpl.txt |
67 |
|
|
* |
68 |
|
|
* @package org.netfrag.patches |
69 |
|
|
* @subpackage phphtmllib::widgets |
70 |
|
|
* @name TreeNav::PearHtmlTreeMenuBridge |
71 |
|
|
* |
72 |
|
|
* @link http://cvs.netfrag.org/php/libs/org.netfrag.patches |
73 |
|
|
* |
74 |
|
|
*/ |
75 |
joko |
1.1 |
class TreeNav_PearHtmlTreeMenuBridge { |
76 |
|
|
|
77 |
|
|
var $payload; |
78 |
|
|
var $lift; |
79 |
|
|
var $menuobject; |
80 |
|
|
|
81 |
|
|
function TreeNav_PearHtmlTreeMenuBridge(&$args) { |
82 |
|
|
|
83 |
|
|
$this->payload = &$args[payload]; |
84 |
|
|
$this->type = $args[type]; |
85 |
joko |
1.2 |
$this->converter = $args[converter]; |
86 |
joko |
1.1 |
|
87 |
|
|
if (!$this->type) { |
88 |
|
|
print get_class($this) . ": Please specify 'type'<br/>"; |
89 |
|
|
return; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
//$this->_init_tree_example(); |
93 |
|
|
//$this->_init_tree_live(); |
94 |
|
|
//$this->_init_tree_fromPayload(); |
95 |
|
|
|
96 |
joko |
1.2 |
$options = array( converter => $this->converter ); |
97 |
|
|
|
98 |
|
|
// lift PEAR::Tree object to PEAR::HTML::TreeMenu::DHTML object ... |
99 |
|
|
//$this->lift = mkObject('Data::Lift', $this->payload); |
100 |
|
|
$this->lift = mkObject('Data::Lift', $this->payload, $options); |
101 |
|
|
|
102 |
joko |
1.1 |
$handler_name = $this->type; |
103 |
joko |
1.2 |
$this->menuobject = $this->lift->to("PEAR::HTML::TreeMenu::$handler_name"); |
104 |
|
|
|
105 |
|
|
// ... using HTML::TreeMenu::createFromStructure( ... ) |
106 |
|
|
if ($this->converter == 'builtin.kriesing') { |
107 |
|
|
|
108 |
|
|
// ... using own code |
109 |
|
|
} else { |
110 |
|
|
} |
111 |
joko |
1.1 |
|
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
function getMenuObject() { |
115 |
|
|
return $this->menuobject; |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
?> |