Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
45 / 45 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | /* |
| 3 | * This file is part of Aplus Framework Pagination Library. |
| 4 | * |
| 5 | * (c) Natan Felles <natanfelles@gmail.com> |
| 6 | * |
| 7 | * For the full copyright and license information, please view the LICENSE |
| 8 | * file that was distributed with this source code. |
| 9 | */ |
| 10 | /** |
| 11 | * @var Framework\Pagination\Pager $pager |
| 12 | */ |
| 13 | $language = $pager->getLanguage(); |
| 14 | $hasFirst = $pager->getCurrentPage() - $pager->getSurround() > 1; |
| 15 | $hasLast = $pager->getLastPage() |
| 16 | && $pager->getCurrentPage() + $pager->getSurround() < $pager->getLastPage(); |
| 17 | $hasPrev = $pager->getPreviousPage(); |
| 18 | ?> |
| 19 | <div class="text-center"> |
| 20 | <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px"> |
| 21 | <?php if ($hasFirst) : ?> |
| 22 | <a href="<?= $pager->getFirstPageUrl() ?>" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"> |
| 23 | <?= $language->render('pagination', 'first') ?> |
| 24 | </a> |
| 25 | <?php endif ?> |
| 26 | |
| 27 | <?php if ($hasPrev) : ?> |
| 28 | <a href="<?= $pager->getPreviousPageUrl() ?>" class="relative inline-flex items-center px-2 py-2<?= $hasFirst |
| 29 | ? '' |
| 30 | : ' rounded-l-md' ?> border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" title="<?= $pager->getLanguage() |
| 31 | ->render('pagination', 'previous') ?>"> |
| 32 | <span class="sr-only"><?= $pager->getLanguage() |
| 33 | ->render('pagination', 'previous') ?></span> |
| 34 | <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 35 | <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd"/> |
| 36 | </svg> |
| 37 | </a> |
| 38 | <?php endif ?> |
| 39 | |
| 40 | <?php foreach ($pager->getPreviousPagesUrls() as $p => $url) : ?> |
| 41 | <a href="<?= $url ?>" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium"> |
| 42 | <?= $p ?> |
| 43 | </a> |
| 44 | <?php endforeach ?> |
| 45 | |
| 46 | <a href="<?= $pager->getCurrentPageUrl() ?>" rel="canonical" aria-current="page" class="z-10 bg-indigo-50 border-indigo-500 text-indigo-600 relative inline-flex items-center px-4 py-2<?= $hasPrev |
| 47 | ? '' |
| 48 | : ' rounded-l-md' ?><?= $pager->getNextPage() ? '' |
| 49 | : ' rounded-r-md' ?> border text-sm font-medium"> |
| 50 | <?= $pager->getCurrentPage() ?> |
| 51 | </a> |
| 52 | |
| 53 | <?php foreach ($pager->getNextPagesUrls() as $p => $url) : ?> |
| 54 | <a href="<?= $url ?>" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium"> |
| 55 | <?= $p ?> |
| 56 | </a> |
| 57 | <?php endforeach ?> |
| 58 | |
| 59 | <?php if ($pager->getNextPage() && $pager->getNextPage() < $pager->getLastPage() + 1) : ?> |
| 60 | <a href="<?= $pager->getNextPageUrl() ?>" class="relative inline-flex items-center px-2 py-2<?= $hasLast |
| 61 | ? '' |
| 62 | : ' rounded-r-md' ?> border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" title="<?= $pager->getLanguage() |
| 63 | ->render('pagination', 'next') ?>"> |
| 64 | <span class="sr-only"><?= $pager->getLanguage() |
| 65 | ->render('pagination', 'next') ?></span> |
| 66 | <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 67 | <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"/> |
| 68 | </svg> |
| 69 | </a> |
| 70 | <?php endif ?> |
| 71 | |
| 72 | <?php if ($hasLast) : ?> |
| 73 | <a href="<?= $pager->getLastPageUrl() ?>" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"> |
| 74 | <?= $language->render('pagination', 'last') ?> |
| 75 | </a> |
| 76 | <?php endif ?> |
| 77 | </nav> |
| 78 | </div> |
| 79 |