XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
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 
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 
48  {
50  }
51 
54  {
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 */
$last_page
last page number
$first_page
first page number
$page_count
number of page links displayed at one time
$cur_page
current page number
The parent class of the point module.
Definition: point.class.php:8
$total_page
number of total pages
$point
increments per getNextPage()
$total_count
number of total items
__construct($total_count, $total_page, $cur_page, $page_count=10)