Make HTML paging usable.

This commit is contained in:
Sébastien Lucas 2012-10-11 21:14:06 +02:00
parent e498e6325a
commit 3c4f4851a6
5 changed files with 36 additions and 6 deletions

View file

@ -247,7 +247,9 @@ class Page
public function isPaginated () public function isPaginated ()
{ {
global $config; 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 () public function getNextLink ()
@ -272,6 +274,12 @@ class Page
return NULL; return NULL;
} }
public function getMaxPage ()
{
global $config;
return ceil ($this->totalNumber / $config['cops_max_item_per_page']);
}
} }
class PageAllAuthors extends Page class PageAllAuthors extends Page

BIN
images/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/previous.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -223,21 +223,24 @@
$prevLink = $currentPage->getPrevLink (); $prevLink = $currentPage->getPrevLink ();
$nextLink = $currentPage->getNextLink (); $nextLink = $currentPage->getNextLink ();
?> ?>
<div> <div class="foot">
<div class="footcenter">
<?php <?php
if (!is_null ($prevLink)) { if (!is_null ($prevLink)) {
?> ?>
<a href="<?php echo $prevLink->hrefXhtml () ?>" >Prev</a> <a href="<?php echo $prevLink->hrefXhtml () ?>" ><img src="<?php echo getUrlWithVersion("images/previous.png") ?>" alt="Previous" /></a>
<?php <?php
} }
?> ?>
<p><?php echo "&nbsp;" . $currentPage->n . " / " . $currentPage->getMaxPage () . "&nbsp;" ?></p>
<?php <?php
if (!is_null ($nextLink)) { if (!is_null ($nextLink)) {
?> ?>
<a href="<?php echo $nextLink->hrefXhtml () ?>" >Next</a> <a href="<?php echo $nextLink->hrefXhtml () ?>" ><img src="<?php echo getUrlWithVersion("images/next.png") ?>" alt="Next" /></a>
<?php <?php
} }
?> ?>
</div>
</div> </div>
<?php <?php
} }

View file

@ -12,7 +12,6 @@ background-color:lightgray;
margin:auto; margin:auto;
width:100%; width:100%;
max-width:800px; max-width:800px;
background-color:white;
} }
.head .head
@ -23,6 +22,15 @@ width:100%;
height:64px; height:64px;
} }
.foot
{
color:white;
background-color:black;
width:100%;
height:32px;
margin-top:8px;
}
img img
{ {
margin:0; margin:0;
@ -52,7 +60,18 @@ height:64px;
display:table; display:table;
} }
.headcenter p .footcenter
{
margin:auto;
text-align:center;
font-size: 1.3em;
font-weight:bold;
height:32px;
display:table;
}
.headcenter p, .footcenter p, .footcenter a
{ {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;