4dbe08d04149502c80aacda5ac95e5d3610cac41.svn-base
4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/comm/DB.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/php/LoginUtil.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/util/UploadUtil.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/util/LogUtil.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/util/SimpleImage.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/util/Push.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/module/whoisSMS/class.http.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . '/common/classes/module/whoisSMS/class.EmmaSMS.php'; ?>
<? include_once $_SERVER["DOCUMENT_ROOT"] . "/common/excel/reader.php" ?>
<?php
if(! class_exists("HomeFrm") ) {
class HomeFrm extends DB
{
var $page = NULL; // 게시판 리스트 출력할 때 사용한다.
var $req = NULL; // 현재 HttpRequest + Cookie
var $appUser = NULL;
var $webuser = NULL;
var $admUser = NULL;
var $callApi = NULL ;
var $rowPerPage = 20 ;
var $pagePerBlock = 10 ;
var $rownum = 0 ;
var $startBlock = 1 ;
var $endBlock = 10 ;
var $virtualNum = 0 ;
var $endPage = 0 ;
var $startNum = 0 ;
var $endNum = 0 ;
function __construct($req)
{
parent::__construct($req);
$this->req = $req ;
$this->appUser = LoginUtil::getAppUser() ;
//$this->webUser = LoginUtil::getWebUser() ;
$this->admUser = LoginUtil::getAdminUser() ;
$this->callApi = $req["cmd"];
}
// 20091221 added by nukiboy
protected function setFlow($rurl,$msg,$flow)
{
$_REQUEST['rurl'] = $rurl ;
$_REQUEST['msg'] = $msg ;
$_REQUEST['flow'] = $flow ;
}
//페이지 초기화
function initPage()
{
$this->rowPerPage = $this->req["rowPerPage"] == "" ? $this->rowPerPage : $this->req["rowPerPage"];
$this->req["page"] = ($this->req["page"] == "" || $this->req["page"] == "0") ? "1" : $this->req["page"] ;
$this->startNum = ($this->req["page"] - 1) * $this->rowPerPage ;
$this->endNum = $this->rowPerPage ;
}
//페이지 설정
function setPage($rownum)
{
$this->virtualNum = $rownum - ($this->startNum - 0) ;
$this->rownum = $rownum ;
$this->endPage = ($rownum%$this->rowPerPage) > 0 ? floor($rownum/$this->rowPerPage)+1 : floor($rownum/$this->rowPerPage);
$blockNum = (floor(($this->req["page"] - 1) / $this->pagePerBlock) * $this->pagePerBlock) ;
$totalBlock = floor( ($this->rownum - 1) / $this->rowPerPage ) + 1 ;
$this->startBlock = $blockNum + 1 ;
$this->endBlock = ( $blockNum + $this->pagePerBlock < $totalBlock ) ? $blockNum + $this->pagePerBlock : $totalBlock ;
}
//이전 블록 여부 체크
function isPrevBlock()
{
$thisBlockSet = floor(($this->req["page"] - 1) / $this->pagePerBlock) ;
return ( $thisBlockSet > 0 ) ;
}
//다음 블록 여부 체크
function isNextBlock()
{
$totalBlock = floor( ($this->rownum - 1) / $this->rowPerPage ) + 1 ;
$thisBlockSet = ceil(($this->req["page"]) / $this->pagePerBlock) ;
$lastBlockSet = ceil(($totalBlock) / $this->pagePerBlock) ;
return ( $thisBlockSet < $lastBlockSet ) ;
}
//디바이스 페이징 2012.08.28 추가 ny Dev.Na
//파라미터 페이징 sql 쿼리
function setDevicePaging($sqlStr, $noCol, $no=null){
$rowPerPage = ($this->req["rowPerPage"] == "" || $this->req["rowPerPage"] == "0") ? "20" : $this->req["rowPerPage"] ;
$sqlStr = trim($sqlStr);
$noColArr = explode(".", $noCol);
if(sizeof($noColArr) > 1)
{
$whereCol = $noColArr[1];
}
else
{
$whereCol = $noCol;
}
if($no != "" && $no != null && $no != "0")
$where = " WHERE sel1.{$whereCol} = {$no}";
$totalSqlstr = str_ireplace("SELECT ".$noCol, "SELECT COUNT(".$noCol.") AS totalRecordCount", $sqlStr);
$sql = "SELECT total.totalRecordCount, sel1.rowNumber
FROM
(
{$totalSqlstr}
)total,
(
SELECT @rownum1:=@rownum1+1 AS 'rowNumber', tbl.*
FROM
(SELECT @rownum1:=0) rn,
({$sqlStr}) tbl
)sel1
{$where}
LIMIT 0, 1";
$result = $this->getRow($sql);
$this->startNum = ($no != "") ? $result[rowNumber] : 0;
$this->totalRecordCount = $result[totalRecordCount] == "" ? "0" : $result[totalRecordCount];
//$this->nextPageNo = $result[nextPageNO] == "" ? "" : $result[nextPageNO];
$this->endNum = $rowPerPage;
}
function isNextPage(){
if($this->totalRecordCount > ($this->startNum + $this->endNum))
return true;
else
return false;
}
//디바이스 페이징 2012.08.28 추가 ny Dev.Na 끝
}
}
?>