source: branches/version-2_5-dev/data/class/pages/contact/LC_Page_Contact.php @ 20344

Revision 20344, 6.7 KB checked in by shutta, 10 years ago (diff)

LC_Pageクラスのclass_extends対応。

  • 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-2010 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        $this->tpl_title = 'お問い合わせ(入力ページ)';
47        $this->tpl_page_category = 'contact';
48        $this->httpCacheControl('nocache');
49
50        $masterData = new SC_DB_MasterData_Ex();
51        $this->arrPref = $masterData->getMasterData('mtb_pref');
52    }
53
54    /**
55     * Page のプロセス.
56     *
57     * @return void
58     */
59    function process() {
60        $this->action();
61        $this->sendResponse();
62    }
63
64    /**
65     * Page のアクション.
66     *
67     * @return void
68     */
69    function action() {
70        $objDb = new SC_Helper_DB_Ex();
71        $objFormParam = new SC_FormParam();
72
73        $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : "";
74
75        switch ($this->getMode()) {
76        case 'confirm':
77            // エラーチェック
78            $this->lfInitParam($objFormParam);
79            $objFormParam->setParam($_POST);
80            $objFormParam->convParam();
81            $objFormParam->toLower('email');
82            $objFormParam->toLower('email02');
83            $this->arrErr = $objFormParam->checkError();
84            // 入力値の取得
85            $this->arrForm = $objFormParam->getFormParamList();
86
87            if (SC_Utils_Ex::isBlank($this->arrErr)) {
88                // エラー無しで完了画面
89                $this->tpl_mainpage = 'contact/confirm.tpl';
90                $this->tpl_title = 'お問い合わせ(確認ページ)';
91            }
92
93            break;
94
95        case 'return':
96            $this->lfInitParam($objFormParam);
97            $objFormParam->setParam($_POST);
98            $this->arrForm = $objFormParam->getFormParamList();
99
100            break;
101
102        case 'complete':
103            $this->lfInitParam($objFormParam);
104            $objFormParam->setParam($_POST);
105            $this->arrErr = $objFormParam->checkError();
106            $this->arrForm = $objFormParam->getFormParamList();
107            if (SC_Utils_Ex::isBlank($this->arrErr)) {
108                $this->lfSendMail($this);
109                // 完了ページへ移動する
110                SC_Response_Ex::sendRedirect('complete.php');
111                exit;
112            } else {
113                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
114                exit;
115            }
116            break;
117
118        default:
119            break;
120        }
121    }
122
123    /**
124     * デストラクタ.
125     *
126     * @return void
127     */
128    function destroy() {
129        parent::destroy();
130    }
131
132    // }}}
133    // {{{ protected functions
134
135    /**
136     * お問い合わせ入力時のパラメータ情報の初期化を行う.
137     *
138     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
139     * @return void
140     */
141    function lfInitParam(&$objFormParam) {
142
143        $objFormParam->addParam("お名前(姓)", 'name01', STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
144        $objFormParam->addParam("お名前(名)", 'name02', STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
145        $objFormParam->addParam("お名前(フリガナ・姓)", 'kana01', STEXT_LEN, "KVCa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
146        $objFormParam->addParam("お名前(フリガナ・名)", 'kana02', STEXT_LEN, "KVCa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
147        $objFormParam->addParam("郵便番号1", "zip01", ZIP01_LEN, "n",array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
148        $objFormParam->addParam("郵便番号2", "zip02", ZIP02_LEN, "n",array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
149        $objFormParam->addParam("都道府県", "pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
150        $objFormParam->addParam("住所1", "addr01", MTEXT_LEN, "KVa", array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
151        $objFormParam->addParam("住所2", "addr02", MTEXT_LEN, "KVa", array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
152        $objFormParam->addParam("お問い合わせ内容", "contents", MLTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
153        $objFormParam->addParam('メールアドレス', "email", MTEXT_LEN, "KVa",array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
154        $objFormParam->addParam('メールアドレス(確認)', "email02", MTEXT_LEN, "KVa",array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
155        $objFormParam->addParam("お電話番号1", 'tel01', TEL_ITEM_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
156        $objFormParam->addParam("お電話番号2", 'tel02', TEL_ITEM_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
157        $objFormParam->addParam("お電話番号3", 'tel03', TEL_ITEM_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
158    }
159
160    /**
161     * メールの送信を行う。
162     *
163     * @return void
164     */
165    function lfSendMail(&$objPage){
166        $CONF = SC_Helper_DB_Ex::sfGetBasisData();
167        $objPage->tpl_shopname = $CONF['shop_name'];
168        $objPage->tpl_infoemail = $CONF['email02'];
169        $fromMail_name = $objPage->arrForm['name01']['value'] ." 様";
170        $fromMail_address = $objPage->arrForm['email']['value'];
171        $helperMail = new SC_Helper_Mail_Ex();
172        $helperMail->sfSendTemplateMail($CONF["email02"], $CONF["shop_name"], "5", $objPage, $fromMail_address, $fromMail_name, $fromMail_address);
173        $helperMail->sfSendTemplateMail($objPage->arrForm['email']['value'], $objPage->arrForm['name01']['value'] ." 様", "5", $objPage, $CONF["email03"], $CONF["shop_name"], $CONF["email02"]);
174    }
175}
176?>
Note: See TracBrowser for help on using the repository browser.