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