aboutsummaryrefslogtreecommitdiff
path: root/templates/pagination/buttons.php
blob: 9bfd0bdc571d52687988b354d28c9216b4e4b797 (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
<p id="pagination-label-<?= $random_id ?>" class="audible">
    <?= _('Blättern') ?>
</p>

<ul class="pagination" role="navigation" aria-labelledby="pagination-label-<?= $random_id ?>">
<? // Create link to last page if we are not on the first page ?>
<? if ($current > 0): ?>
    <li class="prev">
        <button class="pagination--link" name="<?= htmlReady($name) ?>" value="<?= $current - 1 ?>" <? if ($dialog !== null) echo "data-dialog=\"{$dialog}\""; ?>>
            <span class="audible"><?= _('Eine Seite') ?></span>
            <?= _('zurück') ?>
        </button>
    </li>
<? endif; ?>

<? // Create individual pages (with divider for gaps) ?>
<? $last_page = -1; ?>

<? foreach ($pages as $page): ?>
<? if ($page != $last_page + 1): ?>
    <li class="divider" data-skipped="<?= $last_page + 1 ?>-<?= $page - 1 ?>">&hellip;</li>
<? endif; ?>

    <li <? if ($page == $current) echo 'class="current"'; ?>>
        <button class="pagination--link" name="<?= htmlReady($name) ?>" value="<?= $page ?>" <? if ($dialog !== null) echo "data-dialog=\"{$dialog}\""; ?>>
            <span class="audible"><?= _('Seite') ?></span>
            <?= $page + 1 ?>
        </button>
    </li>
<?
    $last_page = $page;
    endforeach;
?>

<? // Create link to next page if we are not on the last page ?>
<? if ($current < $count - 1): ?>
    <li class="next">
        <button class="pagination--link" name="<?= htmlReady($name) ?>" value="<?= $current + 1 ?>" <? if ($dialog !== null) echo "data-dialog=\"{$dialog}\""; ?>>
            <span class="audible"><?= _('Eine Seite') ?></span>
            <?= _('weiter') ?>
        </button>
    </li>
<? endif; ?>
</ul>