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.
*/
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'];
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;
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();
}
}