3 require_once 'MECON/HTML/Arbol.php';
8 class HTML_ArbolDB extends HTML_Arbol
15 var $prepend_link = null;
18 function HTML_ArbolDB($dbdata, $imagen)
20 if(isset($dbdata['id_padre']))
21 $this->padre = $dbdata['id_padre'];
22 $this->tabla = $dbdata['tabla'];
23 $this->nombre = $dbdata['nombre'];
24 $this->id = $dbdata['id'];
25 if(isset($dbdata['prepend_link']))
26 $this->prepend_link = $dbdata['prepend_link'];
27 if(isset($dbdata['link']))
28 $this->link = $dbdata['link'];
29 $this->db = $dbdata['db'];
30 $dat = $this->BuscarHijos(0);
31 parent::HTML_Arbol($dat, $imagen);
34 function BuscarHijos($id)
36 $sql = "SELECT $this->nombre, $this->id ";
37 if(!is_null($this->link))
38 $sql .= ", $this->link ";
39 $sql .= "FROM $this->tabla ";
40 if(!is_null($this->padre))
41 $sql .= "WHERE $this->padre = '$id'";
42 $result = $this->db->query($sql);
43 if(DB::isError($result))
44 die($result->getMessage());
46 while($row = $result->fetchRow())
50 if(is_null($this->padre)) $sub = array();
51 else $sub = $this->BuscarHijos($id);
52 if(!is_null($this->link)) $link = $this->prepend_link.$row[2];
53 else $link = $this->prepend_link.$id;