class HTML_ArbolDB extends HTML_Arbol
{
- var $padre;
+ var $padre = null;
var $tabla;
var $nombre;
var $id;
function HTML_ArbolDB($dbdata, $imagen)
{
- $this->padre = $dbdata['id_padre'];
+ if(isset($dbdata['id_padre']))
+ $this->padre = $dbdata['id_padre'];
$this->tabla = $dbdata['tabla'];
$this->nombre = $dbdata['nombre'];
$this->id = $dbdata['id'];
function BuscarHijos($id)
{
$sql = "SELECT $this->nombre, $this->id
- FROM $this->tabla
- WHERE $this->padre = '$id'";
+ FROM $this->tabla";
+ if(!is_null$this->padre)
+ $sql .= "WHERE $this->padre = '$id'";
$result = $this->db->query($sql);
if(DB::isError($result))
die($result->getMessage());