1 |
cb15593b
|
Cajova-Houba
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace Illuminate\Pagination;
|
4 |
|
|
|
5 |
|
|
use Illuminate\Support\HtmlString;
|
6 |
|
|
use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
|
7 |
|
|
|
8 |
|
|
class SimpleBootstrapThreePresenter extends BootstrapThreePresenter
|
9 |
|
|
{
|
10 |
|
|
/**
|
11 |
|
|
* Create a simple Bootstrap 3 presenter.
|
12 |
|
|
*
|
13 |
|
|
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
|
14 |
|
|
* @return void
|
15 |
|
|
*/
|
16 |
|
|
public function __construct(PaginatorContract $paginator)
|
17 |
|
|
{
|
18 |
|
|
$this->paginator = $paginator;
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* Determine if the underlying paginator being presented has pages to show.
|
23 |
|
|
*
|
24 |
|
|
* @return bool
|
25 |
|
|
*/
|
26 |
|
|
public function hasPages()
|
27 |
|
|
{
|
28 |
|
|
return $this->paginator->hasPages() && count($this->paginator->items()) > 0;
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* Convert the URL window into Bootstrap HTML.
|
33 |
|
|
*
|
34 |
|
|
* @return \Illuminate\Support\HtmlString
|
35 |
|
|
*/
|
36 |
|
|
public function render()
|
37 |
|
|
{
|
38 |
|
|
if ($this->hasPages()) {
|
39 |
|
|
return new HtmlString(sprintf(
|
40 |
|
|
'<ul class="pager">%s %s</ul>',
|
41 |
|
|
$this->getPreviousButton(),
|
42 |
|
|
$this->getNextButton()
|
43 |
|
|
));
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
return '';
|
47 |
|
|
}
|
48 |
|
|
}
|