2013-06-20 14:06:02 +02:00
|
|
|
<?php
|
2014-02-18 18:42:00 +01:00
|
|
|
|
2013-08-22 17:17:58 +02:00
|
|
|
use Icinga\Web\Url;
|
2013-06-20 14:06:02 +02:00
|
|
|
|
2014-02-18 18:42:00 +01:00
|
|
|
// Please note that there is a reason for the strange way of writing ><.
|
|
|
|
// It was the best compromise that came to my mind to get rid of whitespaces
|
|
|
|
// between inline-block elements. Found no better hack - and table-cell seems
|
|
|
|
// to be less supported.
|
|
|
|
|
2013-07-12 13:40:21 +02:00
|
|
|
if ($this->pageCount <= 1) return;
|
|
|
|
|
2015-02-25 18:00:28 +01:00
|
|
|
?><p id="<?= $this->protectId('paginationlabel'); ?>" class="audible"><?= t('Pagination') ?></p>
|
|
|
|
<ul class="pagination" aria-labelledby="<?= $this->protectId('paginationlabel'); ?>" role="navigation"
|
2014-02-18 18:42:00 +01:00
|
|
|
<?php
|
|
|
|
|
2015-02-23 17:21:31 +01:00
|
|
|
$fromto = t('Show rows %u to %u out of %u');
|
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
|
|
|
|
);
|
2015-02-23 17:21:31 +01:00
|
|
|
$li = ' ><li%1$s><span class="audible">'
|
2014-06-20 14:27:17 +02:00
|
|
|
. t('Page')
|
2015-02-23 17:21:31 +01:00
|
|
|
. ' </span><a href="%2$s" aria-label="%3$s" title="%3$s">%4$s</a></li
|
2014-02-18 18:42:00 +01:00
|
|
|
';
|
2013-07-12 13:40:21 +02:00
|
|
|
|
2013-08-21 16:11:22 +02:00
|
|
|
?>
|
2013-06-20 14:06:02 +02:00
|
|
|
<?php
|
|
|
|
|
2014-02-18 18:42:00 +01:00
|
|
|
if (isset($this->previous)) {
|
|
|
|
printf(
|
|
|
|
$li,
|
|
|
|
'',
|
|
|
|
Url::fromRequest()->overwriteParams(
|
|
|
|
array('page' => $this->previous)
|
|
|
|
)->getAbsoluteUrl(),
|
|
|
|
$title_prev,
|
2014-05-27 23:48:05 +02:00
|
|
|
'« ' . t('Prev')
|
2014-02-18 18:42:00 +01:00
|
|
|
);
|
|
|
|
} else {
|
2014-05-27 23:48:05 +02:00
|
|
|
echo ' ><li class="disabled"><span>« ' . t('Prev') . '</span></li';
|
2014-02-18 18:42:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($this->pagesInRange as $page) {
|
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"' : '';
|
|
|
|
|
2014-02-18 18:42:00 +01:00
|
|
|
if ($page === '...') {
|
|
|
|
echo ' ><li class="disabled"><span>...</span></li';
|
|
|
|
} else {
|
|
|
|
printf(
|
|
|
|
$li,
|
|
|
|
$class,
|
|
|
|
Url::fromRequest()->overwriteParams(
|
|
|
|
array('page' => $page)
|
2014-06-20 14:27:17 +02:00
|
|
|
),
|
2014-02-18 18:42:00 +01:00
|
|
|
$title,
|
|
|
|
$page
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2014-03-06 13:08:11 +01:00
|
|
|
|
2014-02-18 18:42:00 +01:00
|
|
|
if (isset($this->next)) {
|
|
|
|
printf(
|
|
|
|
$li,
|
|
|
|
'',
|
|
|
|
Url::fromRequest()->overwriteParams(
|
|
|
|
array('page' => $this->next)
|
|
|
|
)->getAbsoluteUrl(),
|
|
|
|
$title_next,
|
2014-05-27 23:48:05 +02:00
|
|
|
t('Next') . ' »'
|
2014-02-18 18:42:00 +01:00
|
|
|
);
|
|
|
|
} else {
|
2014-05-27 23:48:05 +02:00
|
|
|
echo ' ><li class="disabled"><span>' . t('Next') . ' »</span></li';
|
2014-02-18 18:42:00 +01:00
|
|
|
}
|
|
|
|
|
2013-07-12 13:40:21 +02:00
|
|
|
?>
|
2014-02-18 18:42:00 +01:00
|
|
|
></ul>
|