Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
5 deletions
+43
-5
system/paginator.php
+43
-5
No files found.
system/paginator.php
View file @
341908d7
...
...
@@ -38,6 +38,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.
*
* @param array $results
...
...
@@ -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