Make HTML paging usable.
This commit is contained in:
parent
e498e6325a
commit
3c4f4851a6
10
base.php
10
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']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
BIN
images/next.png
Normal file
BIN
images/next.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
images/previous.png
Normal file
BIN
images/previous.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -223,21 +223,24 @@
|
|||
$prevLink = $currentPage->getPrevLink ();
|
||||
$nextLink = $currentPage->getNextLink ();
|
||||
?>
|
||||
<div>
|
||||
<div class="foot">
|
||||
<div class="footcenter">
|
||||
<?php
|
||||
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
|
||||
}
|
||||
?>
|
||||
<p><?php echo " " . $currentPage->n . " / " . $currentPage->getMaxPage () . " " ?></p>
|
||||
<?php
|
||||
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
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
|
23
style.css
23
style.css
|
@ -12,7 +12,6 @@ background-color:lightgray;
|
|||
margin:auto;
|
||||
width:100%;
|
||||
max-width:800px;
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
.head
|
||||
|
@ -23,6 +22,15 @@ width:100%;
|
|||
height:64px;
|
||||
}
|
||||
|
||||
.foot
|
||||
{
|
||||
color:white;
|
||||
background-color:black;
|
||||
width:100%;
|
||||
height:32px;
|
||||
margin-top:8px;
|
||||
}
|
||||
|
||||
img
|
||||
{
|
||||
margin:0;
|
||||
|
@ -52,7 +60,18 @@ height:64px;
|
|||
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;
|
||||
vertical-align: middle;
|
||||
|
|
Loading…
Reference in a new issue