summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/pivottablePagination.phtml
blob: ce180146e58c2d0d9b1c9b910e11e8e584ded302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

use Icinga\Web\Url;

if ($xAxisPaginator->count() <= 1 && $yAxisPaginator->count() <= 1) {
    return; // Display this pagination only if there are multiple pages
}

$fromTo = t('%s: %d to %d of %d (on the %s-axis)');
$xAxisPages = $xAxisPaginator->getPages('all');
$yAxisPages = $yAxisPaginator->getPages('all');

?>

<div class="pivot-pagination">
    <span><?= t('Navigation'); ?></span>
    <table>
        <tbody>
<?php foreach ($yAxisPages->pagesInRange as $yAxisPage): ?>
            <tr>
<?php foreach ($xAxisPages->pagesInRange as $xAxisPage): ?>
                <td<?= $xAxisPage === $xAxisPages->current && $yAxisPage === $yAxisPages->current ? ' class="active"' : ''; ?>>
<?php if ($xAxisPage !== $xAxisPages->current || $yAxisPage !== $yAxisPages->current): ?>
                    <a href="<?= Url::fromRequest()->overwriteParams(
                        array('page' => $xAxisPage . ',' . $yAxisPage)
                    )->getAbsoluteUrl(); ?>" title="<?= sprintf(
                        $fromTo,
                        t('Hosts'),
                        ($yAxisPage - 1) * $yAxisPages->itemCountPerPage + 1,
                        $yAxisPage === $yAxisPages->last ? $yAxisPages->totalItemCount : $yAxisPage * $yAxisPages->itemCountPerPage,
                        $yAxisPages->totalItemCount,
                        'y'
                    ) . '; ' . sprintf(
                        $fromTo,
                        t('Services'),
                        ($xAxisPage - 1) * $xAxisPages->itemCountPerPage + 1,
                        $xAxisPage === $xAxisPages->last ? $xAxisPages->totalItemCount : $xAxisPage * $xAxisPages->itemCountPerPage,
                        $xAxisPages->totalItemCount,
                        'x'
                    ); ?>"></a>
<?php endif ?>
                </td>
<?php endforeach ?>
            </tr>
<?php endforeach ?>
        </tbody>
    </table>
</div>