Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 82862b2d

Přidáno uživatelem Jan Šedivý před téměř 6 roky(ů)

Re #7328 změna počtu výsledků na stránku

Zobrazit rozdíly:

app/utils/Paginator.php
3 3
namespace App\Utils;
4 4

  
5 5

  
6
use App\Enum\EPageLimit;
7

  
6 8
class Paginator
7 9
{
8 10

  
......
15 17
    private $startingPage;
16 18
    private $endingPage;
17 19

  
18
    const ALLOWED_LIMITS = [10, 25, 50, 100];
19

  
20 20
    /**
21 21
     * Implementation of spring Data Pageable to paginate and sort JPA queries
22 22
     * @param $page int query offset
......
30 30
        }
31 31
        $this->page = $page;
32 32

  
33
        foreach (self::ALLOWED_LIMITS as $l)
33
        foreach (EPageLimit::$limits as $l)
34 34
        {
35 35
            if ($l == $limit)
36 36
            {
......
39 39
        }
40 40
        if ($this->limit == 0)
41 41
        {
42
            $this->limit = self::ALLOWED_LIMITS[0];
42
            $this->limit = EPageLimit::$defaultLimit;
43 43
        }
44 44
    }
45 45

  
......
135 135
        $this->setPagesList();
136 136
    }
137 137

  
138
    public function getAllowedLimits()
139
    {
140
        return self::ALLOWED_LIMITS;
141
    }
142

  
143 138
    /**
144 139
     * Sets starting and ending page number to be displayed in template
145 140
     */

Také k dispozici: Unified diff