mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@2 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
2569c554ce
commit
c040d4d713
317 changed files with 14496 additions and 0 deletions
42
classes/page/PageHandler.class.php
Normal file
42
classes/page/PageHandler.class.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* @file : classes/page/PageHandler.class.php
|
||||
* @author : zero <zero@nzeo.com>
|
||||
* @desc : 페이지 처리
|
||||
**/
|
||||
|
||||
class PageHandler {
|
||||
|
||||
var $total_count = 0;
|
||||
var $total_page = 0;
|
||||
var $cur_page = 0;
|
||||
var $page_count = 10;
|
||||
var $first_page = 1;
|
||||
var $last_page = 1;
|
||||
var $point = 0;
|
||||
|
||||
function PageHandler($total_count, $total_page, $cur_page, $page_count = 10) {
|
||||
$this->total_count = $total_count;
|
||||
$this->total_page = $total_page;
|
||||
$this->cur_page = $cur_page;
|
||||
$this->page_count = $page_count;
|
||||
$this->point = 0;
|
||||
|
||||
$first_page = $cur_page-(int)($page_count/2);
|
||||
if($first_page<1) $first_page = 1;
|
||||
$last_page = $first_page+$page_count-1;
|
||||
if($last_page>$total_page) $last_page = $total_page;
|
||||
|
||||
$this->first_page = $first_page;
|
||||
$this->last_page = $last_page;
|
||||
}
|
||||
|
||||
function getNextPage() {
|
||||
$page = $this->first_page+$this->point++;
|
||||
if($page > $this->last_page) $page = 0;
|
||||
return $page;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue