From d1f0573418f428c661982f36c42c6af3388c3ee1 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 4 May 2005 20:59:08 +0000 Subject: [PATCH] =?utf8?q?Bugfix=20(se=20imprim=C3=ADan=20los=20\n=20textu?= =?utf8?q?ales)=20y=20se=20pone=20$link=20al=20principio=20porque=20es=20c?= =?utf8?q?asi=20mandatorio.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/lib/listador.php | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/lib/listador.php b/src/lib/listador.php index 9d42231..609d6d2 100644 --- a/src/lib/listador.php +++ b/src/lib/listador.php @@ -8,40 +8,48 @@ // // $Id$ +function printfl() +{ + $args = func_get_args(); + $args[0] .= "\n"; + call_user_func_array('printf', $args); +} + /** * Listador genérico de ítems. Usa las variables de GET lista_from. */ -function listar($item, $summary = null, $caption = null, $cant = 15, $link = '') +function listar($item, $link = '', $summary = null, $caption = null, $cant = 15) { if (!$summary) $summary = 'Listado de ' . get_class($item) . 's'; - printf('\n', $summary); - if ($caption) printf(' \n', $caption); - printf(' \n'); - printf(' \n'); + printfl('
%s
', $summary); + if ($caption) printfl(' ', $caption); + printfl(' '); + printfl(' '); foreach ($item->getHeaderArray() as $header) - printf(' \n', $header); - printf(' \n'); - printf(' \n'); - printf(' \n'); + printfl(' ', $header); + printfl(' '); + printfl(' '); + printfl(' '); $total = $item->getTotal(); $from = intval(@$_GET["lista_from"]); $c = min($total - $from, $cant); $item->seek($from); while ($item->next() and $c--) { - printf(' \n'); - foreach ($item->asArray() as $i) printf(' \n', $i); - printf(' \n'); + printfl(' '); + foreach ($item->asArray() as $i) printfl(' ', $i); + printfl(' '); } - printf(' \n'); - printf('
%s
%s
%s
%s
%s
\n'); - printf('\n'); + printfl(' '); + printfl('
'); + printfl(''); $pags = ceil($total / $cant); + if ($pags == 1) return; // Si tengo una sóla página, para qué el paginador? for ($i = 0; $i < $pags; ++$i) { - printf('\n', $link, $i * $cant, $i + 1); + printfl('', $link, $i * $cant, $i + 1); } - printf('
%s%s
\n'); + printfl(''); } ?> \ No newline at end of file -- 2.43.0