tpl_title = t('c_Inquiry_01'); } else { $this->tpl_title = t('c_Inquiry_02'); } $this->tpl_page_category = 'contact'; $this->httpCacheControl('nocache'); $masterData = new SC_DB_MasterData_Ex(); $this->arrPref = $masterData->getMasterData('mtb_pref'); if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { // @deprecated EC-CUBE 2.11 テンプレート互換用 $this->CONF = SC_Helper_DB_Ex::sfGetBasisData(); } } /** * Page のプロセス. * * @return void */ function process() { parent::process(); $this->action(); $this->sendResponse(); } /** * Page のアクション. * * @return void */ function action() { $objDb = new SC_Helper_DB_Ex(); $objFormParam = new SC_FormParam_Ex(); $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : ''; switch ($this->getMode()) { case 'confirm': // エラーチェック $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $objFormParam->toLower('email'); $objFormParam->toLower('email02'); $this->arrErr = $this->lfCheckError($objFormParam); // 入力値の取得 $this->arrForm = $objFormParam->getFormParamList(); if (SC_Utils_Ex::isBlank($this->arrErr)) { // エラー無しで完了画面 $this->tpl_mainpage = 'contact/confirm.tpl'; //$this->tpl_title = 'お問い合わせ(確認ページ)'; $this->tpl_title = t('c_Inquiry_03'); } break; case 'return': $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrForm = $objFormParam->getFormParamList(); break; case 'complete': $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $objFormParam->checkError(); $this->arrForm = $objFormParam->getFormParamList(); if (SC_Utils_Ex::isBlank($this->arrErr)) { $this->lfSendMail($this); // 完了ページへ移動する SC_Response_Ex::sendRedirect('complete.php'); SC_Response_Ex::actionExit(); } else { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); SC_Response_Ex::actionExit(); } break; default: break; } } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } // }}} // {{{ protected functions /** * お問い合わせ入力時のパラメーター情報の初期化を行う. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return void */ function lfInitParam(&$objFormParam) { $objFormParam->addParam(t('c_Name (last name)_01'), 'name01', STEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Name (first name)_01'), 'name02', STEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Name (last name) KANA_01'), 'kana01', STEXT_LEN, 'KVCa', array('SPTAB_CHECK','MAX_LENGTH_CHECK', 'KANA_CHECK')); $objFormParam->addParam(t('c_Name (first name) KANA_01'), 'kana02', STEXT_LEN, 'KVCa', array('SPTAB_CHECK','MAX_LENGTH_CHECK', 'KANA_CHECK')); // $objFormParam->addParam(t('c_Postal code 1_01'), 'zip01', ZIP01_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'NUM_COUNT_CHECK')); // $objFormParam->addParam(t('c_Postal code 2_01'), 'zip02', ZIP02_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'NUM_COUNT_CHECK')); $objFormParam->addParam(t('c_Postal code_01'), 'zipcode', ZIPCODE_LEN, 'n',array('SPTAB_CHECK' ,'NUM_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Prefecture_01'), 'pref', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); $objFormParam->addParam(t('c_Address 1_01'), 'addr01', MTEXT_LEN, 'KVa', array('SPTAB_CHECK' ,'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Address 2_01'), 'addr02', MTEXT_LEN, 'KVa', array('SPTAB_CHECK' ,'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Details of inquiry_01'), 'contents', MLTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_E-mail address_01'), 'email', null, 'KVa',array('EXIST_CHECK', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK')); $objFormParam->addParam(t('c_E-mail address (confirmation)_01'), 'email02', null, 'KVa',array('EXIST_CHECK', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK')); $objFormParam->addParam(t('c_Telephone number 1_01'), 'tel01', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Telephone number 2_01'), 'tel02', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam(t('c_Telephone number 3_01'), 'tel03', TEL_ITEM_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); } /** * 入力内容のチェックを行なう. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return array 入力チェック結果の配列 */ function lfCheckError(&$objFormParam) { // 入力データを渡す。 $arrForm = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrForm); $objErr->arrErr = $objFormParam->checkError(); $objErr->doFunc(array(t('c_E-mail address_01'), t('c_E-mail address (confirmation)_01'), 'email', 'email02') ,array('EQUAL_CHECK')); return $objErr->arrErr; } /** * メールの送信を行う。 * * @return void */ function lfSendMail(&$objPage) { $CONF = SC_Helper_DB_Ex::sfGetBasisData(); $objPage->tpl_shopname = $CONF['shop_name']; $objPage->tpl_infoemail = $CONF['email02']; $helperMail = new SC_Helper_Mail_Ex(); $helperMail->setPage($this); $helperMail->sfSendTemplateMail( $objPage->arrForm['email']['value'], // to t('f_LAST_NAME_SIR_01', array('T_ARG1' => $objPage->arrForm['name01']['value'])), // to_name 5, // template_id $objPage, // objPage $CONF['email03'], // from_address $CONF['shop_name'], // from_name $CONF['email02'], // reply_to $CONF['email02'] // bcc ); } }