XpressEngine Core
1.11.2
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
classes
page
PageHandler.class.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
13
class
PageHandler
extends
Handler
14
{
15
16
var
$total_count
= 0;
17
var
$total_page
= 0;
18
var
$cur_page
= 0;
19
var
$page_count
= 10;
20
var
$first_page
= 1;
21
var
$last_page
= 1;
22
var
$point
= 0;
23
33
function
__construct
(
$total_count
,
$total_page
,
$cur_page
,
$page_count
= 10)
34
{
35
$this->total_count =
$total_count
;
36
$this->total_page =
$total_page
;
37
$this->cur_page =
$cur_page
;
38
$this->page_count =
$page_count
;
39
$this->
point
= 0;
40
41
$first_page
=
$cur_page
- (int) (
$page_count
/ 2);
42
if
(
$first_page
< 1)
43
{
44
$first_page
= 1;
45
}
46
47
if
(
$total_page
>
$page_count
&&
$first_page
+
$page_count
- 1 >
$total_page
)
48
{
49
$first_page
-=
$first_page
+
$page_count
- 1 -
$total_page
;
50
}
51
52
$last_page
=
$total_page
;
53
if
(
$last_page
>
$total_page
)
54
{
55
$last_page
=
$total_page
;
56
}
57
58
$this->first_page =
$first_page
;
59
$this->last_page =
$last_page
;
60
61
if
($total_page < $this->page_count)
62
{
63
$this->page_count =
$total_page
;
64
}
65
}
66
71
function
getNextPage
()
72
{
73
$page = $this->first_page + $this->
point
++;
74
if
($this->point > $this->page_count || $page > $this->last_page)
75
{
76
$page = 0;
77
}
78
return
$page;
79
}
80
86
function
getPage
($offset)
87
{
88
return
max(min($this->cur_page + $offset, $this->total_page),
''
);
89
}
90
91
}
92
/* End of file PageHandler.class.php */
93
/* Location: ./classes/page/PageHandler.class.php */
PageHandler\$last_page
$last_page
last page number
Definition:
PageHandler.class.php:21
PageHandler\$first_page
$first_page
first page number
Definition:
PageHandler.class.php:20
PageHandler\getPage
getPage($offset)
Definition:
PageHandler.class.php:86
PageHandler\$page_count
$page_count
number of page links displayed at one time
Definition:
PageHandler.class.php:19
PageHandler\$cur_page
$cur_page
current page number
Definition:
PageHandler.class.php:18
point
The parent class of the point module.
Definition:
point.class.php:8
PageHandler\getNextPage
getNextPage()
Definition:
PageHandler.class.php:71
Handler
Definition:
Handler.class.php:9
PageHandler\$total_page
$total_page
number of total pages
Definition:
PageHandler.class.php:17
PageHandler\$point
$point
increments per getNextPage()
Definition:
PageHandler.class.php:22
PageHandler\$total_count
$total_count
number of total items
Definition:
PageHandler.class.php:16
PageHandler
Definition:
PageHandler.class.php:13
PageHandler\__construct
__construct($total_count, $total_page, $cur_page, $page_count=10)
Definition:
PageHandler.class.php:33
Generated on Tue Dec 18 2018 17:04:25 for XpressEngine Core by
1.8.5