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-2007 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_PATH "pages/LC_Page.php");
  26.  
  27. /**
  28.  * お問い合わせ のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id:LC_Page_Contact.php 15532 2007-08-31 14:39:46Z nanasess $
  33.  */
  34. class LC_Page_Contact extends LC_Page {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * フォーム値変換用カラム
  41.      *
  42.      *
  43.      */
  44.      var $arrConvertColumn = array(
  45.                                      array(  "column" => "name01",        "convert" => "aKV" ),
  46.                                      array(  "column" => "name02",        "convert" => "aKV" ),
  47.                                      array(  "column" => "kana01",        "convert" => "CKV" ),
  48.                                      array(  "column" => "kana02",        "convert" => "CKV" ),
  49.                                      array(  "column" => "zip01",        "convert" => "n" ),
  50.                                      array(  "column" => "zip02",        "convert" => "n" ),
  51.                                      array(  "column" => "pref",        "convert" => "n" ),
  52.                                      array(  "column" => "addr01",        "convert" => "aKV" ),
  53.                                      array(  "column" => "addr02",        "convert" => "aKV" ),
  54.                                      array(  "column" => "email",        "convert" => "a" ),
  55.                                      array(  "column" => "tel01",        "convert" => "n" ),
  56.                                      array(  "column" => "tel02",        "convert" => "n" ),
  57.                                      array(  "column" => "tel03",        "convert" => "n" ),
  58.                                      array(  "column" => "contents",   "convert" => "aKV")
  59.                                   );
  60.  
  61.     /**
  62.      * Page を初期化する.
  63.      *
  64.      * @return void 
  65.      */
  66.     function init({
  67.         parent::init();
  68.         $this->tpl_mainpage = 'contact/index.tpl';
  69.         $this->tpl_title = 'お問い合わせ(入力ページ)';
  70.         $this->tpl_page_category = 'contact';
  71.  
  72.         $masterData new SC_DB_MasterData_Ex();
  73.         $this->arrPref $masterData->getMasterData("mtb_pref"array("pref_id""pref_name""rank"));
  74.     }
  75.  
  76.     /**
  77.      * Page のプロセス.
  78.      *
  79.      * @return void 
  80.      */
  81.     function process({
  82.         global $objCampaignSess;
  83.  
  84.         $conn new SC_DBConn();
  85.         $this->objView new SC_SiteView();
  86.         $objCampaignSess new SC_CampaignSession();
  87.         $objDb new SC_Helper_DB_Ex();
  88.         $CONF $objDb->sf_getBasisData();            // 店舗基本情報
  89.         SC_Utils_Ex::sfDomainSessionStart();
  90.  
  91.         $objCustomer new SC_Customer();
  92.  
  93.         $this->arrData = isset($_SESSION['customer']$_SESSION['customer'"";
  94.  
  95.         // レイアウトデザインを取得
  96.         $layout new SC_Helper_PageLayout_Ex();
  97.         $layout->sfGetPageLayout($thisfalseDEF_LAYOUT);
  98.  
  99.         if (!isset($_POST['mode'])) $_POST['mode'"";
  100.  
  101.         switch ($_POST['mode']{
  102.             case 'confirm':
  103.               $this->lfContactConfirm();
  104.               break;
  105.  
  106.             case 'return':
  107.               $this->lfContactReturn();
  108.               break;
  109.  
  110.             case 'complete':
  111.               $this->lfContactComplete();
  112.               break;
  113.  
  114.             default:
  115.               break;
  116.         }
  117.  
  118.         //---- ページ表示
  119.         $this->objView->assignobj($this);
  120.         // フレームを選択(キャンペーンページから遷移なら変更)
  121.         $objCampaignSess->pageView($this->objView);
  122.     }
  123.  
  124.     /**
  125.      * モバイルページを初期化する.
  126.      *
  127.      * @return void 
  128.      */
  129.     function mobileInit({
  130.         $this->init();
  131.     }
  132.  
  133.     /**
  134.      * Page のプロセス(モバイル).
  135.      *
  136.      * @return void 
  137.      */
  138.     function mobileProcess({
  139.         $conn new SC_DBConn();
  140.         $objView new SC_MobileView();
  141.         $objDb new SC_Helper_DB_Ex();
  142.         $CONF $objDb->sf_getBasisData();            // 店舗基本情報
  143.  
  144.         //---- ページ表示
  145.         $objView->assignobj($this);
  146.         $objView->assignarray($CONF);
  147.         $objView->display(SITE_FRAME);
  148.     }
  149.  
  150.     /**
  151.      * デストラクタ.
  152.      *
  153.      * @return void 
  154.      */
  155.     function destroy({
  156.         parent::destroy();
  157.     }
  158.  
  159.     // }}}
  160.     // {{{ protected functions
  161.  
  162.     /**
  163.      * 確認画面
  164.      *
  165.      * @return void 
  166.      */
  167.     function lfContactConfirm({
  168.         // エラーチェック
  169.         $this->arrForm $_POST;
  170.         $this->arrForm['email'strtolower($_POST['email']);
  171.         $this->arrForm $this->lfConvertParam($this->arrForm,$this->arrConvertColumn);
  172.         $this->arrErr $this->lfErrorCheck($this->arrForm);
  173.         if $this->arrErr ){
  174.             // エラー無しで完了画面
  175.             $this->tpl_mainpage = 'contact/confirm.tpl';
  176.             $this->tpl_title = 'お問い合わせ(確認ページ)';
  177.         else {
  178.             foreach ($this->arrForm as $key => $val){
  179.                 $this->$key $val;
  180.             }
  181.         }
  182.     }
  183.  
  184.     /**
  185.      * 前に戻る
  186.      *
  187.      * @return void 
  188.      */
  189.     function lfContactReturn({
  190.         foreach ($_POST as $key => $val){
  191.             $this->$key $val;
  192.         }
  193.     }
  194.  
  195.     /**
  196.      * 完了ページへ
  197.      *
  198.      * @return void 
  199.      */
  200.     function lfContactComplete({
  201.         $this->arrForm $_POST;
  202.         $this->arrForm['email']   = isset($_POST['email']strtolower($_POST['email']'';
  203.         $this->arrForm['email02'= isset($_POST['email02']strtolower($_POST['email02']'';
  204.         $this->arrForm $this->lfConvertParam($this->arrForm,$this->arrConvertColumn);
  205.         $this->arrErr $this->lfErrorCheck($this->arrForm);
  206.         if(!$this->arrErr{
  207.             $this->lfSendMail($this);
  208.             // 完了ページへ移動する
  209.             $this->sendRedirect($this->getLocation("./complete.php"array()true));
  210.             exit;
  211.         else {
  212.             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  213.         }
  214.     }
  215.  
  216.     //エラーチェック処理部
  217.     function lfErrorCheck($array{
  218.         $objErr new SC_CheckError($array);
  219.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
  220.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
  221.         $objErr->doFunc(array("フリガナ(セイ)"'kana01'STEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK""KANA_CHECK"));
  222.         $objErr->doFunc(array("フリガナ(メイ)"'kana02'STEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK""KANA_CHECK"));
  223.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  224.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  225.         $objErr->doFunc(array("ご住所1""addr01"MTEXT_LEN)array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  226.         $objErr->doFunc(array("ご住所2""addr02"MTEXT_LEN)array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  227.         $objErr->doFunc(array("お問い合わせ内容""contents"MLTEXT_LEN)array("EXIST_CHECK""MAX_LENGTH_CHECK"));
  228.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("EXIST_CHECK""EMAIL_CHECK""EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  229.         $objErr->doFunc(array('メールアドレス(確認)'"email02"MTEXT_LEN,array("EXIST_CHECK""EMAIL_CHECK""EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  230.         $objErr->doFunc(array('メールアドレス''メールアドレス(確認)'"email""email02",array("EQUAL_CHECK"));
  231.         $objErr->doFunc(array("お電話番号1"'tel01'TEL_ITEM_LEN)array("NUM_CHECK""MAX_LENGTH_CHECK"));
  232.         $objErr->doFunc(array("お電話番号2"'tel02'TEL_ITEM_LEN)array("NUM_CHECK""MAX_LENGTH_CHECK"));
  233.         $objErr->doFunc(array("お電話番号3"'tel03'TEL_ITEM_LEN)array("NUM_CHECK""MAX_LENGTH_CHECK"));
  234.  
  235.         if (REVIEW_ALLOW_URL == false{
  236.             // URLの入力を禁止
  237.             $masterData new SC_DB_MasterData_Ex();
  238.             $objErr->doFunc(array("URL""contents"$masterData->getMasterData("mtb_review_deny_url"))array("PROHIBITED_STR_CHECK"));
  239.         }
  240.  
  241.         return $objErr->arrErr;
  242.     }
  243.  
  244.     //---- 取得文字列の変換
  245.     function lfConvertParam($array$arrConvertColumn{
  246.         /*
  247.          *    文字列の変換
  248.          *    K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
  249.          *    C :  「全角ひら仮名」を「全角かた仮名」に変換
  250.          *    V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
  251.          *    n :  「全角」数字を「半角(ハンカク)」に変換
  252.          *  a :  全角英数字を半角英数字に変換する
  253.          */
  254.         // カラム名とコンバート情報
  255.         foreach ($arrConvertColumn as $data{
  256.             $arrConvList$data["column"] ] $data["convert"];
  257.         }
  258.  
  259.         // 文字変換
  260.         foreach ($arrConvList as $key => $val{
  261.             // POSTされてきた値のみ変換する。
  262.             if(strlen(($array[$key])) 0{
  263.                 $array[$keymb_convert_kana($array[$key,$val);
  264.             }
  265.         }
  266.         return $array;
  267.     }
  268.  
  269.     // ------------  メール送信 ------------
  270.  
  271.     function lfSendMail(&$objPage){
  272.         $objDb new SC_Helper_DB_Ex();
  273.         $CONF $objDb->sf_getBasisData();            // 店舗基本情報
  274.         $objQuery new SC_Query();
  275.         $objSiteInfo $this->objView->objSiteInfo;
  276.         $arrInfo $objSiteInfo->data;
  277.         $objPage->tpl_shopname $arrInfo['shop_name'];
  278.         $objPage->tpl_infoemail $arrInfo['email02'];
  279.  
  280.         $fromMail_name $objPage->arrForm['name01'." 様";
  281.         $fromMail_address $objPage->arrForm['email'];
  282.  
  283.         $helperMail new SC_Helper_Mail_Ex();
  284.         $helperMail->sfSendTemplateMail($CONF["email02"]$CONF["shop_name"]"5"$objPage$fromMail_address$fromMail_name$fromMail_address);
  285.         $helperMail->sfSendTemplateMail($objPage->arrForm['email']$objPage->arrForm['name01'." 様""5"$objPage$CONF["email03"]$CONF["shop_name"]$CONF["email02"]);
  286.     }
  287. }
  288. ?>

Documentation generated on Tue, 28 Apr 2009 18:12:03 +0900 by phpDocumentor 1.4.2