1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
6 | * |
---|
7 | * http://www.lockon.co.jp/ |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | // {{{ requires |
---|
25 | require_once(CLASS_REALDIR . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * MyPage のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_MyPage extends LC_Page { |
---|
35 | |
---|
36 | // {{{ properties |
---|
37 | |
---|
38 | /** ページナンバー */ |
---|
39 | var $tpl_pageno; |
---|
40 | |
---|
41 | // }}} |
---|
42 | // {{{ functions |
---|
43 | |
---|
44 | /** |
---|
45 | * Page を初期化する. |
---|
46 | * |
---|
47 | * @return void |
---|
48 | */ |
---|
49 | function init() { |
---|
50 | parent::init(); |
---|
51 | $this->tpl_title = 'MYページ'; |
---|
52 | if (Net_UserAgent_Mobile::isMobile() === true){ |
---|
53 | $this->tpl_subtitle = 'MYページ'; |
---|
54 | } else { |
---|
55 | $this->tpl_subtitle = '購入履歴一覧'; |
---|
56 | } |
---|
57 | $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl'; |
---|
58 | $this->tpl_mainno = 'mypage'; |
---|
59 | $this->tpl_mypageno = 'index'; |
---|
60 | $this->httpCacheControl('nocache'); |
---|
61 | } |
---|
62 | |
---|
63 | /** |
---|
64 | * Page のプロセス. |
---|
65 | * |
---|
66 | * @return void |
---|
67 | */ |
---|
68 | function process() { |
---|
69 | parent::process(); |
---|
70 | $this->action(); |
---|
71 | $this->sendResponse(); |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * Page のAction. |
---|
76 | * |
---|
77 | * @return void |
---|
78 | */ |
---|
79 | function action() { |
---|
80 | |
---|
81 | $objQuery = new SC_Query(); |
---|
82 | $objCustomer = new SC_Customer(); |
---|
83 | |
---|
84 | // 退会判定用情報の取得 |
---|
85 | $this->tpl_login = $objCustomer->isLoginSuccess(true); |
---|
86 | |
---|
87 | // ログインチェック |
---|
88 | if(!$objCustomer->isLoginSuccess(true)) { |
---|
89 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); |
---|
90 | }else { |
---|
91 | //マイページトップ顧客情報表示用 |
---|
92 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
---|
93 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
---|
94 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
---|
95 | } |
---|
96 | |
---|
97 | //ページ送り用 |
---|
98 | if (isset($_POST['pageno'])) { |
---|
99 | $this->tpl_pageno = htmlspecialchars($_POST['pageno'], ENT_QUOTES, CHAR_CODE); |
---|
100 | } |
---|
101 | |
---|
102 | $col = "order_id, create_date, payment_id, payment_total"; |
---|
103 | $from = "dtb_order"; |
---|
104 | $where = "del_flg = 0 AND customer_id=?"; |
---|
105 | $arrval = array($objCustomer->getvalue('customer_id')); |
---|
106 | $order = "order_id DESC"; |
---|
107 | |
---|
108 | $linemax = $objQuery->count($from, $where, $arrval); |
---|
109 | $this->tpl_linemax = $linemax; |
---|
110 | |
---|
111 | if (Net_UserAgent_Mobile::isMobile() === true){ |
---|
112 | define ("HISTORY_NUM", 5); // TODO |
---|
113 | $pageNo = isset($_GET['pageno']) ? (int) $_GET['pageno'] : 0; // TODO |
---|
114 | |
---|
115 | // ページ送りの取得 |
---|
116 | // next |
---|
117 | if ($pageNo + HISTORY_NUM < $linemax) { |
---|
118 | $next = "<a href='?pageno=" . ($pageNo + HISTORY_NUM) . "'>次へ→</a>"; |
---|
119 | } else { |
---|
120 | $next = ""; |
---|
121 | } |
---|
122 | |
---|
123 | // previous |
---|
124 | if ($pageNo - HISTORY_NUM > 0) { |
---|
125 | $previous = "<a href='?pageno=" . ($pageNo - HISTORY_NUM) . "'>←前へ</a>"; |
---|
126 | } elseif ($pageNo == 0) { |
---|
127 | $previous = ""; |
---|
128 | } else { |
---|
129 | $previous = "<a href='?pageno=0'>←前へ</a>"; |
---|
130 | } |
---|
131 | |
---|
132 | // bar |
---|
133 | if ($next != '' && $previous != '') { |
---|
134 | $bar = " | "; |
---|
135 | } else { |
---|
136 | $bar = ""; |
---|
137 | } |
---|
138 | |
---|
139 | $this->tpl_strnavi = $previous . $bar . $next; |
---|
140 | |
---|
141 | // 取得範囲の指定(開始行番号、行数のセット) |
---|
142 | $objQuery->setLimitOffset(HISTORY_NUM, $pageNo); |
---|
143 | } else { |
---|
144 | // ページ送りの取得 |
---|
145 | $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); |
---|
146 | $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 |
---|
147 | $startno = $objNavi->start_row; |
---|
148 | |
---|
149 | // 取得範囲の指定(開始行番号、行数のセット) |
---|
150 | $objQuery->setLimitOffset(SEARCH_PMAX, $startno); |
---|
151 | } |
---|
152 | |
---|
153 | // 表示順序 |
---|
154 | $objQuery->setOrder($order); |
---|
155 | |
---|
156 | //購入履歴の取得 |
---|
157 | $this->arrOrder = $objQuery->select($col, $from, $where, $arrval); |
---|
158 | |
---|
159 | // 支払い方法の取得 |
---|
160 | $objDb = new SC_Helper_DB_Ex(); |
---|
161 | $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
---|
162 | |
---|
163 | } |
---|
164 | |
---|
165 | /** |
---|
166 | * デストラクタ. |
---|
167 | * |
---|
168 | * @return void |
---|
169 | */ |
---|
170 | function destroy() { |
---|
171 | parent::destroy(); |
---|
172 | } |
---|
173 | |
---|
174 | //エラーチェック |
---|
175 | |
---|
176 | function lfErrorCheck() { |
---|
177 | $objErr = new SC_CheckError(); |
---|
178 | $objErr->doFunc(array("メールアドレス", "login_email", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK")); |
---|
179 | $objErr->dofunc(array("パスワード", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK")); |
---|
180 | return $objErr->arrErr; |
---|
181 | } |
---|
182 | |
---|
183 | /* パラメータ情報の初期化 */ |
---|
184 | function lfInitParam(&$objFormParam) { |
---|
185 | |
---|
186 | $objFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
187 | $objFormParam->addParam("メールアドレス", "login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); |
---|
188 | $objFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); |
---|
189 | } |
---|
190 | |
---|
191 | } |
---|
192 | ?> |
---|