source: branches/version-2_13-dev/data/class/pages/entry/LC_Page_Entry_EmailMobile.php @ 22856

Revision 22856, 4.1 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/LC_Page_Ex.php';
25
26/**
27 * 携帯メールアドレス登録のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Entry_EmailMobile extends LC_Page_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43
44    }
45
46    /**
47     * Page のプロセス.
48     *
49     * @return void
50     */
51    function process()
52    {
53        parent::process();
54        $this->action();
55        $this->sendResponse();
56    }
57
58    /**
59     * Page のアクション.
60     *
61     * @return void
62     */
63    function action()
64    {
65        $objCustomer    = new SC_Customer_Ex();
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     * デストラクタ.
92     *
93     * @return void
94     */
95    function destroy()
96    {
97        parent::destroy();
98    }
99
100    /**
101     * lfInitParam
102     *
103     * @access public
104     * @return void
105     */
106    function lfInitParam(&$objFormParam)
107    {
108        $objFormParam->addParam('メールアドレス', 'email_mobile', null, 'a',
109                                array('NO_SPTAB', 'EXIST_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'EMAIL_CHECK', 'MOBILE_EMAIL_CHECK'));
110    }
111
112    /**
113     * エラーチェックする
114     *
115     * @param mixed $objFormParam
116     * @param mixed $objCustomer
117     * @access private
118     * @return array エラー情報の配列
119     */
120    function lfCheckError(&$objFormParam)
121    {
122        $objFormParam->convParam();
123        $objErr         = new SC_CheckError_Ex();
124        $objErr->arrErr = $objFormParam->checkError();
125
126        // FIXME: lfInitParam() で設定すれば良いように感じる
127        $objErr->doFunc(array('メールアドレス', 'email_mobile'), array('CHECK_REGIST_CUSTOMER_EMAIL'));
128
129        return $objErr->arrErr;
130    }
131
132    /**
133     *
134     * 携帯メールアドレスが登録されていないユーザーに携帯アドレスを登録する
135     *
136     * 登録完了後にsessionのemail_mobileを更新する
137     *
138     * @param mixed $objFormParam
139     * @param mixed $objCustomer
140     * @access private
141     * @return void
142     */
143    function lfRegistEmailMobile($email_mobile, $customer_id)
144    {
145        $objQuery = SC_Query_Ex::getSingletonInstance();
146        $objQuery->update('dtb_customer',
147                          array('email_mobile' => $email_mobile),
148                          'customer_id = ?', array($customer_id));
149
150        return $email_mobile;
151    }
152}
Note: See TracBrowser for help on using the repository browser.