summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/mixedPagination.phtml
blob: e92a9c92c78611e17d2fa8b6d11d4038f1930d4a (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php if ($this->pageCount <= 1) return; ?>
<div class="pagination-control" role="navigation">
    <h2 id="<?= $this->protectId('pagination') ?>" class="sr-only" tabindex="-1"><?= $this->translate('Pagination') ?></h2>
    <ul class="nav tab-nav">
    <?php if (isset($this->previous)): ?>
        <?php $label = sprintf(
            $this->translate('Show rows %u to %u of %u'),
            ($this->current - 2) * $this->itemCountPerPage + 1,
            ($this->current - 1) * $this->itemCountPerPage,
            $this->totalItemCount
        ) ?>
        <li class="nav-item">
            <a  href="<?= $this->escape($this->url()->overwriteParams(array('page' => $this->previous))->getAbsoluteUrl()) ?>"
                title="<?= $label ?>"
                aria-label="<?= $label ?>"
                class="previous-page">
                <?= $this->icon('angle-double-left') ?>
            </a>
        </li>
    <?php else: ?>
        <li class="nav-item disabled" aria-hidden="true">
            <span class="previous-page">
                <span class="sr-only"><?= $this->translate('Previous page') ?></span>
                <?= $this->icon('angle-double-left') ?>
            </span>
        </li>
    <?php endif ?>
    <?php foreach ($this->pagesInRange as $page): ?>
        <?php if ($page === '...'): ?>
            <li class="nav-item disabled">
                <span>...</span>
            </li>
        <?php else: ?>
            <?php
            $end = $page * $this->itemCountPerPage;
            if ($end > $this->totalItemCount) {
                $end = $this->totalItemCount;
            }
            $label = sprintf(
                $this->translate('Show rows %u to %u of %u'),
                ($page - 1) * $this->itemCountPerPage + 1,
                $end,
                $this->totalItemCount
            );
            ?>
            <li<?= $page === $this->current ? ' class="active nav-item"' : ' class="nav-item"' ?>>
                <a  href="<?= $this->escape($this->url()->overwriteParams(array('page' => $page))->getAbsoluteUrl()) ?>"
                    title="<?= $label ?>"
                    aria-label="<?= $label ?>">
                    <?= $page ?>
                </a>
            </li>
        <?php endif ?>
    <?php endforeach ?>
    <?php if (isset($this->next)): ?>
        <?php $label = sprintf(
            $this->translate('Show rows %u to %u of %u'),
            $this->current * $this->itemCountPerPage + 1,
            ($this->current + 1) * $this->itemCountPerPage,
            $this->totalItemCount
        ) ?>
        <li class="nav-item">
            <a  href="<?= $this->escape($this->url()->overwriteParams(array('page' => $this->next))->getAbsoluteUrl()) ?>"
                title="<?= $label ?>"
                aria-label="<?= $label ?>"
                class="next-page">
                <?= $this->icon('angle-double-right') ?>
            </a>
        </li>
    <?php else: ?>
        <li class="disabled nav-item" aria-hidden="true">
            <span class="next-page">
                <span class="sr-only"><?= $this->translate('Next page') ?></span>
                <?= $this->icon('angle-double-right') ?>
            </span>
        </li>
    <?php endif ?>
    </ul>
</div>