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
bad119a4
Commit
bad119a4
authored
Aug 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring paginator... added paginator->append method.
parent
aba4eec8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
paginator.php
system/paginator.php
+28
-7
No files found.
system/paginator.php
View file @
bad119a4
...
@@ -44,6 +44,13 @@ class Paginator {
...
@@ -44,6 +44,13 @@ class Paginator {
*/
*/
public
$language
;
public
$language
;
/**
* The values that should be appended to the end of the link query strings.
*
* @var array
*/
public
$append
=
array
();
/**
/**
* Create a new Paginator instance.
* Create a new Paginator instance.
*
*
...
@@ -124,12 +131,7 @@ class Paginator {
...
@@ -124,12 +131,7 @@ class Paginator {
{
{
// The hard-coded "7" is to account for all of the constant elements in a sliding range.
// 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.
// Namely: The the current page, the two ellipses, the two beginning pages, and the two ending pages.
if
(
$this
->
last_page
<
7
+
(
$adjacent
*
2
))
return
(
$this
->
last_page
<
7
+
(
$adjacent
*
2
))
?
$this
->
range
(
1
,
$this
->
last_page
)
:
$this
->
slider
(
$adjacent
);
{
return
$this
->
range
(
1
,
$this
->
last_page
);
}
return
$this
->
slider
(
$adjacent
);
}
}
/**
/**
...
@@ -237,7 +239,14 @@ class Paginator {
...
@@ -237,7 +239,14 @@ class Paginator {
*/
*/
private
function
link
(
$page
,
$text
,
$class
)
private
function
link
(
$page
,
$text
,
$class
)
{
{
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
$page
,
$text
,
array
(
'class'
=>
$class
),
Request
::
is_secure
());
$append
=
''
;
foreach
(
$this
->
append
as
$key
=>
$value
)
{
$append
.=
'&'
.
$key
.
'='
.
$value
;
}
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
$page
.
$append
,
$text
,
array
(
'class'
=>
$class
),
Request
::
is_secure
());
}
}
/**
/**
...
@@ -252,4 +261,16 @@ class Paginator {
...
@@ -252,4 +261,16 @@ class Paginator {
return
$this
;
return
$this
;
}
}
/**
* Set the items that should be appended to the link query strings.
*
* @param array $values
* @return Paginator
*/
public
function
append
(
$values
)
{
$this
->
append
=
$values
;
return
$this
;
}
}
}
\ No newline at end of file
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