From 037b02c8a661b8c691943edd5560caac59a6abf9 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 16 Nov 2008 20:45:55 +0100 Subject: [PATCH] Should fix the calculation of the number of pages on X.net events admin page (Closes #751) Grumpf, obfuscated code! (not sure this fix all cases, please test if possible). Signed-off-by: Florent Bruneau --- ChangeLog | 3 +++ modules/xnetevents.php | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05b5bb4..07f081b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,9 @@ Bug/Wish: * Lists: - #927: Can export the list of members as a CSV file -FRU + * XnetEvents: + - #751: Fix calculation of the number of pages -FRU + * XnetList: - #914: Adds a toggle button in the ML/directory sync. page -JAC diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 69f0b28..21d8435 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -653,19 +653,19 @@ class XnetEventsModule extends PLModule ORDER BY nom, prenom, promo", $evt['eid']); $ofs = Env::i('offset'); - $tot = (Env::v('initiale') ? $tot : $nb_tot) - $absents->total(); - $nbp = intval(($tot-1)/NB_PER_PAGE); - $links = array(); - if ($ofs) { - $links['précédent'] = $ofs-1; - } - for ($i = 0; $i <= $nbp; $i++) { - $links[(string)($i+1)] = $i; - } - if ($ofs < $nbp) { - $links['suivant'] = $ofs+1; - } - if (count($links)>1) { + $tot = (Env::v('initiale') ? $tot : $nb_tot); + $nbp = ceil($tot / NB_PER_PAGE); + if ($nbp > 1) { + $links = array(); + if ($ofs) { + $links['précédent'] = $ofs - 1; + } + for ($i = 1 ; $i <= $nbp; $i++) { + $links[(string)$i] = $i - 1; + } + if ($ofs < $nbp) { + $links['suivant'] = $ofs+1; + } $page->assign('links', $links); } -- 2.1.4