source: branches/feature-module-update/data/class/pages/mypage/LC_Page_Mypage.php @ 16375

Revision 16375, 8.0 KB checked in by nanasess, 17 years ago (diff)

PC版会員とモバイル版会員のメールアドレス管理改善(#171)

  • data/Smarty/templates/default/mobile/mypage/change.tpl
    data/Smarty/templates/default/mobile/mypage/change_confirm.tpl
    • 携帯メールアドレス追加
  • data/Smarty/templates/default/mobile/entry/email_mobile.tpl
    • 「今は登録しない」リンク追加
  • data/class/helper/SC_Helper_DB.php
    • モバイル版で dtb_customer 更新時に email を email_mobile にコピーする処理を削除
  • data/class/pages/mypage/LC_Page_Mypage.php
    • ログイン時の処理を修正
  • data/class/pages/mypage/LC_Page_Mypage_Change.php
    • リファクタリング
    • email と email_mobile を管理できるように修正
  • 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
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8// {{{ requires
9require_once(CLASS_PATH . "pages/LC_Page.php");
10
11/**
12 * MyPage のページクラス.
13 *
14 * @package Page
15 * @author LOCKON CO.,LTD.
16 * @version $Id$
17 */
18class LC_Page_MyPage extends LC_Page {
19
20    // {{{ properties
21
22    /** ページナンバー */
23    var $tpl_pageno;
24
25    // }}}
26    // {{{ functions
27
28    /**
29     * Page を初期化する.
30     *
31     * @return void
32     */
33    function init() {
34        parent::init();
35        $this->tpl_mainpage = TEMPLATE_DIR .'mypage/index.tpl';
36        $this->tpl_title = 'MYページ/購入履歴一覧';
37        $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
38        $this->tpl_column_num = 1;
39        $this->tpl_mainno = 'mypage';
40        $this->tpl_mypageno = 'index';
41        $this->allowClientCache();
42    }
43
44    /**
45     * Page のプロセス.
46     *
47     * @return void
48     */
49    function process() {
50
51        $objView = new SC_SiteView();
52        $objQuery = new SC_Query();
53        $objCustomer = new SC_Customer();
54
55        // レイアウトデザインを取得
56        $objLayout = new SC_Helper_PageLayout_Ex();
57        $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
58
59        // ログインチェック
60        if(!isset($_SESSION['customer'])) {
61            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
62        }else {
63            //マイページトップ顧客情報表示用
64            $this->CustomerName1 = $objCustomer->getvalue('name01');
65            $this->CustomerName2 = $objCustomer->getvalue('name02');
66            $this->CustomerPoint = $objCustomer->getvalue('point');
67        }
68
69        //ページ送り用
70        if (isset($_POST['pageno'])) {
71            $this->tpl_pageno = htmlspecialchars($_POST['pageno'], ENT_QUOTES, CHAR_CODE);
72        }
73
74        $col = "order_id, create_date, payment_id, payment_total";
75        $from = "dtb_order";
76        $where = "del_flg = 0 AND customer_id=?";
77        $arrval = array($objCustomer->getvalue('customer_id'));
78        $order = "order_id DESC";
79
80        $linemax = $objQuery->count($from, $where, $arrval);
81        $this->tpl_linemax = $linemax;
82
83        // ページ送りの取得
84        $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
85        $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列
86        $startno = $objNavi->start_row;
87
88        // 取得範囲の指定(開始行番号、行数のセット)
89        $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
90        // 表示順序
91        $objQuery->setorder($order);
92
93        //購入履歴の取得
94        $this->arrOrder = $objQuery->select($col, $from, $where, $arrval);
95
96        // 支払い方法の取得
97        $objDb = new SC_Helper_DB_Ex();
98        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
99
100        $objView->assignobj($this);             //$objpage内の全てのテンプレート変数をsmartyに格納
101        $objView->display(SITE_FRAME);              //パスとテンプレート変数の呼び出し、実行
102    }
103
104    /**
105     * モバイルページを初期化する.
106     *
107     * @return void
108     */
109    function mobileInit() {
110        $this->tpl_mainpage = 'mypage/index.tpl';
111        $this->tpl_title = 'MYページ/購入履歴一覧';
112        $this->allowClientCache();
113    }
114
115    /**
116     * Page のプロセス(モバイル).
117     *
118     * @return void
119     */
120    function mobileProcess() {
121        $objView = new SC_MobileView();
122        $objQuery = new SC_Query();
123        $objCustomer = new SC_Customer();
124        // クッキー管理クラス
125        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
126        // パラメータ管理クラス
127        $objFormParam = new SC_FormParam();
128        // パラメータ情報の初期化
129        $this->lfInitParam($objFormParam);
130        // POST値の取得
131        $objFormParam->setParam($_POST);
132
133        // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
134        $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
135
136        if (!isset($_POST['mode'])) $_POST['mode'] = "";
137
138        // ログイン処理
139        if($_POST['mode'] == 'login') {
140            $objFormParam->toLower('login_email');
141            $arrErr = $objFormParam->checkError();
142            $arrForm =  $objFormParam->getHashArray();
143
144            // クッキー保存判定
145            if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
146                $objCookie->setCookie('login_email', $_POST['login_email']);
147            } else {
148                $objCookie->setCookie('login_email', '');
149            }
150
151            if (count($arrErr) == 0){
152                if($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) ||
153                   $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
154                    // ログインが成功した場合は携帯端末IDを保存する。
155                    $objCustomer->updateMobilePhoneId();
156
157                    /*
158                     * email がモバイルドメインでは無く,
159                     * 携帯メールアドレスが登録されていない場合
160                     */
161                    $objMobile = new SC_Helper_Mobile_Ex();
162                    if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
163                        if (!$objCustomer->hasValue('email_mobile')) {
164                            $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true);
165                        }
166                    }
167                } else {
168                    $objQuery = new SC_Query;
169                    $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
170                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
171
172                    if($ret > 0) {
173                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
174                    } else {
175                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
176                    }
177                }
178            }
179        }
180
181        /*
182         * ログインチェック
183         * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする
184         */
185        if(!$objCustomer->isLoginSuccess(true)) {
186            $this->tpl_mainpage = 'mypage/login.tpl';
187            $objView->assignArray($objFormParam->getHashArray());
188            if (empty($arrErr)) $arrErr = array();
189            $objView->assignArray(array("arrErr" => $arrErr));
190        }else {
191            //マイページトップ顧客情報表示用
192            $this->CustomerName1 = $objCustomer->getvalue('name01');
193            $this->CustomerName2 = $objCustomer->getvalue('name02');
194        }
195
196        $objView->assignobj($this);             //$objpage内の全てのテンプレート変数をsmartyに格納
197        $objView->display(SITE_FRAME);              //パスとテンプレート変数の呼び出し、実行
198
199    }
200
201    /**
202     * デストラクタ.
203     *
204     * @return void
205     */
206    function destroy() {
207        parent::destroy();
208    }
209
210    //エラーチェック
211
212    function lfErrorCheck() {
213        $objErr = new SC_CheckError();
214        $objErr->doFunc(array("メールアドレス", "login_email", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
215        $objErr->dofunc(array("パスワード", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
216        return $objErr->arrErr;
217    }
218
219    /* パラメータ情報の初期化 */
220    function lfInitParam(&$objFormParam) {
221
222        $objFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
223        $objFormParam->addParam("メールアドレス", "login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
224        $objFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
225    }
226
227}
228?>
Note: See TracBrowser for help on using the repository browser.