Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Contact.php

Documentation is available at LC_Page_Contact.php

  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: LC_Page_Contact.php 21198 2011-08-18 12:08:40Z shutta $
  33.  */
  34. class 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 'お問い合わせ';
  48.         else {
  49.             $this->tpl_title 'お問い合わせ(入力ページ)';
  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.             $this->CONF SC_Helper_DB_Ex::sfGetBasisData();
  59.         }
  60.     }
  61.  
  62.     /**
  63.      * Page のプロセス.
  64.      *
  65.      * @return void 
  66.      */
  67.     function process({
  68.         $this->action();
  69.         $this->sendResponse();
  70.     }
  71.  
  72.     /**
  73.      * Page のアクション.
  74.      *
  75.      * @return void 
  76.      */
  77.     function action({
  78.         $objDb new SC_Helper_DB_Ex();
  79.         $objFormParam new SC_FormParam_Ex();
  80.  
  81.         $this->arrData = isset($_SESSION['customer']$_SESSION['customer'"";
  82.  
  83.         switch ($this->getMode()) {
  84.         case 'confirm':
  85.             // エラーチェック
  86.             $this->lfInitParam($objFormParam);
  87.             $objFormParam->setParam($_POST);
  88.             $objFormParam->convParam();
  89.             $objFormParam->toLower('email');
  90.             $objFormParam->toLower('email02');
  91.             $this->arrErr $this->lfCheckError($objFormParam);
  92.             // 入力値の取得
  93.             $this->arrForm $objFormParam->getFormParamList();
  94.  
  95.             if (SC_Utils_Ex::isBlank($this->arrErr)) {
  96.                 // エラー無しで完了画面
  97.                 $this->tpl_mainpage 'contact/confirm.tpl';
  98.                 $this->tpl_title 'お問い合わせ(確認ページ)';
  99.             }
  100.  
  101.             break;
  102.  
  103.         case 'return':
  104.             $this->lfInitParam($objFormParam);
  105.             $objFormParam->setParam($_POST);
  106.             $this->arrForm $objFormParam->getFormParamList();
  107.  
  108.             break;
  109.  
  110.         case 'complete':
  111.             $this->lfInitParam($objFormParam);
  112.             $objFormParam->setParam($_POST);
  113.             $this->arrErr $objFormParam->checkError();
  114.             $this->arrForm $objFormParam->getFormParamList();
  115.             if (SC_Utils_Ex::isBlank($this->arrErr)) {
  116.                 $this->lfSendMail($this);
  117.                 // 完了ページへ移動する
  118.                 SC_Response_Ex::sendRedirect('complete.php');
  119.                 exit;
  120.             else {
  121.                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  122.                 exit;
  123.             }
  124.             break;
  125.  
  126.         default:
  127.             break;
  128.         }
  129.     }
  130.  
  131.     /**
  132.      * デストラクタ.
  133.      *
  134.      * @return void 
  135.      */
  136.     function destroy({
  137.         parent::destroy();
  138.     }
  139.  
  140.     // }}}
  141.     // {{{ protected functions
  142.  
  143.     /**
  144.      * お問い合わせ入力時のパラメーター情報の初期化を行う.
  145.      *
  146.      * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  147.      * @return void 
  148.      */
  149.     function lfInitParam(&$objFormParam{
  150.  
  151.         $objFormParam->addParam("お名前(姓)"'name01'STEXT_LEN'KVa'array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
  152.         $objFormParam->addParam("お名前(名)"'name02'STEXT_LEN'KVa'array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
  153.         $objFormParam->addParam("お名前(フリガナ・姓)"'kana01'STEXT_LEN'KVCa'array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK""KANA_CHECK"));
  154.         $objFormParam->addParam("お名前(フリガナ・名)"'kana02'STEXT_LEN'KVCa'array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK""KANA_CHECK"));
  155.         $objFormParam->addParam("郵便番号1""zip01"ZIP01_LEN'n',array("SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  156.         $objFormParam->addParam("郵便番号2""zip02"ZIP02_LEN'n',array("SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  157.         $objFormParam->addParam("都道府県"'pref'INT_LEN'n'array("MAX_LENGTH_CHECK""NUM_CHECK"));
  158.         $objFormParam->addParam("住所1""addr01"MTEXT_LEN'KVa'array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  159.         $objFormParam->addParam("住所2""addr02"MTEXT_LEN'KVa'array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  160.         $objFormParam->addParam("お問い合わせ内容"'contents'MLTEXT_LEN'KVa'array("EXIST_CHECK""MAX_LENGTH_CHECK"));
  161.         $objFormParam->addParam('メールアドレス''email'null'KVa',array("EXIST_CHECK""EMAIL_CHECK""EMAIL_CHAR_CHECK"));
  162.         $objFormParam->addParam('メールアドレス(確認)'"email02"null'KVa',array("EXIST_CHECK""EMAIL_CHECK""EMAIL_CHAR_CHECK"));
  163.         $objFormParam->addParam("お電話番号1"'tel01'TEL_ITEM_LEN'n'array("NUM_CHECK""MAX_LENGTH_CHECK"));
  164.         $objFormParam->addParam("お電話番号2"'tel02'TEL_ITEM_LEN'n'array("NUM_CHECK""MAX_LENGTH_CHECK"));
  165.         $objFormParam->addParam("お電話番号3"'tel03'TEL_ITEM_LEN'n'array("NUM_CHECK""MAX_LENGTH_CHECK"));
  166.     }
  167.  
  168.     /**
  169.      * 入力内容のチェックを行なう.
  170.      *
  171.      * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  172.      * @return array 入力チェック結果の配列
  173.      */
  174.     function lfCheckError(&$objFormParam{
  175.         // 入力データを渡す。
  176.         $arrForm =  $objFormParam->getHashArray();
  177.         $objErr new SC_CheckError_Ex($arrForm);
  178.         $objErr->arrErr $objFormParam->checkError();
  179.         $objErr->doFunc(array('メールアドレス''メールアドレス(確認)''email'"email02",array("EQUAL_CHECK"));
  180.         return $objErr->arrErr;
  181.     }
  182.  
  183.     /**
  184.      * メールの送信を行う。
  185.      *
  186.      * @return void 
  187.      */
  188.     function lfSendMail(&$objPage){
  189.         $CONF SC_Helper_DB_Ex::sfGetBasisData();
  190.         $objPage->tpl_shopname $CONF['shop_name'];
  191.         $objPage->tpl_infoemail $CONF['email02'];
  192.         $fromMail_name $objPage->arrForm['name01']['value'." 様";
  193.         $fromMail_address $objPage->arrForm['email']['value'];
  194.         $helperMail new SC_Helper_Mail_Ex();
  195.         $helperMail->sfSendTemplateMail(
  196.             $objPage->arrForm['email']['value'],            // to
  197.             $objPage->arrForm['name01']['value'.' 様',    // to_name
  198.             5,                                              // template_id
  199.             $objPage,                                       // objPage
  200.             $CONF['email03'],                               // from_address
  201.             $CONF['shop_name'],                             // from_name
  202.             $CONF['email02'],                               // reply_to
  203.             $CONF['email02']                                // bcc
  204.         );
  205.     }
  206. }
  207. ?>

Documentation generated on Fri, 24 Feb 2012 14:01:54 +0900 by Seasoft