From 4c80b40da97be7e87af6a6e421677122e1e581f9 Mon Sep 17 00:00:00 2001 From: Gonzalo Merayo Date: Tue, 24 Jun 2003 19:10:14 +0000 Subject: [PATCH] ArbolDB terminado --- lib/MECON/HTML/Arbol/ArbolDB.php | 96 ++++++++++++++------------------ 1 file changed, 41 insertions(+), 55 deletions(-) diff --git a/lib/MECON/HTML/Arbol/ArbolDB.php b/lib/MECON/HTML/Arbol/ArbolDB.php index 09f53be..13e9d99 100644 --- a/lib/MECON/HTML/Arbol/ArbolDB.php +++ b/lib/MECON/HTML/Arbol/ArbolDB.php @@ -1,67 +1,53 @@ 'Nivel0a', - 'link' => 'blabla', - 'sub' => array(//sub0 - array( - 'titulo' => 'Nivel1a', - 'link' => 'blabla', - 'sub' => array(//sub1 - array( - 'titulo' => 'Nivel3a', - 'link' => 'blabla', - 'activado' => 1 - ), - array( - 'titulo' => 'Nivel3b', - 'link' => 'blabla', - 'sub' => array(//sub2 - array( - 'titulo' => 'Nivel4', - 'link' => 'blabla' - ) - )//sub2 - ), - array( - 'titulo' => 'Nivel3c', - 'link' => 'blabla' - ) - )//sub1 - ), - array( - 'titulo' => 'Nivel1b', - 'link' => 'blabla', - 'activado' => 1 - ), - array( - 'titulo' => 'Nivel1c', - 'link' => 'blabla' - ) - )//sub0 - ), - array( - 'titulo' => 'Nivel0b', - 'link' => 'blabla' - ), - array( - 'titulo' => 'Nivel0c', - 'link' => 'blabla' - ) - ); - - parent::Arbol($dat); + $this->padre = $dbdata['id_padre']; + $this->tabla = $dbdata['tabla']; + $this->nombre = $dbdata['nombre']; + $this->id = $dbdata['id']; + $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 + WHERE $this->padre = '$id'"; + $result = $this->db->query($sql); + if(DB::isError($result)) + die($result->getMessage()); + $dat = array(); + while($row = $result->fetchRow()) + { + $titulo = $row[0]; + $id = $row[1]; + $dat[] = array( + 'titulo'=> $titulo, + 'link' => $this->link.$id, + 'sub' => $this->BuscarHijos($id) + ); + } + return $dat; + } +} ?> -- 2.43.0