1 |
cb15593b
|
Cajova-Houba
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace Illuminate\Pagination;
|
4 |
|
|
|
5 |
|
|
trait UrlWindowPresenterTrait
|
6 |
|
|
{
|
7 |
|
|
/**
|
8 |
|
|
* Render the actual link slider.
|
9 |
|
|
*
|
10 |
|
|
* @return string
|
11 |
|
|
*/
|
12 |
|
|
protected function getLinks()
|
13 |
|
|
{
|
14 |
|
|
$html = '';
|
15 |
|
|
|
16 |
|
|
if (is_array($this->window['first'])) {
|
17 |
|
|
$html .= $this->getUrlLinks($this->window['first']);
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
if (is_array($this->window['slider'])) {
|
21 |
|
|
$html .= $this->getDots();
|
22 |
|
|
$html .= $this->getUrlLinks($this->window['slider']);
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
if (is_array($this->window['last'])) {
|
26 |
|
|
$html .= $this->getDots();
|
27 |
|
|
$html .= $this->getUrlLinks($this->window['last']);
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
return $html;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
/**
|
34 |
|
|
* Get the links for the URLs in the given array.
|
35 |
|
|
*
|
36 |
|
|
* @param array $urls
|
37 |
|
|
* @return string
|
38 |
|
|
*/
|
39 |
|
|
protected function getUrlLinks(array $urls)
|
40 |
|
|
{
|
41 |
|
|
$html = '';
|
42 |
|
|
|
43 |
|
|
foreach ($urls as $page => $url) {
|
44 |
|
|
$html .= $this->getPageLinkWrapper($url, $page);
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
return $html;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
/**
|
51 |
|
|
* Get HTML wrapper for a page link.
|
52 |
|
|
*
|
53 |
|
|
* @param string $url
|
54 |
|
|
* @param int $page
|
55 |
|
|
* @param string|null $rel
|
56 |
|
|
* @return string
|
57 |
|
|
*/
|
58 |
|
|
protected function getPageLinkWrapper($url, $page, $rel = null)
|
59 |
|
|
{
|
60 |
|
|
if ($page == $this->paginator->currentPage()) {
|
61 |
|
|
return $this->getActivePageWrapper($page);
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
return $this->getAvailablePageWrapper($url, $page, $rel);
|
65 |
|
|
}
|
66 |
|
|
}
|