source: branches/version-2_11-dev/data/class/pages/mypage/LC_Page_Mypage_Change.php @ 21275

Revision 21275, 5.1 KB checked in by Seasoft, 12 years ago (diff)

#1498: 会員情報の正規化が効いていない

  • まずはフロント機能

#1499: 会員登録内容変更の完了処理でバリデーションが働かない

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2011 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_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
26
27/**
28 * 登録内容変更 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Mypage_Change extends LC_Page_AbstractMypage_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_subtitle = '会員登録内容変更(入力ページ)';
47        $this->tpl_mypageno = 'change';
48
49        $masterData         = new SC_DB_MasterData_Ex();
50        $this->arrReminder  = $masterData->getMasterData("mtb_reminder");
51        $this->arrPref      = $masterData->getMasterData('mtb_pref');
52        $this->arrJob       = $masterData->getMasterData("mtb_job");
53        $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
54        $this->arrSex       = $masterData->getMasterData("mtb_sex");
55        $this->httpCacheControl('nocache');
56
57        // 生年月日選択肢の取得
58        $objDate            = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now')));
59        $this->arrYear      = $objDate->getYear('', START_BIRTH_YEAR, '');
60        $this->arrMonth     = $objDate->getMonth(true);
61        $this->arrDay       = $objDate->getDay(true);
62    }
63
64    /**
65     * Page のプロセス.
66     *
67     * @return void
68     */
69    function process() {
70        parent::process();
71    }
72
73    /**
74     * Page のプロセス
75     * @return void
76     */
77    function action() {
78        $objCustomer = new SC_Customer_Ex();
79        $customer_id = $objCustomer->getValue('customer_id');
80
81        // mobile用(戻るボタンでの遷移かどうかを判定)
82        if (!empty($_POST['return'])) {
83            $_POST['mode'] = 'return';
84        }
85
86        // パラメーター管理クラス,パラメーター情報の初期化
87        $objFormParam = new SC_FormParam_Ex();
88        SC_Helper_Customer_Ex::sfCustomerMypageParam($objFormParam);
89        $objFormParam->setParam($_POST);    // POST値の取得
90
91        switch ($this->getMode()) {
92            // 確認
93            case 'confirm':
94                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
95                $this->arrForm = $objFormParam->getHashArray();
96
97                // 入力エラーなし
98                if (empty($this->arrErr)) {
99                    //パスワード表示
100                    $this->passlen      = SC_Utils_Ex::sfPassLen(strlen($this->arrForm['password']));
101
102                    $this->tpl_mainpage = 'mypage/change_confirm.tpl';
103                    $this->tpl_title    = '会員登録(確認ページ)';
104                }
105                break;
106            // 会員登録と完了画面
107            case 'complete':
108                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
109                $this->arrForm = $objFormParam->getHashArray();
110
111                // 入力エラーなし
112                if (empty($this->arrErr)) {
113                    // 会員情報の登録
114                    $this->lfRegistCustomerData($objFormParam, $customer_id);
115
116                    // 完了ページに移動させる。
117                    SC_Response_Ex::sendRedirect('change_complete.php');
118                }
119                break;
120            // 確認ページからの戻り
121            case 'return':
122                $this->arrForm = $objFormParam->getHashArray();
123                break;
124            default:
125                $this->arrForm = SC_Helper_Customer_Ex::sfGetCustomerData($customer_id);
126                break;
127        }
128    }
129
130    /**
131     * デストラクタ.
132     *
133     * @return void
134     */
135    function destroy() {
136        parent::destroy();
137    }
138
139    /**
140     *  会員情報を登録する
141     *
142     * @param mixed $objFormParam
143     * @param mixed $customer_id
144     * @access private
145     * @return void
146     */
147    function lfRegistCustomerData(&$objFormParam, $customer_id) {
148        $arrRet             = $objFormParam->getHashArray();
149        $sqlval             = $objFormParam->getDbArray();
150        $sqlval['birth']    = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
151
152        SC_Helper_Customer_Ex::sfEditCustomerData($sqlval, $customer_id);
153    }
154}
Note: See TracBrowser for help on using the repository browser.