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
341908d7
Commit
341908d7
authored
Jul 22, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added secure and lang methods to paginator.
parent
36d9fe0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
5 deletions
+42
-5
paginator.php
system/paginator.php
+42
-5
No files found.
system/paginator.php
View file @
341908d7
...
...
@@ -37,6 +37,20 @@ class Paginator {
*/
public
$last_page
;
/**
* The language that should be used when generating page links.
*
* @var string
*/
public
$language
;
/**
* Indicates if HTTPS links should be generated.
*
* @var bool
*/
public
$https
=
false
;
/**
* Create a new Paginator instance.
*
...
...
@@ -128,11 +142,11 @@ class Paginator {
*/
public
function
previous
()
{
$text
=
Lang
::
line
(
'pagination.previous'
)
->
get
();
$text
=
Lang
::
line
(
'pagination.previous'
)
->
get
(
$this
->
language
);
if
(
$this
->
page
>
1
)
{
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
(
$this
->
page
-
1
),
$text
,
array
(
'class'
=>
'prev_page'
))
.
' '
;
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
(
$this
->
page
-
1
),
$text
,
array
(
'class'
=>
'prev_page'
)
,
$this
->
https
)
.
' '
;
}
return
"<span class=
\"
disabled prev_page
\"
>
$text
</span> "
;
...
...
@@ -145,11 +159,11 @@ class Paginator {
*/
public
function
next
()
{
$text
=
Lang
::
line
(
'pagination.next'
)
->
get
();
$text
=
Lang
::
line
(
'pagination.next'
)
->
get
(
$this
->
language
);
if
(
$this
->
page
<
$this
->
last_page
)
{
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
(
$this
->
page
+
1
),
$text
,
array
(
'class'
=>
'next_page'
));
return
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
(
$this
->
page
+
1
),
$text
,
array
(
'class'
=>
'next_page'
)
,
$this
->
https
);
}
return
"<span class=
\"
disabled next_page
\"
>
$text
</span>"
;
...
...
@@ -190,10 +204,33 @@ class Paginator {
for
(
$i
=
$start
;
$i
<=
$end
;
$i
++
)
{
$pages
.=
(
$this
->
page
==
$i
)
?
"<span class=
\"
current
\"
>
$i
</span> "
:
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
$i
,
$i
)
.
' '
;
$pages
.=
(
$this
->
page
==
$i
)
?
"<span class=
\"
current
\"
>
$i
</span> "
:
HTML
::
link
(
Request
::
uri
()
.
'?page='
.
$i
,
$i
,
array
(),
$this
->
https
)
.
' '
;
}
return
$pages
;
}
/**
* Set the language that should be used when generating pagination links.
*
* @param string $language
* @return Paginator
*/
public
function
lang
(
$language
)
{
$this
->
language
=
$language
;
return
$this
;
}
/**
* Force the pagination links to use HTTPS.
*
* @return Paginator
*/
public
function
secure
()
{
$this
->
https
=
true
;
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