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