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