From 46e1d55b1437c3eb73a9d877d9faae2979263639 Mon Sep 17 00:00:00 2001 From: Gonzalo Merayo Date: Tue, 24 Jun 2003 20:01:50 +0000 Subject: [PATCH] Otro cambio mas para ArbolDB, ahora toma la columna link de la base --- lib/MECON/HTML/Arbol/ArbolDB.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/MECON/HTML/Arbol/ArbolDB.php b/lib/MECON/HTML/Arbol/ArbolDB.php index 583a0a5..6937df8 100644 --- a/lib/MECON/HTML/Arbol/ArbolDB.php +++ b/lib/MECON/HTML/Arbol/ArbolDB.php @@ -11,7 +11,8 @@ class HTML_ArbolDB extends HTML_Arbol var $tabla; var $nombre; var $id; - var $link; + var $link = null; + var $prepend_link = null; var $db; function HTML_ArbolDB($dbdata, $imagen) @@ -21,7 +22,10 @@ class HTML_ArbolDB extends HTML_Arbol $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); @@ -29,8 +33,10 @@ class HTML_ArbolDB extends HTML_Arbol 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); @@ -43,9 +49,11 @@ class HTML_ArbolDB extends HTML_Arbol $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 ); } -- 2.43.0