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

Revision 19661, 9.4 KB checked in by nanasess, 13 years ago (diff)

source:branches/camp/camp-2_5-E のマージ

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