source: branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage.php @ 19803

Revision 19803, 8.9 KB checked in by Seasoft, 13 years ago (diff)

#834(パラメータの定数名に「URL」を含むにもかかわらず、パスのみのものがある)

  • 一斉置換前の現状記録のためのコミット

#628(未使用処理・定義などの削除)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
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
25require_once(CLASS_FILE_PATH . "pages/LC_Page.php");
26
27/**
28 * MyPage のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class 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        $this->tpl_subtitle = '購入履歴一覧';
53        $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
54        $this->tpl_mainno = 'mypage';
55        $this->tpl_mypageno = 'index';
56        $this->httpCacheControl('nocache');
57    }
58
59    /**
60     * Page のプロセス.
61     *
62     * @return void
63     */
64    function process() {
65        parent::process();
66        $this->action();
67        $this->sendResponse();
68    }
69   
70    /**
71     * Page のAction.
72     *
73     * @return void
74     */
75    function action() {
76
77        //$objView = new SC_SiteView();
78        $objQuery = new SC_Query();
79        $objCustomer = new SC_Customer();
80       
81        // 退会判定用情報の取得
82        $this->tpl_login = $objCustomer->isLoginSuccess();
83
84        // ログインチェック
85        if(!$objCustomer->isLoginSuccess()) {
86            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
87        }else {
88            //マイページトップ顧客情報表示用
89            $this->CustomerName1 = $objCustomer->getvalue('name01');
90            $this->CustomerName2 = $objCustomer->getvalue('name02');
91            $this->CustomerPoint = $objCustomer->getvalue('point');
92        }
93
94        //ページ送り用
95        if (isset($_POST['pageno'])) {
96            $this->tpl_pageno = htmlspecialchars($_POST['pageno'], ENT_QUOTES, CHAR_CODE);
97        }
98
99        $col = "order_id, create_date, payment_id, payment_total";
100        $from = "dtb_order";
101        $where = "del_flg = 0 AND customer_id=?";
102        $arrval = array($objCustomer->getvalue('customer_id'));
103        $order = "order_id DESC";
104
105        $linemax = $objQuery->count($from, $where, $arrval);
106        $this->tpl_linemax = $linemax;
107
108        // ページ送りの取得
109        $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
110        $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列
111        $startno = $objNavi->start_row;
112
113        // 取得範囲の指定(開始行番号、行数のセット)
114        $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
115        // 表示順序
116        $objQuery->setOrder($order);
117
118        //購入履歴の取得
119        $this->arrOrder = $objQuery->select($col, $from, $where, $arrval);
120
121        // 支払い方法の取得
122        $objDb = new SC_Helper_DB_Ex();
123        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
124        //$objView->assignobj($this);               //$objpage内の全てのテンプレート変数をsmartyに格納
125        //$objView->display(SITE_FRAME);                //パスとテンプレート変数の呼び出し、実行
126    }
127
128    /**
129     * モバイルページを初期化する.
130     *
131     * @return void
132     */
133    function mobileInit() {
134        $this->init();
135        $this->tpl_mainpage = 'mypage/index.tpl';
136        $this->tpl_title = 'MYページ/購入履歴一覧';
137        $this->httpCacheControl('nocache');
138    }
139
140    /**
141     * Page のプロセス(モバイル).
142     *
143     * @return void
144     */
145    function mobileProcess() {
146        parent::mobileProcess();
147        $this->mobileAction();
148        $this->sendResponse();
149    }
150   
151    /**
152     * Page のAction(モバイル).
153     *
154     * @return void
155     */
156    function mobileAction() {
157        //$objView = new SC_MobileView();
158        $objQuery = new SC_Query();
159        $objCustomer = new SC_Customer();
160        // クッキー管理クラス
161        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
162        // パラメータ管理クラス
163        $objFormParam = new SC_FormParam();
164        // パラメータ情報の初期化
165        $this->lfInitParam($objFormParam);
166        // POST値の取得
167        $objFormParam->setParam($_POST);
168
169        // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
170        $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
171
172        if (!isset($_POST['mode'])) $_POST['mode'] = "";
173
174        // ログイン処理
175        if($_POST['mode'] == 'login') {
176            $objFormParam->toLower('login_email');
177            $arrErr = $objFormParam->checkError();
178            $arrForm =  $objFormParam->getHashArray();
179
180            // クッキー保存判定
181            if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
182                $objCookie->setCookie('login_email', $_POST['login_email']);
183            } else {
184                $objCookie->setCookie('login_email', '');
185            }
186
187            if (count($arrErr) == 0){
188                if($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) ||
189                   $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
190                    // ログインが成功した場合は携帯端末IDを保存する。
191                    $objCustomer->updateMobilePhoneId();
192
193                    /*
194                     * email がモバイルドメインでは無く,
195                     * 携帯メールアドレスが登録されていない場合
196                     */
197                    $objMobile = new SC_Helper_Mobile_Ex();
198                    if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
199                        if (!$objCustomer->hasValue('email_mobile')) {
200                            $this->objDisplay->redirect($this->getLocation("../entry/email_mobile.php"));
201                            exit;
202                        }
203                    }
204                } else {
205                    $objQuery = new SC_Query;
206                    $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
207                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
208
209                    if($ret > 0) {
210                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
211                    } else {
212                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
213                    }
214                }
215            }
216        }
217
218        /*
219         * ログインチェック
220         * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする
221         */
222        if(!$objCustomer->isLoginSuccess(true)) {
223            $this->tpl_mainpage = 'mypage/login.tpl';
224            foreach ($objFormParam->getHashArray() as $key => $val) {
225                $this->$key = $val;
226            }
227            if (empty($arrErr)) $arrErr = array();
228            $this->arrErr = $arrErr;
229        }else {
230            //マイページトップ顧客情報表示用
231            $this->CustomerName1 = $objCustomer->getvalue('name01');
232            $this->CustomerName2 = $objCustomer->getvalue('name02');
233        }
234    }
235
236    /**
237     * デストラクタ.
238     *
239     * @return void
240     */
241    function destroy() {
242        parent::destroy();
243    }
244
245    //エラーチェック
246
247    function lfErrorCheck() {
248        $objErr = new SC_CheckError();
249        $objErr->doFunc(array("メールアドレス", "login_email", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
250        $objErr->dofunc(array("パスワード", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
251        return $objErr->arrErr;
252    }
253
254    /* パラメータ情報の初期化 */
255    function lfInitParam(&$objFormParam) {
256
257        $objFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
258        $objFormParam->addParam("メールアドレス", "login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
259        $objFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
260    }
261
262}
263?>
Note: See TracBrowser for help on using the repository browser.