2009-12-18 12:56:12 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2014-08-18 19:53:40 +00:00
|
|
|
* Displays page navigation for any list that has pagination turned on
|
|
|
|
*
|
|
|
|
* @copyright 2007-2013 City of Bloomington, Indiana
|
2011-06-14 13:29:37 +00:00
|
|
|
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
|
2009-12-18 12:56:12 +00:00
|
|
|
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
2014-08-18 19:53:40 +00:00
|
|
|
* @param Zend\Paginator $this->paginator
|
2009-12-18 12:56:12 +00:00
|
|
|
*/
|
2014-08-18 19:53:40 +00:00
|
|
|
use Blossom\Classes\Url;
|
|
|
|
|
|
|
|
if ($this->paginator->count() > 1) {
|
|
|
|
$pages = $this->paginator->getPages();
|
|
|
|
|
|
|
|
$url = new Url($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
2009-12-18 12:56:12 +00:00
|
|
|
$url->purgeEmptyParameters();
|
|
|
|
|
|
|
|
echo '<ul class="pageNavigation">';
|
|
|
|
|
|
|
|
// Show the Back button
|
2014-08-18 19:53:40 +00:00
|
|
|
if (isset($pages->previous)) {
|
|
|
|
$url->page = $pages->first;
|
2009-12-18 12:56:12 +00:00
|
|
|
echo "<li><a href=\"$url\" class=\"first\">First</a></li>";
|
|
|
|
|
2014-08-18 19:53:40 +00:00
|
|
|
$url->page = $pages->previous;
|
2009-12-18 12:56:12 +00:00
|
|
|
echo "<li><a href=\"$url\" class=\"previous\">Back</a></li>";
|
|
|
|
}
|
|
|
|
// Show the page number links
|
|
|
|
// Show only $maxNumLinks pages at a time
|
2014-08-18 19:53:40 +00:00
|
|
|
foreach ($pages->pagesInRange as $page) {
|
2009-12-18 12:56:12 +00:00
|
|
|
$url->page = $page;
|
2014-08-18 19:53:40 +00:00
|
|
|
$class = ($page == $pages->current) ? 'class="current"' : '';
|
2009-12-18 12:56:12 +00:00
|
|
|
echo "<li><a href=\"$url\" $class>$page</a></li>";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show the Next button
|
2014-08-18 19:53:40 +00:00
|
|
|
if (isset($pages->next)) {
|
|
|
|
$url->page = $pages->next;
|
2009-12-18 12:56:12 +00:00
|
|
|
echo "<li><a href=\"$url\" class=\"next\">Next</a></li>";
|
|
|
|
|
2014-08-18 19:53:40 +00:00
|
|
|
$url->page = $pages->last;
|
2009-12-18 12:56:12 +00:00
|
|
|
echo "<li><a href=\"$url\" class=\"last\">Last</a></li>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</ul>';
|
|
|
|
}
|