1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2014 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 | require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php'; |
---|
25 | |
---|
26 | /** |
---|
27 | * 携帯メールアドレス登録のページクラス. |
---|
28 | * |
---|
29 | * @package Page |
---|
30 | * @author LOCKON CO.,LTD. |
---|
31 | * @version $Id$ |
---|
32 | */ |
---|
33 | class LC_Page_Entry_EmailMobile extends LC_Page_Ex |
---|
34 | { |
---|
35 | /** |
---|
36 | * Page を初期化する. |
---|
37 | * |
---|
38 | * @return void |
---|
39 | */ |
---|
40 | public function init() |
---|
41 | { |
---|
42 | parent::init(); |
---|
43 | } |
---|
44 | |
---|
45 | /** |
---|
46 | * Page のプロセス. |
---|
47 | * |
---|
48 | * @return void |
---|
49 | */ |
---|
50 | public function process() |
---|
51 | { |
---|
52 | parent::process(); |
---|
53 | $this->action(); |
---|
54 | $this->sendResponse(); |
---|
55 | } |
---|
56 | |
---|
57 | /** |
---|
58 | * Page のアクション. |
---|
59 | * |
---|
60 | * @return void |
---|
61 | */ |
---|
62 | public function action() |
---|
63 | { |
---|
64 | $objCustomer = new SC_Customer_Ex(); |
---|
65 | $objFormParam = new SC_FormParam_Ex(); |
---|
66 | |
---|
67 | $this->lfInitParam($objFormParam); |
---|
68 | $objFormParam->setParam($_POST); |
---|
69 | |
---|
70 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
---|
71 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
72 | |
---|
73 | if (empty($this->arrErr)) { |
---|
74 | $email_mobile = $this->lfRegistEmailMobile(strtolower($objFormParam->getValue('email_mobile')), |
---|
75 | $objCustomer->getValue('customer_id')); |
---|
76 | |
---|
77 | $objCustomer->setValue('email_mobile', $email_mobile); |
---|
78 | $this->tpl_mainpage = 'entry/email_mobile_complete.tpl'; |
---|
79 | $this->tpl_title = '携帯メール登録完了'; |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | $this->tpl_name = $objCustomer->getValue('name01'); |
---|
84 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
85 | } |
---|
86 | |
---|
87 | /** |
---|
88 | * lfInitParam |
---|
89 | * |
---|
90 | * @access public |
---|
91 | * @param SC_FormParam_Ex $objFormParam |
---|
92 | * @return void |
---|
93 | */ |
---|
94 | public function lfInitParam(&$objFormParam) |
---|
95 | { |
---|
96 | $objFormParam->addParam('メールアドレス', 'email_mobile', null, 'a', |
---|
97 | array('NO_SPTAB', 'EXIST_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'EMAIL_CHECK', 'MOBILE_EMAIL_CHECK')); |
---|
98 | } |
---|
99 | |
---|
100 | /** |
---|
101 | * エラーチェックする |
---|
102 | * |
---|
103 | * @param mixed $objFormParam |
---|
104 | * @access private |
---|
105 | * @return array エラー情報の配列 |
---|
106 | */ |
---|
107 | public function lfCheckError(&$objFormParam) |
---|
108 | { |
---|
109 | $objFormParam->convParam(); |
---|
110 | $objErr = new SC_CheckError_Ex(); |
---|
111 | $objErr->arrErr = $objFormParam->checkError(); |
---|
112 | |
---|
113 | // FIXME: lfInitParam() で設定すれば良いように感じる |
---|
114 | $objErr->doFunc(array('メールアドレス', 'email_mobile'), array('CHECK_REGIST_CUSTOMER_EMAIL')); |
---|
115 | |
---|
116 | return $objErr->arrErr; |
---|
117 | } |
---|
118 | |
---|
119 | /** |
---|
120 | * |
---|
121 | * 携帯メールアドレスが登録されていないユーザーに携帯アドレスを登録する |
---|
122 | * |
---|
123 | * 登録完了後にsessionのemail_mobileを更新する |
---|
124 | * |
---|
125 | * @access private |
---|
126 | * @param string $email_mobile |
---|
127 | * @return void |
---|
128 | */ |
---|
129 | public function lfRegistEmailMobile($email_mobile, $customer_id) |
---|
130 | { |
---|
131 | $objQuery = SC_Query_Ex::getSingletonInstance(); |
---|
132 | $objQuery->update('dtb_customer', |
---|
133 | array('email_mobile' => $email_mobile), |
---|
134 | 'customer_id = ?', array($customer_id)); |
---|
135 | |
---|
136 | return $email_mobile; |
---|
137 | } |
---|
138 | } |
---|