pics/templates/Pagination.php
Aaron van Geffen ab0e4efbcb Initial commit.
This is to be the new HashRU website based on the Aaronweb.net/Kabuki CMS.
2017-11-09 17:00:22 +01:00

45 lines
1.4 KiB
PHP

<?php
/*****************************************************************************
* Pagination.php
* Contains the pagination template.
*
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
*****************************************************************************/
class Pagination extends SubTemplate
{
private $index;
public function __construct(PageIndex $index)
{
$this->index = $index->getPageIndex();
$this->class = $index->getPageIndexClass();
}
protected function html_content()
{
echo '
<div class="table_pagination', !empty($this->class) ? ' ' . $this->class : '', '">
<ul>
<li class="first"><', !empty($this->index['previous']) ? 'a href="' . $this->index['previous']['href'] . '"' : 'span', '>&laquo; previous</', !empty($this->index['previous']) ? 'a' : 'span', '></li>';
foreach ($this->index as $key => $page)
{
if (!is_numeric($key))
continue;
if (!is_array($page))
echo '
<li class="page-padding"><span>...</span></li>';
else
echo '
<li class="page-number', $page['is_selected'] ? ' active' : '', '"><a href="', $page['href'], '">', $page['index'], '</a></li>';
}
echo '
<li class="last"><', !empty($this->index['next']) ? 'a href="' . $this->index['next']['href'] . '"' : 'span', '>next &raquo;</', !empty($this->index['next']) ? 'a' : 'span', '></li>
</ul>
</div>';
}
}