From 9b5c1712c4bf5625c51b4602865122ed05a47457 Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Tue, 26 Jan 2021 13:20:05 +0100 Subject: [PATCH] refs #18917 [finc] show pagination only if there are minimum 2 pages * add finc template --- themes/finc/templates/search/pagination.phtml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 themes/finc/templates/search/pagination.phtml diff --git a/themes/finc/templates/search/pagination.phtml b/themes/finc/templates/search/pagination.phtml new file mode 100644 index 00000000000..25a0b4e96e5 --- /dev/null +++ b/themes/finc/templates/search/pagination.phtml @@ -0,0 +1,45 @@ +<!-- finc - templates - search - pagination --> +<?php if ($this->pageCount > 1): ?> + <ul class="pagination" aria-label="<?=$this->transEsc('pagination_label')?>"> + <?php if (isset($this->previous)): ?> + <?php if (!isset($this->options['disableFirst']) || !$this->options['disableFirst']): ?> + <li role="none"> + <a href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage(1)?>" aria-label="<?=$this->transEsc('page_first')?>">[1]</a> + </li> + <?php endif; ?> + <li role="none"> + <a class="page-prev" href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($this->previous)?>" aria-label="<?=$this->transEsc('page_prev')?>"> + <i class="fa fa-angle-left" aria-hidden="true"></i> + <?=$this->transEsc('Prev')?> + </a> + </li> + <?php endif; ?> + + <?php if (count($this->pagesInRange) > 1): ?> + <?php foreach ($this->pagesInRange as $page): ?> + <?php if ($page != $this->current): ?> + <li role="none"> + <a href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($page)?>" aria-label="<?=$this->transEsc('page_no', ['%%page%%' => $page])?>"><?=$page?></a> + </li> + <?php else: ?> + <li role="none" class="active" aria-current="page"><span><?=$page?></span></li> + <?php endif; ?> + <?php endforeach; ?> + <?php endif; ?> + + <?php if (isset($this->next)): ?> + <li role="none"> + <a class="page-next" href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($this->next)?>" aria-label="<?=$this->transEsc('page_next')?>"> + <?=$this->transEsc('Next');?> + <i class="fa fa-angle-right" aria-hidden="true"></i> + </a> + </li> + <?php if (!isset($this->options['disableLast']) || !$this->options['disableLast']): ?> + <li role="none"> + <a href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($this->pageCount)?>" aria-label="<?=$this->transEsc('page_last')?>">[<?=$this->pageCount?>]</a> + </li> + <?php endif; ?> + <?php endif; ?> + </ul> +<?php endif; ?> +<!-- finc - templates - search - pagination - END --> -- GitLab