| 1 |
<?php |
| 2 |
/* |
| 3 |
## ------------------------------------------------------------------------- |
| 4 |
## $Id: DHTMLTreeNav.inc,v 1.2 2003/02/28 04:24:17 joko Exp $ |
| 5 |
## ------------------------------------------------------------------------- |
| 6 |
## $Log: DHTMLTreeNav.inc,v $ |
| 7 |
## Revision 1.2 2003/02/28 04:24:17 joko |
| 8 |
## disabled benchmarking |
| 9 |
## - purged old code |
| 10 |
## |
| 11 |
## Revision 1.1 2003/02/27 16:57:17 joko |
| 12 |
## + initial commit, inherits from BaseWidget, uses pear-bridge |
| 13 |
## |
| 14 |
## ------------------------------------------------------------------------- |
| 15 |
*/ |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
// This is a phpHtmlLib extension class implementing nested trees. |
| 20 |
|
| 21 |
// It inherits from phpHtmlLib's BaseWidget to be transparently spooled |
| 22 |
// down when rendering (->render!). |
| 23 |
|
| 24 |
// It uses phpHtmlLib::TreeNav::PearHtmlTreeMenuBridge to access |
| 25 |
// some fine component libraries from PEAR to get things done. |
| 26 |
|
| 27 |
// Please also visit its sister class phpHtmlLib::TreeNav::SelectNav, |
| 28 |
// which displays a nested tree flattened into a html-form "select" element. |
| 29 |
|
| 30 |
|
| 31 |
class DHTMLTreeNav extends BaseWidget { |
| 32 |
|
| 33 |
var $pearbridge; |
| 34 |
var $menuobject; |
| 35 |
|
| 36 |
function DHTMLTreeNav(&$payload) { |
| 37 |
|
| 38 |
$args[payload] = &$payload; |
| 39 |
$args[type] = 'DHTML'; |
| 40 |
$this->pearbridge = new TreeNav_PearHtmlTreeMenuBridge(&$args); |
| 41 |
$this->menuobject = $this->pearbridge->getMenuObject(); |
| 42 |
|
| 43 |
// initialize output the phpHtmlLib way |
| 44 |
$this->_init_output(); |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
function _init_output() { |
| 50 |
|
| 51 |
/* |
| 52 |
// styling |
| 53 |
$this->add(' |
| 54 |
<style type="text/css"> |
| 55 |
body { |
| 56 |
font-family: Georgia; |
| 57 |
font-size: 11pt; |
| 58 |
} |
| 59 |
|
| 60 |
.treeMenuDefault { |
| 61 |
font-style: italic; |
| 62 |
} |
| 63 |
|
| 64 |
.treeMenuBold { |
| 65 |
font-style: italic; |
| 66 |
font-weight: bold; |
| 67 |
} |
| 68 |
</style> |
| 69 |
'); |
| 70 |
*/ |
| 71 |
|
| 72 |
$this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'); |
| 73 |
|
| 74 |
/* |
| 75 |
// benchmarking - before |
| 76 |
$this->add(' |
| 77 |
<script language="JavaScript" type="text/javascript"> |
| 78 |
<!-- |
| 79 |
a = new Date(); |
| 80 |
a = a.getTime(); |
| 81 |
//--> |
| 82 |
</script> |
| 83 |
'); |
| 84 |
*/ |
| 85 |
|
| 86 |
$this->add($this->menuobject->toHTML()); |
| 87 |
|
| 88 |
/* |
| 89 |
// benchmarking - afterwards |
| 90 |
$this->add(' |
| 91 |
<script language="JavaScript" type="text/javascript"> |
| 92 |
<!-- |
| 93 |
b = new Date(); |
| 94 |
b = b.getTime(); |
| 95 |
|
| 96 |
document.write("Time to render tree: " + ((b - a) / 1000) + "s"); |
| 97 |
//--> |
| 98 |
</script> |
| 99 |
'); |
| 100 |
*/ |
| 101 |
|
| 102 |
} |
| 103 |
|
| 104 |
} |
| 105 |
|
| 106 |
?> |