X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/d509d13eb04bc453abd7299bc979efedb35eeb25..06cd54ffd3f4a2641a10db316fb08d42c3b8b5ea:/lib/MECON/HTML/TablaDB.php diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index 4e06d25..6852ba9 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -29,6 +29,7 @@ require_once 'MECON/DB/Pager.php'; require_once 'MECON/Array/Pager.php'; require_once 'MECON/HTML/Error.php'; require_once 'MECON/HTML/Link.php'; +require_once 'MECON/HTML/Icon.php'; require_once 'MECON/HTML/Tabla.php'; /// Prefijo a usar para las variables GET que genera la tabla. @@ -145,9 +146,9 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { */ function addPager($result, $tipo = null, $link = null, $limit = 10, $maxpages = 21, $getvar = 'from') { // Creo el pager con el resultado. - $pager = (is_array($result))? - new MECON_Array_Pager($result, @$_GET[$this->_getVarPrefix.$getvar], $limit, $maxpages): - new MECON_DB_Pager($result, @$_GET[$this->_getVarPrefix.$getvar], $limit, $maxpages); + $pager = (is_array($result))? + new MECON_Array_Pager($result, @$_GET[$this->getGetVarPrefix().$getvar], $limit, $maxpages): + new MECON_DB_Pager($result, @$_GET[$this->getGetVarPrefix().$getvar], $limit, $maxpages); // Obtengo un link vĂ¡lido. if (!$link) { @@ -641,21 +642,20 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { break; } if ($activo === true) { - $img = new MECON_HTML_Image("/MECON/images/general_$id", - '('.strtoupper($id{0}).')'); - $img->updateAttributes(array('title' => ucfirst($id))); - $link->addContents($img); + $img = new MECON_HTML_Icon($id, $link, null, + array('title' => ucfirst($id))); + $l = $img->getLink(); foreach ($campos as $campo) { $format = null; if (is_array($campo)) { list($campo, $format) = $campo; } - $link->setGetVar($this->getGetVarPrefix().$campo, $format); + $l->setGetVar($this->getGetVarPrefix().$campo, $format); } - $this->addRowsData($link, array(), $lugar); + $this->addRowsData($l, array(), $lugar); } elseif ($activo === false) { - $img = new MECON_HTML_Image("/MECON/images/general_{$id}_des", '(-)'); - $img->updateAttributes(array('title' => ucfirst($id))); + $img = new MECON_HTML_Icon($id.'_des', null, '-', + array('title' => ucfirst($id))); $this->addRowsData($img, array(), $lugar); } else { $campos[] = $activo; @@ -682,17 +682,16 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { function MECON_HTML_TablaDB_callback_addRowsIcon($campos, $args) { list($tipo, $link, $activo) = $args; if ($campos[$activo]) { - $img = new MECON_HTML_Image("/MECON/images/general_$tipo", - '('.strtoupper($tipo{0}).')'); - $img->updateAttributes(array('title' => ucfirst($tipo))); - $link->addContents($img); + $img = new MECON_HTML_Icon($tipo, $link, null, + array('title' => ucfirst($tipo))); + $l = $img->getLink(); foreach ($campos as $campo => $valor) { - $link->setGetVar(MECON_HTML_TablaDB::getGetVarPrefix().$campo, $valor); + $l->setGetVar(MECON_HTML_TablaDB::getGetVarPrefix().$campo, $valor); } - return $link->toHtml(); + return $l->toHtml(); } else { - $img = new MECON_HTML_Image("/MECON/images/general_{$tipo}_des", '(-)'); - $img->updateAttributes(array('title' => ucfirst($tipo))); + $img = new MECON_HTML_Icon($tipo.'_des', null, '-', + array('title' => ucfirst($tipo))); return $img->toHtml(); } }