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