mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@17 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0d1a4ce1ce
commit
5efaa4d880
2 changed files with 311 additions and 286 deletions
|
|
@ -1,42 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* @file : classes/page/PageHandler.class.php
|
||||
* @author : zero <zero@nzeo.com>
|
||||
* @desc : 페이지 처리
|
||||
**/
|
||||
/**
|
||||
* @class PageHandler
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 페이지 네비게이션 담당
|
||||
*
|
||||
* 전체갯수, 전체페이지, 현재페이지, 페이지당 목록의 수를 넘겨주면 \n
|
||||
* 페이지 네비게이션에 필요한 variables와 method를 구현\n
|
||||
**/
|
||||
|
||||
class PageHandler {
|
||||
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;
|
||||
var $total_count = 0; ///< 전체 item의 갯수
|
||||
var $total_page = 0; ///< 전체 페이지 수
|
||||
var $cur_page = 0; ///< 현 페이지
|
||||
var $page_count = 10; ///< 한번에 보일 페이지의 수
|
||||
var $first_page = 1; ///< 첫 페이지
|
||||
var $last_page = 1; ///< 마지막 페이지
|
||||
var $point = 0; ///< getNextPage() 호출시 증가하는 값
|
||||
|
||||
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;
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
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;
|
||||
$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;
|
||||
$this->first_page = $first_page;
|
||||
$this->last_page = $last_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 다음 페이지 요청
|
||||
**/
|
||||
function getNextPage() {
|
||||
$page = $this->first_page+$this->point++;
|
||||
if($page > $this->last_page) $page = 0;
|
||||
return $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