var $tabla;
var $nombre;
var $id;
- var $link;
+ var $link = null;
+ var $prepend_link = null;
var $db;
function HTML_ArbolDB($dbdata, $imagen)
$this->tabla = $dbdata['tabla'];
$this->nombre = $dbdata['nombre'];
$this->id = $dbdata['id'];
- $this->link = $dbdata['link'];
+ if(isset($dbdata['prepend_link']))
+ $this->prepend_link = $dbdata['prepend_link'];
+ if(isset($dbdata['link']))
+ $this->link = $dbdata['link'];
$this->db = $dbdata['db'];
$dat = $this->BuscarHijos(0);
parent::HTML_Arbol($dat, $imagen);
function BuscarHijos($id)
{
- $sql = "SELECT $this->nombre, $this->id
- FROM $this->tabla ";
+ $sql = "SELECT $this->nombre, $this->id ";
+ if(!is_null($this->link))
+ $sql .= ", $this->link ";
+ $sql .= "FROM $this->tabla ";
if(!is_null($this->padre))
$sql .= "WHERE $this->padre = '$id'";
$result = $this->db->query($sql);
$id = $row[1];
if(is_null($this->padre)) $sub = array();
else $sub = $this->BuscarHijos($id);
+ if(!is_null($this->link)) $link = $this->prepend_link.$row[2];
+ else $link = $this->prepend_link.$id;
$dat[] = array(
'titulo'=> $titulo,
- 'link' => $this->link.$id,
+ 'link' => $link,
'sub' => $sub
);
}