X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/8266508aec785b49328716a9a95ac22a8735a3cc..c0cc0ddabd54d39b68079ef97f414b799211aa67:/lib/MECON/HTML/TablaDB.php?ds=sidebyside diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index 0378f96..6852ba9 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -26,8 +26,10 @@ $Id$ require_once 'DB.php'; 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. @@ -144,7 +146,10 @@ 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 = new MECON_DB_Pager($result, @$_GET[$this->getGetVarPrefix().$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) { $link = @$_SERVER['PHP_SELF']; @@ -637,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; @@ -678,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(); } }