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