1 |
<?php |
<?php |
2 |
/* |
/** |
3 |
## ------------------------------------------------------------------------- |
* This file contains the TreeNav_PearHtmlTreeMenuBridge class. |
4 |
## $Id$ |
* |
5 |
## ------------------------------------------------------------------------- |
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
## $Log$ |
* @package org.netfrag.patches |
7 |
## Revision 1.1 2003/04/18 13:53:05 joko |
* @name TreeNav::PearHtmlTreeMenuBridge |
8 |
## from com.newsblob.phphtmllib/widgets |
* |
9 |
## |
*/ |
10 |
## Revision 1.2 2003/02/27 16:55:51 joko |
|
11 |
## + fixed comment ;-) |
/** |
12 |
## |
* Cvs-Log: |
13 |
## Revision 1.1 2003/02/27 16:55:08 joko |
* |
14 |
## + initial commit, bridges phpHtmlLib and PEAR::HTML::TreeMenu |
* $Id$ |
15 |
## |
* |
16 |
## ------------------------------------------------------------------------- |
* $Log$ |
17 |
*/ |
* Revision 1.2 2003/05/13 16:30:37 joko |
18 |
|
* using built-in structure reader |
19 |
|
* |
20 |
|
* Revision 1.1 2003/04/18 13:53:05 joko |
21 |
// This is a phpHtmlLib extension class implementing nested trees. |
* from com.newsblob.phphtmllib/widgets |
22 |
// It uses PEAR::Tree to hold tree data and PEAR::HTML::TreeMenu to display it. |
* |
23 |
// PEAR::Tree: |
* Revision 1.2 2003/02/27 16:55:51 joko |
24 |
// - http://opensource.visionp.de/modules/project/tree.php |
* + fixed comment ;-) |
25 |
// - http://pear.php.net/package-info.php?pacid=104 |
* |
26 |
// PEAR::HTML::TreeMenu: |
* Revision 1.1 2003/02/27 16:55:08 joko |
27 |
// - http://phpguru.org/treemenu.php |
* + initial commit, bridges phpHtmlLib and PEAR::HTML::TreeMenu |
28 |
// - http://pear.php.net/package-info.php?pacid=77 |
* |
29 |
|
*/ |
30 |
// PEAR::HTML::TreeMenu offers two rendering modes by now: |
|
31 |
// - DHTML: show nested deep tree in explorer like style |
/** |
32 |
// - Listbox: flatten tree into options of a html "select" form element |
* TreeNav::PearHtmlTreeMenuBridge |
33 |
|
* |
34 |
// All data conversion between these single stages is done using Data::Lift... |
* This is a phpHtmlLib extension class handling nested trees. |
35 |
// e.g.: |
* |
36 |
// 1. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
* It acts as an intermediate bridging layer between PEAR::Tree holding the |
37 |
// PEAR::HTML::TreeMenu::DHTML -> phpHtmlLib::DHTMLTreeNav |
* tree data structure and PEAR's HTML_TreeMenu Class displaying it. |
38 |
// 2. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
* |
39 |
// PEAR::HTML::TreeMenu::Listbox -> phpHtmlLib::SelectNav |
* 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 |
class TreeNav_PearHtmlTreeMenuBridge { |
class TreeNav_PearHtmlTreeMenuBridge { |
76 |
|
|
77 |
var $payload; |
var $payload; |
82 |
|
|
83 |
$this->payload = &$args[payload]; |
$this->payload = &$args[payload]; |
84 |
$this->type = $args[type]; |
$this->type = $args[type]; |
85 |
|
$this->converter = $args[converter]; |
86 |
|
|
87 |
if (!$this->type) { |
if (!$this->type) { |
88 |
print get_class($this) . ": Please specify 'type'<br/>"; |
print get_class($this) . ": Please specify 'type'<br/>"; |
93 |
//$this->_init_tree_live(); |
//$this->_init_tree_live(); |
94 |
//$this->_init_tree_fromPayload(); |
//$this->_init_tree_fromPayload(); |
95 |
|
|
96 |
$handler_name = $this->type; |
$options = array( converter => $this->converter ); |
97 |
|
|
98 |
// lift PEAR::Tree object to PEAR::HTML::TreeMenu::DHTML object |
// lift PEAR::Tree object to PEAR::HTML::TreeMenu::DHTML object ... |
99 |
$this->lift = mkObject('Data::Lift', $this->payload); |
//$this->lift = mkObject('Data::Lift', $this->payload); |
100 |
$this->menuobject = $this->lift->to("PEAR::HTML::TreeMenu::$handler_name"); |
$this->lift = mkObject('Data::Lift', $this->payload, $options); |
101 |
|
|
102 |
|
$handler_name = $this->type; |
103 |
|
$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 |
|
|
112 |
} |
} |
113 |
|
|