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

Revision 22857, 7.4 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。
  • 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-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
25
26/**
27 * 登録内容変更 のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Mypage_Change extends LC_Page_AbstractMypage_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43        $this->tpl_subtitle = '会員登録内容変更(入力ページ)';
44        $this->tpl_mypageno = 'change';
45
46        $masterData         = new SC_DB_MasterData_Ex();
47        $this->arrReminder  = $masterData->getMasterData('mtb_reminder');
48        $this->arrPref      = $masterData->getMasterData('mtb_pref');
49        $this->arrJob       = $masterData->getMasterData('mtb_job');
50        $this->arrMAILMAGATYPE = $masterData->getMasterData('mtb_mail_magazine_type');
51        $this->arrSex       = $masterData->getMasterData('mtb_sex');
52        $this->httpCacheControl('nocache');
53
54        // 生年月日選択肢の取得
55        $objDate            = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now')));
56        $this->arrYear      = $objDate->getYear('', START_BIRTH_YEAR, '');
57        $this->arrMonth     = $objDate->getMonth(true);
58        $this->arrDay       = $objDate->getDay(true);
59    }
60
61    /**
62     * Page のプロセス.
63     *
64     * @return void
65     */
66    function process()
67    {
68        parent::process();
69    }
70
71    /**
72     * Page のプロセス
73     * @return void
74     */
75    function action()
76    {
77        $objCustomer = new SC_Customer_Ex();
78        $customer_id = $objCustomer->getValue('customer_id');
79
80        // mobile用(戻るボタンでの遷移かどうかを判定)
81        if (!empty($_POST['return'])) {
82            $_POST['mode'] = 'return';
83        }
84
85        // パラメーター管理クラス,パラメーター情報の初期化
86        $objFormParam = new SC_FormParam_Ex();
87        SC_Helper_Customer_Ex::sfCustomerMypageParam($objFormParam);
88        $objFormParam->setParam($_POST);    // POST値の取得
89
90        switch ($this->getMode()) {
91            // 確認
92            case 'confirm':
93                if (isset($_POST['submit_address'])) {
94                    // 入力エラーチェック
95                    $this->arrErr = $this->lfCheckError($_POST);
96                    // 入力エラーの場合は終了
97                    if (count($this->arrErr) == 0) {
98                        // 郵便番号検索文作成
99                        $zipcode = $_POST['zip01'] . $_POST['zip02'];
100
101                        // 郵便番号検索
102                        $arrAdsList = SC_Utils_Ex::sfGetAddress($zipcode);
103
104                        // 郵便番号が発見された場合
105                        if (!empty($arrAdsList)) {
106                            $data['pref'] = $arrAdsList[0]['state'];
107                            $data['addr01'] = $arrAdsList[0]['city']. $arrAdsList[0]['town'];
108                            $objFormParam->setParam($data);
109                        }
110                        // 該当無し
111                        else {
112                            $this->arrErr['zip01'] = '※該当する住所が見つかりませんでした。<br>';
113                        }
114                    }
115                    $this->arrForm  = $objFormParam->getHashArray();
116                    break;
117                }
118                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
119                $this->arrForm = $objFormParam->getHashArray();
120
121                // 入力エラーなし
122                if (empty($this->arrErr)) {
123                    //パスワード表示
124                    $this->passlen      = SC_Utils_Ex::sfPassLen(strlen($this->arrForm['password']));
125
126                    $this->tpl_mainpage = 'mypage/change_confirm.tpl';
127                    $this->tpl_title    = '会員登録(確認ページ)';
128                    $this->tpl_subtitle = '会員登録内容変更(確認ページ)';
129                }
130                break;
131            // 会員登録と完了画面
132            case 'complete':
133                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
134                $this->arrForm = $objFormParam->getHashArray();
135
136                // 入力エラーなし
137                if (empty($this->arrErr)) {
138                    // 会員情報の登録
139                    $this->lfRegistCustomerData($objFormParam, $customer_id);
140
141                    //セッション情報を最新の状態に更新する
142                    $objCustomer->updateSession();
143
144                    // 完了ページに移動させる。
145                    SC_Response_Ex::sendRedirect('change_complete.php');
146                }
147                break;
148            // 確認ページからの戻り
149            case 'return':
150                $this->arrForm = $objFormParam->getHashArray();
151                break;
152            default:
153                $this->arrForm = SC_Helper_Customer_Ex::sfGetCustomerData($customer_id);
154                break;
155        }
156
157    }
158
159    /**
160     * デストラクタ.
161     *
162     * @return void
163     */
164    function destroy()
165    {
166        parent::destroy();
167    }
168
169    /**
170     *  会員情報を登録する
171     *
172     * @param mixed $objFormParam
173     * @param mixed $customer_id
174     * @access private
175     * @return void
176     */
177    function lfRegistCustomerData(&$objFormParam, $customer_id)
178    {
179        $arrRet             = $objFormParam->getHashArray();
180        $sqlval             = $objFormParam->getDbArray();
181        $sqlval['birth']    = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
182
183        SC_Helper_Customer_Ex::sfEditCustomerData($sqlval, $customer_id);
184    }
185
186    /**
187     * 入力エラーのチェック.
188     *
189     * @param array $arrRequest リクエスト値($_GET)
190     * @return array $arrErr エラーメッセージ配列
191     */
192    function lfCheckError($arrRequest)
193    {
194        // パラメーター管理クラス
195        $objFormParam = new SC_FormParam_Ex();
196        // パラメーター情報の初期化
197        $objFormParam->addParam('郵便番号1', 'zip01', ZIP01_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
198        $objFormParam->addParam('郵便番号2', 'zip02', ZIP02_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
199        // // リクエスト値をセット
200        $arrData['zip01'] = $arrRequest['zip01'];
201        $arrData['zip02'] = $arrRequest['zip02'];
202        $objFormParam->setParam($arrData);
203        // エラーチェック
204        $arrErr = $objFormParam->checkError();
205
206        return $arrErr;
207    }
208}
Note: See TracBrowser for help on using the repository browser.