source: branches/version-2_12-multilang/data/class/pages/contact/LC_Page_Contact.php @ 22510

Revision 22510, 8.3 KB checked in by kim, 11 years ago (diff)

#2084 ID振り直し 複数形を考慮している英語の翻訳がおかしい箇所などをあわせて調整しています。

  • 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-2012 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
25require_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 */
34class LC_Page_Contact extends LC_Page_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
47            $this->tpl_title = t('c_Inquiry_01');
48        } else {
49            $this->tpl_title = t('c_Inquiry_02');
50        }
51        $this->tpl_page_category = 'contact';
52        $this->httpCacheControl('nocache');
53
54        $masterData = new SC_DB_MasterData_Ex();
55        $this->arrPref = $masterData->getMasterData('mtb_pref');
56
57        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
58            // @deprecated EC-CUBE 2.11 テンプレート互換用
59            $this->CONF = SC_Helper_DB_Ex::sfGetBasisData();
60        }
61    }
62
63    /**
64     * Page のプロセス.
65     *
66     * @return void
67     */
68    function process() {
69        parent::process();
70        $this->action();
71        $this->sendResponse();
72    }
73
74    /**
75     * Page のアクション.
76     *
77     * @return void
78     */
79    function action() {
80
81        $objDb = new SC_Helper_DB_Ex();
82        $objFormParam = new SC_FormParam_Ex();
83
84        $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : '';
85
86        switch ($this->getMode()) {
87            case 'confirm':
88                // エラーチェック
89                $this->lfInitParam($objFormParam);
90                $objFormParam->setParam($_POST);
91                $objFormParam->convParam();
92                $objFormParam->toLower('email');
93                $objFormParam->toLower('email02');
94                $this->arrErr = $this->lfCheckError($objFormParam);
95                // 入力値の取得
96                $this->arrForm = $objFormParam->getFormParamList();
97
98                if (SC_Utils_Ex::isBlank($this->arrErr)) {
99                    // エラー無しで完了画面
100                    $this->tpl_mainpage = 'contact/confirm.tpl';
101                    //$this->tpl_title = 'お問い合わせ(確認ページ)';
102                    $this->tpl_title = t('c_Inquiry_03');
103                }
104
105                break;
106
107            case 'return':
108                $this->lfInitParam($objFormParam);
109                $objFormParam->setParam($_POST);
110                $this->arrForm = $objFormParam->getFormParamList();
111
112                break;
113
114            case 'complete':
115                $this->lfInitParam($objFormParam);
116                $objFormParam->setParam($_POST);
117                $this->arrErr = $objFormParam->checkError();
118                $this->arrForm = $objFormParam->getFormParamList();
119                if (SC_Utils_Ex::isBlank($this->arrErr)) {
120                    $this->lfSendMail($this);
121
122
123                    // 完了ページへ移動する
124                    SC_Response_Ex::sendRedirect('complete.php');
125                    SC_Response_Ex::actionExit();
126                } else {
127                    SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
128                    SC_Response_Ex::actionExit();
129                }
130                break;
131
132            default:
133                break;
134        }
135
136    }
137
138    /**
139     * デストラクタ.
140     *
141     * @return void
142     */
143    function destroy() {
144        parent::destroy();
145    }
146
147    // }}}
148    // {{{ protected functions
149
150    /**
151     * お問い合わせ入力時のパラメーター情報の初期化を行う.
152     *
153     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
154     * @return void
155     */
156    function lfInitParam(&$objFormParam) {
157
158        $objFormParam->addParam(t('c_Name (last name)_01'), 'name01', STEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK'));
159        $objFormParam->addParam(t('c_Name (first name)_01'), 'name02', STEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK'));
160        $objFormParam->addParam(t('c_Name (last name) KANA_01'), 'kana01', STEXT_LEN, 'KVCa', array('SPTAB_CHECK','MAX_LENGTH_CHECK', 'KANA_CHECK'));
161        $objFormParam->addParam(t('c_Name (first name) KANA_01'), 'kana02', STEXT_LEN, 'KVCa', array('SPTAB_CHECK','MAX_LENGTH_CHECK', 'KANA_CHECK'));
162//        $objFormParam->addParam(t('c_Postal code 1_01'), 'zip01', ZIP01_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'NUM_COUNT_CHECK'));
163//        $objFormParam->addParam(t('c_Postal code 2_01'), 'zip02', ZIP02_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'NUM_COUNT_CHECK'));
164        $objFormParam->addParam(t('c_Postal code_01'), 'zipcode', ZIPCODE_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'MAX_LENGTH_CHECK'));
165        $objFormParam->addParam(t('c_Prefecture_01'), 'pref', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
166        $objFormParam->addParam(t('c_Address 1_01'), 'addr01', MTEXT_LEN, 'KVa', array('SPTAB_CHECK' ,'MAX_LENGTH_CHECK'));
167        $objFormParam->addParam(t('c_Address 2_01'), 'addr02', MTEXT_LEN, 'KVa', array('SPTAB_CHECK' ,'MAX_LENGTH_CHECK'));
168        $objFormParam->addParam(t('c_Details of inquiry_01'), 'contents', MLTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
169        $objFormParam->addParam(t('c_E-mail address_01'), 'email', null, 'KVa',array('EXIST_CHECK', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK'));
170        $objFormParam->addParam(t('c_E-mail address (confirmation)_01'), 'email02', null, 'KVa',array('EXIST_CHECK', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK'));
171        $objFormParam->addParam(t('c_Telephone number 1_01'), 'tel01', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
172        $objFormParam->addParam(t('c_Telephone number 2_01'), 'tel02', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
173        $objFormParam->addParam(t('c_Telephone number 3_01'), 'tel03', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
174    }
175
176    /**
177     * 入力内容のチェックを行なう.
178     *
179     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
180     * @return array 入力チェック結果の配列
181     */
182    function lfCheckError(&$objFormParam) {
183        // 入力データを渡す。
184        $arrForm =  $objFormParam->getHashArray();
185        $objErr = new SC_CheckError_Ex($arrForm);
186        $objErr->arrErr = $objFormParam->checkError();
187        $objErr->doFunc(array(t('c_E-mail address_01'), t('c_E-mail address (confirmation)_01'), 'email', 'email02') ,array('EQUAL_CHECK'));
188        return $objErr->arrErr;
189    }
190
191    /**
192     * メールの送信を行う。
193     *
194     * @return void
195     */
196    function lfSendMail(&$objPage) {
197        $CONF = SC_Helper_DB_Ex::sfGetBasisData();
198        $objPage->tpl_shopname = $CONF['shop_name'];
199        $objPage->tpl_infoemail = $CONF['email02'];
200        $helperMail = new SC_Helper_Mail_Ex();
201        $helperMail->setPage($this);
202        $helperMail->sfSendTemplateMail(
203            $objPage->arrForm['email']['value'],            // to
204            t('f_LAST_NAME_SIR_01', array('T_ARG1' => $objPage->arrForm['name01']['value'])), // to_name
205            5,                                              // template_id
206            $objPage,                                       // objPage
207            $CONF['email03'],                               // from_address
208            $CONF['shop_name'],                             // from_name
209            $CONF['email02'],                               // reply_to
210            $CONF['email02']                                // bcc
211        );
212    }
213}
Note: See TracBrowser for help on using the repository browser.