From: Leandro Lucarella Date: Thu, 18 Sep 2003 21:50:30 +0000 (+0000) Subject: Se agrega opción para expandir. X-Git-Tag: svn_import~273 X-Git-Url: https://git.llucax.com/mecon/meconlib.git/commitdiff_plain/9fbf32b42919b036c64c2dcae2e773aa0bef72b7?hp=fad375f777a654d8285cc516ed40f2396aae0295 Se agrega opción para expandir. --- diff --git a/lib/MECON/HTML/Arbol.php b/lib/MECON/HTML/Arbol.php index df77d1a..d4a25b2 100644 --- a/lib/MECON/HTML/Arbol.php +++ b/lib/MECON/HTML/Arbol.php @@ -138,6 +138,7 @@ class MECON_HTML_Arbol extends HTML_Table $titulo = $e['titulo']; if(isset($e['activo']) && $e['activo'] != 0) $class = 'menu_activo'; else $class = $classes[$n]; + if(isset($e['bold'])) $class .= '_bold'; if(!is_null($e['link'])) { $link = $e['link']; if ($this->link_append and @$e['id']) { diff --git a/lib/MECON/HTML/ArbolDB.php b/lib/MECON/HTML/ArbolDB.php index 177ad14..31e7577 100644 --- a/lib/MECON/HTML/ArbolDB.php +++ b/lib/MECON/HTML/ArbolDB.php @@ -126,7 +126,7 @@ class MECON_HTML_ArbolDB extends MECON_HTML_Arbol * @return void * @access public */ - function MECON_HTML_ArbolDB($dbdata, $titulo, $link_append = '') + function MECON_HTML_ArbolDB($dbdata, $titulo, $link_append = '', $expandir = false) { if(isset($dbdata['id_padre'])) $this->padre = $dbdata['id_padre']; @@ -144,18 +144,21 @@ class MECON_HTML_ArbolDB extends MECON_HTML_Arbol if(isset($dbdata['order'])) $this->order = ' ORDER BY '.$dbdata['nombre'].' '.$dbdata['order']; $this->db = $dbdata['db']; - - $this->expandir = array($this->id_activo); - if(isset($this->id_activo)) + + if($expandir) { - $id = $this->id_activo; - while($id != 0) + $this->expandir = array($this->id_activo); + if(isset($this->id_activo)) { - $sql = "SELECT $this->padre - FROM $this->tabla - WHERE $this->id = '".$id."'"; - $id = $this->db->getOne($sql); - $this->expandir[] = $id; + $id = $this->id_activo; + while($id != 0) + { + $sql = "SELECT $this->padre + FROM $this->tabla + WHERE $this->id = '".$id."'"; + $id = $this->db->getOne($sql); + $this->expandir[] = $id; + } } } @@ -194,7 +197,9 @@ class MECON_HTML_ArbolDB extends MECON_HTML_Arbol { $titulo = $row[0]; $id = $row[1]; - if(!$this->padre || !in_array($id, $this->expandir)) $sub = array(); + if(!$this->padre || !(!isset($this->expandir) || + in_array($id, $this->expandir))) + $sub = array(); else $sub = $this->BuscarHijos($id); $link = strval(@$row[2]); $d = array( @@ -203,6 +208,8 @@ class MECON_HTML_ArbolDB extends MECON_HTML_Arbol 'id' => $id, 'sub' => $sub ); + if(isset($this->expandir) && in_array($id, $this->expandir) && $id != $this->id_activo) + $d['bold'] = 1; if (!is_null($this->id_activo) and $id == $this->id_activo) { $d['activo'] = 1; } diff --git a/www/css/arbol.css b/www/css/arbol.css index 1033554..a9c3623 100644 --- a/www/css/arbol.css +++ b/www/css/arbol.css @@ -10,6 +10,19 @@ vertical-align: middle } +.menu_bold { + color: #003366; + FONT-WEIGHT: bold ; + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + font-style: normal; + line-height: normal; + background-color: #FFFFFF; + background-position: left; + text-align: left; + vertical-align: middle +} + .menu_activo { COLOR: #003366; FONT-FAMILY: Arial, Helvetica, sans-serif; @@ -22,6 +35,19 @@ vertical-align: middle } +.menu_activo_bold { + COLOR: #003366; + FONT-FAMILY: Arial, Helvetica, sans-serif; + FONT-SIZE: 10pt; + FONT-WEIGHT: bold ; + font-style: normal; + line-height: normal; + background-color: #FFCC99; + background-position: left center; + text-align: left; + vertical-align: middle +} + .menu1 { COLOR: #003366; FONT-FAMILY: Arial, Helvetica, sans-serif;