Projekt

Obecné

Profil

Stáhnout (1.48 KB) Statistiky
| Větev: | Revize:
1
<?php
2

    
3
namespace Illuminate\Pagination;
4

    
5
trait BootstrapThreeNextPreviousButtonRendererTrait
6
{
7
    /**
8
     * Get the previous page pagination element.
9
     *
10
     * @param  string  $text
11
     * @return string
12
     */
13
    public function getPreviousButton($text = '&laquo;')
14
    {
15
        // If the current page is less than or equal to one, it means we can't go any
16
        // further back in the pages, so we will render a disabled previous button
17
        // when that is the case. Otherwise, we will give it an active "status".
18
        if ($this->paginator->currentPage() <= 1) {
19
            return $this->getDisabledTextWrapper($text);
20
        }
21

    
22
        $url = $this->paginator->url(
23
            $this->paginator->currentPage() - 1
24
        );
25

    
26
        return $this->getPageLinkWrapper($url, $text, 'prev');
27
    }
28

    
29
    /**
30
     * Get the next page pagination element.
31
     *
32
     * @param  string  $text
33
     * @return string
34
     */
35
    public function getNextButton($text = '&raquo;')
36
    {
37
        // If the current page is greater than or equal to the last page, it means we
38
        // can't go any further into the pages, as we're already on this last page
39
        // that is available, so we will make it the "next" link style disabled.
40
        if (! $this->paginator->hasMorePages()) {
41
            return $this->getDisabledTextWrapper($text);
42
        }
43

    
44
        $url = $this->paginator->url($this->paginator->currentPage() + 1);
45

    
46
        return $this->getPageLinkWrapper($url, $text, 'next');
47
    }
48
}
(4-4/13)