Add basing pagin support in HTML catalog
This commit is contained in:
parent
96312d71cf
commit
be4bcf3e9f
22
base.php
22
base.php
|
@ -242,6 +242,28 @@ class Page
|
|||
$this->entryArray = array_merge ($this->entryArray, Book::getCount());
|
||||
}
|
||||
|
||||
public function getNextLink ()
|
||||
{
|
||||
global $config;
|
||||
$currentUrl = $_SERVER['QUERY_STRING'];
|
||||
$currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . $_SERVER['QUERY_STRING']);
|
||||
if (($this->n) * $config['cops_max_item_per_page'] < $this->totalNumber) {
|
||||
return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", "Page suivante");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function getPrevLink ()
|
||||
{
|
||||
global $config;
|
||||
$currentUrl = $_SERVER['QUERY_STRING'];
|
||||
$currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . $_SERVER['QUERY_STRING']);
|
||||
if ($this->n > 1) {
|
||||
return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", "Page precedente");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PageAllAuthors extends Page
|
||||
|
|
24
index.php
24
index.php
|
@ -218,6 +218,30 @@
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if ($config['cops_max_item_per_page'] != -1 && $currentPage->totalNumber != -1) {
|
||||
$prevLink = $currentPage->getPrevLink ();
|
||||
$nextLink = $currentPage->getNextLink ();
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
if (!is_null ($prevLink)) {
|
||||
?>
|
||||
<a href="<?php echo $prevLink->hrefXhtml () ?>" >Prev</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (!is_null ($nextLink)) {
|
||||
?>
|
||||
<a href="<?php echo $nextLink->hrefXhtml () ?>" >Next</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue