require_once 'HTML/Table.php';
class HTML_Arbol extends HTML_Table
{
var $t_interna;
function Arbol($dat)
{
parent::HTML_Table(array ('width'=>'132',
'border' => '0',
'cellspacing' => '0',
'cellpadding' => '0',
'bgcolor' => '#003868'));
$this->t_interna = new HTML_Table(array ('width'=>'132',
'border' => '0',
'cellspacing' => '2',
'cellpadding' => '0',
'class' => 'bodytext'));
$this->addRow(array(''));
$this->expandir($dat, 0);
}
function expandir($dat, $n)
{
$imagen = '';
$class = 'menu';
switch($n){
case 1: $imagen = '';
$class = 'menu1';
break;
case 2: $imagen = '';
$class = 'menu1';
break;
case 3: $imagen = '';
$class = 'menu2';
break;
}
foreach($dat as $e)
{
if(!is_null($e['link']))
$e['titulo'] = ''.$imagen.$e['titulo'].'';
if(isset($e['activado']) && $e['activado'] != 0) $class_a = 'menu_activo';
else $class_a = $class;
$this->t_interna->addRow(array($e['titulo']), array('class' => $class_a));
if(isset($e['sub']))
$this->expandir($e['sub'], $n+1);
}
}
function toHTML()
{
echo '';
$this->addRow(array($this->t_interna->toHTML()));
return parent::toHTML();
}
};
?>