From 3c4f4851a6b665d93d11d2959b8fac05d2fb2441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 11 Oct 2012 21:14:06 +0200 Subject: [PATCH] Make HTML paging usable. --- base.php | 10 +++++++++- images/next.png | Bin 0 -> 1111 bytes images/previous.png | Bin 0 -> 1138 bytes index.php | 9 ++++++--- style.css | 23 +++++++++++++++++++++-- 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 images/next.png create mode 100644 images/previous.png diff --git a/base.php b/base.php index abc4819..839e295 100644 --- a/base.php +++ b/base.php @@ -247,7 +247,9 @@ class Page public function isPaginated () { global $config; - return ($config['cops_max_item_per_page'] != -1 && $this->totalNumber != -1); + return ($config['cops_max_item_per_page'] != -1 && + $this->totalNumber != -1 && + $this->totalNumber > $config['cops_max_item_per_page']); } public function getNextLink () @@ -271,6 +273,12 @@ class Page } return NULL; } + + public function getMaxPage () + { + global $config; + return ceil ($this->totalNumber / $config['cops_max_item_per_page']); + } } diff --git a/images/next.png b/images/next.png new file mode 100644 index 0000000000000000000000000000000000000000..d258ec23e44bd96fd9819dde475bc50514f79f5e GIT binary patch literal 1111 zcmV-d1gQIoP)83>xRN(*M zUlFt|+6M01L=Z?8Es~N*iVW1!ERzDY%+ZC}Xp_#oi{Ytx@++Ukd+ofruJb!{yziMC z06-)XK_l_`d=7`x&{ka=8yhy8jlp2l@n|#}hr=P2N}Dat1OO(JX}8-~S64eaI%@ey zl2j^{4u`{JGBph-m&>J6Nw3#$Zf=f@jMM^@N+m9ryRx!kx7&X|u5Uo8R1%3qYinzZ zi;I=xq5zZ@78cgm*L!+;egj|ufYoXhi^T*%5Cj1L8jVJwP+VPI;W+-~lSm{Mi-q_j zp-^bGS`&#xJRWZhuvjc#07`v*ebdv^kw_$y$xuGASWE{H1i@yrO(s)&dwVb#q&lk! zn3hG7VT007;lR4UbKbubuwe}AtDFq_Sl0II3+ z@$rFyfj}UD<9H+zxxT(08yjnFZKc};0)g3VP9~GdWU@NIWHNPibyWf=_4f7}42Ebl zn$2cW6g@pXmCNNn8e+5AdcB^<3%jFu4MjXc<9v+It;@R05 zgTWXY8X`%OZc``}qobptPzb}YzW@egL2qKruZ*FdI91n-Xu~-a25H_1l zw{>=QPEAdvQmL1hmv4YxuWtyTB#}t8T5TW@z%cCf_0{L|O-xL*w6xGYEEY?v)siGh z?G6?I=yW=PK=2y?K@eOnS0DMxLgC=x;Q9HP`YDx4CnqN> zZJ|)e_(m97bRe0)4PIjJm1U%_$Q?RF;; ziTc&60Q`Qx-|wgIvr0fNmpeK-%H?tmtA7KiAzofy-rn9;^^qh=dGh)E{{BAw!qFH& zeVB5&T>VF;c4{;lrQV}W0LtZZJRbLYy>*f#NfwL6i;Ihf7ojTZ@9(dF^92AtpDz#y dnlAl6=szXHoEHLMXL5k literal 0 HcmV?d00001 diff --git a/images/previous.png b/images/previous.png new file mode 100644 index 0000000000000000000000000000000000000000..e41d47260deaba300033c1e615b0d7cc93065119 GIT binary patch literal 1138 zcmV-&1daQNP)BL}Biy(p`#6_)YQ;UL% zppS)7QB;eFenl->MAW8Tf1q94XdC4R>ZBbf+e(Fg#F-)6VjY!??727{pnN2ye9Y;3Hrum4T}Av8TbeR_IoHk&0$ zszxIS;`sP@etur&C>zYK)oS%gf7ib8`qGnI?*2eF22fh&BB!cAPfySO{(fg?XGs{(^XKR1i9`YbFbrElqq*B1Z`4GpcYueY?c)EGgr0)u23jeS69_)b%WV|I2afhs2Ilcd^jAIzi}LI zYinyf`ws{4c-&^Ql`{}R8jXhIH~`3GGCa>?7}mIe>;MA*mSqPA2URMS_!E*OA%p^f z0Q@%_ilW4Z5sgOOZZ`%1xm?cU@z6A_R;x=$-QC@yD9Vir27?G8`IiO-JRZ-#mb2OH z!^4BgWNK|~E#XlV)!N$1FpMaQ&(F`vWRj+7xy7{+i^aTN@86yZg7Eb8)YQ~uHk(VR z1VLCVmOvno&*$UuIKwbBO)Hhkx&l6*@5j(2Nn#i#lgUsNB}q~-Tc^|Y_4S29A&%oR znT*@*CP`AO)z%PreSP)&{S~$%7K=q95sIQP3@Z-!^XE^0fB)<2YdW3I<#H~UORv|r zx3||22m}I^*Y5rO-RJX>Bv~?cg+kHW+skoWJRTQCQEnPZk`)CKi3GziRri|bd9T-N zFc|cDeQ}s1Nmi@X>-FYxIRJ=8qlrYqVzD5E$_0YKV6DR`6bgYr03k#WL`m@D(^p-_k<$&yP-CX=C1sQzWLESpZJNs@%3)pWUB-vR)@ah%`p$8o%P?8#*E<>jTJ z(@&*REX#Ivb$yTB?RFOn0DvF}48y3^YJ;D;gv`vZfXrWN(^Yc?)2ax~l8iXWC(P)(8ID#Pjet$ln zuU5y)%L|U<9LKRN+j#!JAPA!F>l(wbuCA{Cll`~&2Z%Dv8RN+(RsaA107*qoM6N<$ Eg20ay`~Uy| literal 0 HcmV?d00001 diff --git a/index.php b/index.php index f69322d..37bfc37 100644 --- a/index.php +++ b/index.php @@ -223,21 +223,24 @@ $prevLink = $currentPage->getPrevLink (); $nextLink = $currentPage->getNextLink (); ?> -
+
+
- Prev + " alt="Previous" /> +

n . " / " . $currentPage->getMaxPage () . " " ?>

- Next + " alt="Next" /> +