<?\r
\r
require_once 'HTML/Table.php';\r
+require_once 'HTML/Image.php';\r
\r
class HTML_Arbol extends HTML_Table\r
{\r
var $t_interna;\r
\r
- function Arbol($dat)\r
+ function HTML_Arbol($dat, $imagen)\r
{\r
parent::HTML_Table(array ('width'=>'132',\r
'border' => '0',\r
'cellspacing' => '2',\r
'cellpadding' => '0',\r
'class' => 'bodytext'));\r
- $this->addRow(array('<img name="noticias" src="MECON/images/noticias.gif" width="132" height="26" border="0">'));\r
+ $this->addRow(array(new HTML_Image($imagen,'',array('width'=>'132',\r
+ 'height'=>'26',\r
+ 'border'=>'0'))));\r
$this->expandir($dat, 0);\r
}\r
+ \r
function expandir($dat, $n)\r
{\r
$imagen = '';\r
- $class = 'menu'; \r
- switch($n){\r
- case 1: $imagen = '<img src="MECON/images/arbol_bullet_1.gif" width="7" height="10">';\r
- $class = 'menu1'; \r
- break;\r
- case 2: $imagen = '<img src="MECON/images/arbol_bullet_2.gif" width="13" height="10">';\r
- $class = 'menu1'; \r
- break;\r
- case 3: $imagen = '<img src="MECON/images/arbol_bullet3.gif" width="20" height="10">';\r
- $class = 'menu2'; \r
- break;\r
- }\r
+ $bullets = array('',\r
+ '/MECON/images/arbol_bullet_1.gif',\r
+ '/MECON/images/arbol_bullet_2.gif',\r
+ '/MECON/images/arbol_bullet_3.gif');\r
+ $tabulados = array(0, 7, 13, 20);\r
+ $classes = array('menu', 'menu1', 'menu1', 'menu2');\r
+ \r
+ $atr = array('border' => '0',\r
+ 'width' => $tabulados[$n],\r
+ 'height' => '10');\r
+ $imagen =& new HTML_Image($bullets[$n], 'bullet', $atr);\r
foreach($dat as $e)\r
{\r
+ $e['titulo'] = $imagen->toHTML().$e['titulo'];\r
if(!is_null($e['link']))\r
- $e['titulo'] = '<a href="'.$e['link'].'">'.$imagen.$e['titulo'].'</a>';\r
- if(isset($e['activado']) && $e['activado'] != 0) $class_a = 'menu_activo';\r
- else $class_a = $class;\r
- $this->t_interna->addRow(array($e['titulo']), array('class' => $class_a));\r
+ $e['titulo'] = '<a href="'.$e['link'].'">'.$e['titulo'].'</a>';\r
+ if(isset($e['activado']) && $e['activado'] != 0) $class = 'menu_activo';\r
+ else $class = $classes[$n];\r
+ $this->t_interna->addRow(array($e['titulo']), array('class' => $class));\r
if(isset($e['sub']))\r
$this->expandir($e['sub'], $n+1);\r
}\r
}\r
+\r
function toHTML()\r
{\r
- echo '<link rel="stylesheet" href="MECON/css/arbol.css">';\r
+ echo '<link rel="stylesheet" href="/MECON/css/arbol.css">';\r
$this->addRow(array($this->t_interna->toHTML()));\r
return parent::toHTML();\r
}\r