2013-06-20 14:06:02 +02:00
|
|
|
<?php
|
2013-08-22 17:17:58 +02:00
|
|
|
use Icinga\Web\Url;
|
2013-06-20 14:06:02 +02:00
|
|
|
|
2013-07-12 13:40:21 +02:00
|
|
|
if ($this->pageCount <= 1) return;
|
|
|
|
|
|
|
|
$fromto = $this->translate('%d to %d of %d');
|
2013-06-20 14:06:02 +02:00
|
|
|
$total = $this->totalItemCount;
|
2013-07-12 13:40:21 +02:00
|
|
|
$limit = $this->itemCountPerPage;
|
|
|
|
$title_prev = sprintf(
|
|
|
|
$fromto,
|
|
|
|
($this->current - 2) * $limit + 1,
|
|
|
|
($this->current - 1) * $limit,
|
|
|
|
$total
|
|
|
|
);
|
|
|
|
|
|
|
|
$title_next = sprintf(
|
|
|
|
$fromto,
|
|
|
|
($this->current) * $limit + 1,
|
|
|
|
($this->current + 1) * $limit,
|
|
|
|
$total
|
|
|
|
);
|
|
|
|
|
2013-08-21 16:11:22 +02:00
|
|
|
?>
|
2013-10-22 15:57:30 +02:00
|
|
|
<ul class="pagination">
|
2013-08-21 16:11:22 +02:00
|
|
|
<!-- Previous page link -->
|
|
|
|
|
2013-07-12 13:40:21 +02:00
|
|
|
<?php if (isset($this->previous)): ?>
|
2013-08-22 17:17:58 +02:00
|
|
|
<li>
|
|
|
|
<a href="<?= Url::fromRequest()->overwriteParams(array('page' => $this->previous))->getAbsoluteUrl() ?>"
|
|
|
|
title="<?= $title_prev ?>">« <?= $this->translate('Prev') ?>
|
|
|
|
</a>
|
|
|
|
</li>
|
2013-07-12 13:40:21 +02:00
|
|
|
<?php else: ?>
|
2013-08-22 17:17:58 +02:00
|
|
|
<li class="disabled"><span>« <?= $this->translate('Prev') ?></span></li>
|
2013-07-12 13:40:21 +02:00
|
|
|
<?php endif ?>
|
2013-08-21 16:11:22 +02:00
|
|
|
|
2013-06-20 14:06:02 +02:00
|
|
|
<!-- Numbered page links -->
|
|
|
|
<?php
|
2013-07-12 13:40:21 +02:00
|
|
|
foreach ($this->pagesInRange as $page):
|
2013-06-20 14:06:02 +02:00
|
|
|
|
2013-07-12 13:40:21 +02:00
|
|
|
$start = ($page - 1) * $limit + 1;
|
|
|
|
$end = $page * $limit;
|
|
|
|
if ($end > $total) {
|
|
|
|
$end = $total;
|
|
|
|
}
|
|
|
|
$title = sprintf($fromto, $start, $end, $total);
|
|
|
|
$class = $page === $this->current ? ' class="active"' : '';
|
|
|
|
|
|
|
|
if ($page === '...'): ?>
|
2013-06-20 14:06:02 +02:00
|
|
|
<li class="disabled"><span>...</span></li>
|
|
|
|
<?php else: ?>
|
2013-08-21 16:11:22 +02:00
|
|
|
<li <?= $class ?>>
|
2013-08-22 17:17:58 +02:00
|
|
|
<a href="<?= Url::fromRequest()->overwriteParams(array('page' => $page))->getAbsoluteUrl() ?>" title="<?= $title ?>">
|
2013-08-21 16:11:22 +02:00
|
|
|
<?= $page ?>
|
|
|
|
</a>
|
|
|
|
</li>
|
2013-07-12 13:40:21 +02:00
|
|
|
<?php
|
|
|
|
endif;
|
|
|
|
endforeach;
|
|
|
|
?>
|
2013-06-20 14:06:02 +02:00
|
|
|
<!-- Next page link -->
|
|
|
|
<? if (isset($this->next)): ?>
|
2013-08-22 17:17:58 +02:00
|
|
|
<li>
|
|
|
|
<a href="<?= Url::fromRequest()->overwriteParams(array('page' => $this->next))->getAbsoluteUrl() ?>"
|
|
|
|
title="<?= $title_next ?>"><?= t('Next') ?> »
|
|
|
|
</a>
|
|
|
|
</li>
|
2013-06-20 14:06:02 +02:00
|
|
|
<? else: ?>
|
2013-08-21 16:11:22 +02:00
|
|
|
<li class="disabled"><span><?= t('Next') ?> »</span></li>
|
2013-06-20 14:06:02 +02:00
|
|
|
<? endif ?>
|
2013-08-21 16:11:22 +02:00
|
|
|
</ul>
|