| 1 |
joko |
1.1 |
<?php |
| 2 |
|
|
/* |
| 3 |
|
|
## ------------------------------------------------------------------------- |
| 4 |
joko |
1.2 |
## $Id: TreeNav_PearHtmlTreeMenuBridge.inc,v 1.1 2003/02/27 16:55:08 joko Exp $ |
| 5 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
| 6 |
joko |
1.2 |
## $Log: TreeNav_PearHtmlTreeMenuBridge.inc,v $ |
| 7 |
|
|
## Revision 1.1 2003/02/27 16:55:08 joko |
| 8 |
|
|
## + initial commit, bridges phpHtmlLib and PEAR::HTML::TreeMenu |
| 9 |
|
|
## |
| 10 |
joko |
1.1 |
## ------------------------------------------------------------------------- |
| 11 |
|
|
*/ |
| 12 |
|
|
|
| 13 |
|
|
|
| 14 |
|
|
|
| 15 |
|
|
// This is a phpHtmlLib extension class implementing nested trees. |
| 16 |
|
|
// It uses PEAR::Tree to hold tree data and PEAR::HTML::TreeMenu to display it. |
| 17 |
|
|
// PEAR::Tree: |
| 18 |
|
|
// - http://opensource.visionp.de/modules/project/tree.php |
| 19 |
|
|
// - http://pear.php.net/package-info.php?pacid=104 |
| 20 |
|
|
// PEAR::HTML::TreeMenu: |
| 21 |
|
|
// - http://phpguru.org/treemenu.php |
| 22 |
|
|
// - http://pear.php.net/package-info.php?pacid=77 |
| 23 |
|
|
|
| 24 |
|
|
// PEAR::HTML::TreeMenu offers two rendering modes by now: |
| 25 |
|
|
// - DHTML: show nested deep tree in explorer like style |
| 26 |
|
|
// - Listbox: flatten tree into options of a html "select" form element |
| 27 |
|
|
|
| 28 |
|
|
// All data conversion between these single stages is done using Data::Lift... |
| 29 |
|
|
// e.g.: |
| 30 |
|
|
// 1. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
| 31 |
|
|
// PEAR::HTML::TreeMenu::DHTML -> phpHtmlLib::DHTMLTreeNav |
| 32 |
|
|
// 2. php hash -> PEAR::Tree -> PEAR::HTML::TreeMenu -> |
| 33 |
|
|
// PEAR::HTML::TreeMenu::Listbox -> phpHtmlLib::SelectNav |
| 34 |
|
|
|
| 35 |
|
|
|
| 36 |
|
|
class TreeNav_PearHtmlTreeMenuBridge { |
| 37 |
|
|
|
| 38 |
|
|
var $payload; |
| 39 |
|
|
var $lift; |
| 40 |
|
|
var $menuobject; |
| 41 |
|
|
|
| 42 |
|
|
function TreeNav_PearHtmlTreeMenuBridge(&$args) { |
| 43 |
|
|
|
| 44 |
|
|
$this->payload = &$args[payload]; |
| 45 |
|
|
$this->type = $args[type]; |
| 46 |
|
|
|
| 47 |
|
|
if (!$this->type) { |
| 48 |
|
|
print get_class($this) . ": Please specify 'type'<br/>"; |
| 49 |
|
|
return; |
| 50 |
|
|
} |
| 51 |
|
|
|
| 52 |
|
|
//$this->_init_tree_example(); |
| 53 |
|
|
//$this->_init_tree_live(); |
| 54 |
|
|
//$this->_init_tree_fromPayload(); |
| 55 |
|
|
|
| 56 |
|
|
$handler_name = $this->type; |
| 57 |
|
|
|
| 58 |
|
|
// lift PEAR::Tree object to PEAR::HTML::TreeMenu::DHTML object |
| 59 |
|
|
$this->lift = mkObject('Data::Lift', $this->payload); |
| 60 |
|
|
$this->menuobject = $this->lift->to("PEAR::HTML::TreeMenu::$handler_name"); |
| 61 |
|
|
|
| 62 |
|
|
} |
| 63 |
|
|
|
| 64 |
|
|
function getMenuObject() { |
| 65 |
|
|
return $this->menuobject; |
| 66 |
|
|
} |
| 67 |
|
|
|
| 68 |
|
|
} |
| 69 |
|
|
|
| 70 |
|
|
?> |