fix pagination back links

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-04 12:19:40 +01:00
parent 7b28a33aba
commit 30d64973c3
3 changed files with 145 additions and 143 deletions

View File

@@ -2,6 +2,8 @@
namespace Froxlor\UI; namespace Froxlor\UI;
use Froxlor\Settings;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
@@ -115,7 +117,7 @@ class Collection
} }
// Prepare pagination // Prepare pagination
$this->pagination = new Pagination($this->userinfo, $sortableColumns, $this->count()); $this->pagination = new Pagination($sortableColumns, $this->count(), (int) Settings::Get('panel.paging'));
$this->params = array_merge($this->params, $this->pagination->getApiCommandParams()); $this->params = array_merge($this->params, $this->pagination->getApiCommandParams());
return $this; return $this;

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace Froxlor\UI; namespace Froxlor\UI;
use Froxlor\Settings; use Froxlor\Settings;
@@ -47,12 +48,11 @@ class Pagination
/** /**
* Create new pagination object to search/filter, limit and sort Api-listing() calls * Create new pagination object to search/filter, limit and sort Api-listing() calls
* *
* @param array $userinfo
* @param array $fields * @param array $fields
* @param int $total_entries * @param int $total_entries
* @param int $perPage * @param int $perPage
*/ */
public function __construct(array $userinfo, array $fields = array(), int $total_entries = 0, int $perPage = 20) public function __construct(array $fields = array(), int $total_entries = 0, int $perPage = 20)
{ {
$this->fields = $fields; $this->fields = $fields;
$this->entries = $total_entries; $this->entries = $total_entries;

View File

@@ -1,10 +1,10 @@
{% macro paging(pagination) %} {% macro paging(pagination) %}
{% if pagination.last_page > 1 %} {% if pagination.last_page > 1 %}
<div class="card-footer border-top"> <div class="card-footer border-top">
{% if pagination.current_page >= pagination.last_page %} {% if pagination.current_page > 2 %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1">&laquo;</a> <a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1">&laquo;</a>
{% endif %} {% endif %}
{% if pagination.current_page >= pagination.last_page %} {% if pagination.current_page > 1 %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}">&lsaquo;</a> <a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}">&lsaquo;</a>
{% endif %} {% endif %}
{% if pagination.current_page < pagination.last_page %} {% if pagination.current_page < pagination.last_page %}