Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
57d62f55
Commit
57d62f55
authored
Sep 29, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on the pain in the rear paginator class.
parent
d2f30156
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
paginator.php
laravel/paginator.php
+20
-14
No files found.
laravel/paginator.php
View file @
57d62f55
...
...
@@ -51,6 +51,13 @@ class Paginator {
*/
public
$append
=
array
();
/**
* The format that will be used to wrap the entire pagination string.
*
* @var string
*/
protected
$wrapper
=
'<div class="pagination">%s</div>'
;
/**
* Create a new Paginator instance.
*
...
...
@@ -96,7 +103,7 @@ class Paginator {
*/
public
static
function
page
(
$total
,
$per_page
)
{
$page
=
I
nput
::
get
(
'page'
,
1
);
$page
=
I
oC
::
container
()
->
core
(
'input'
)
->
get
(
'page'
,
1
);
if
(
is_numeric
(
$page
)
and
$page
>
$last_page
=
ceil
(
$total
/
$per_page
))
{
...
...
@@ -112,22 +119,17 @@ class Paginator {
* @param int $adjacent
* @return string
*/
public
function
links
(
$adjacent
=
3
)
public
function
links
(
$adjacent
=
4
)
{
if
(
$this
->
last_page
<=
1
)
return
''
;
// The hard-coded "7" is to account for all of the constant elements in a sliding range.
// Namely: The the current page, the two ellipses, the two beginning pages, and the two ending pages.
if
(
$this
->
last_page
<
7
+
(
$adjacent
*
2
))
{
$numbers
=
$this
->
range
(
1
,
$this
->
last_page
);
}
else
{
$numbers
=
$this
->
slider
(
$adjacent
);
}
// If there are two few pages to make showing a slider possible, we will just display a
// range of plain number links. The hard-coded "7" is to account for all of the constant
// elements in a sliding range, namely the current page, the two ellipses, the two
// beginning and ending pages.
$numbers
=
(
$this
->
last_page
<
7
+
(
$adjacent
*
2
))
?
$this
->
range
(
1
,
$this
->
last_page
)
:
$this
->
slider
(
$adjacent
);
return
'<div class="pagination">'
.
$this
->
previous
()
.
$numbers
.
$this
->
next
()
.
'</div>'
;
return
sprintf
(
$this
->
wrapper
,
$this
->
previous
()
.
$numbers
.
$this
->
next
())
;
}
/**
...
...
@@ -244,7 +246,9 @@ class Paginator {
$append
.=
'&'
.
$key
.
'='
.
$value
;
}
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
$page
.
$append
,
$text
,
compact
(
'class'
),
Request
::
secure
());
$request
=
IoC
::
container
()
->
core
(
'request'
);
return
HTML
::
link
(
$request
->
uri
()
.
'?page='
.
$page
.
$append
,
$text
,
compact
(
'class'
),
$request
->
secure
());
}
/**
...
...
@@ -256,6 +260,7 @@ class Paginator {
public
function
lang
(
$language
)
{
$this
->
language
=
$language
;
return
$this
;
}
...
...
@@ -268,6 +273,7 @@ class Paginator {
public
function
append
(
$values
)
{
$this
->
append
=
$values
;
return
$this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment