45 lines
1.4 KiB
PHP
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', '>« 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 »</', !empty($this->index['next']) ? 'a' : 'span', '></li>
|
||
|
</ul>
|
||
|
</div>';
|
||
|
}
|
||
|
}
|