アドミニックスブログ

不定期更新です。

Go Top

携帯アンケート(EC-CUBE2.4.2)

| | コメント(0)

新規作成
/shop/data/Smarty/templates/default/mobile/inquiry/
complete.tpl
confirm.tpl
index.tpl
inquiry.tpl
set1.tpl
set2.tpl

新規作成
/shop/html/mobile/inquiry
index.php

修正
/shop/data/class/pages/inquiry/LC_Page_Inquiry.php


http://ec-cube.systemfriend.co.jp/technique/article0006/


新規作成
/shop/data/Smarty/templates/default/mobile/inquiry/
complete.tpl
confirm.tpl
index.tpl
inquiry.tpl
set1.tpl
set2.tpl

/shop/data/Smarty/templates/default/mobile/inquiry/complete.tpl
<!--{*
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
*}-->
<div align="center">質問 <!--{$QUESTION.title|escape}--></div>
<hr>

ご回答いただきありがとうございました<br>

<hr>

<a href="<!--{$smarty.const.MOBILE_URL_SITE_TOP}-->"
accesskey="0"><!--{0|numeric_emoji}-->TOPページへ</a><br>
<br>

<!-- ▼フッター ここから -->
<!--{include file='footer.tpl'}-->
<!-- ▲フッター ここまで -->


/shop/data/Smarty/templates/default/mobile/inquiry/confirm.tpl
+<!--{*
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
*}-->
<div align="center">質問 <!--{$QUESTION.title|escape}--></div>
<hr>
<form name="form1" method="post"
action="<!--{$smarty.server.PHP_SELF|escape}-->">
<input type="hidden" name="mode" value="complete">
<input type="hidden" name="question_id" value="<!--{$question_id}-->">

<!--{if $tpl_question_none_flg ne '1' }-->
【質問内容】<br>
<!--{section name=question loop=$QUESTION.question}-->
<!--{if $QUESTION.question[question].kind ne '0' }-->
<!--{$QUESTION.question[question].name|escape}-->
<!--{if $QUESTION.question[question].kind eq 1}-->
<!--{$smarty.post.option[$smarty.section.question.index]|nl2br}-->
<!--{elseif $QUESTION.question[question].kind eq 2}-->
<!--{$smarty.post.option[$smarty.section.question.index]|escape}-->
<!--{elseif $QUESTION.question[question].kind eq 4}-->
<!--{assign var=key
value=`$smarty.post.option[$smarty.section.question.index]`}-->
<!--{$QUESTION.question[question].option[$key]}-->
<!--{elseif $QUESTION.question[question].kind eq 3}-->
<!--{foreach item=sub from=$smarty.post.option[question]}-->
<!--{if strlen($sub) > 0}-->
<!--{$QUESTION.question[question].option[$sub]}-->
<!--{/if}-->
<!--{/foreach}-->
<!--{/if}-->
<!--{/if}-->
<br>
<!--{/section}-->
<!--{/if}-->

【個人情報】<br>
名前:<!--{$list_data.name01|escape}--> 
<!--{$list_data.name02|escape}--><br>
名前:<!--{$list_data.kana01|escape}--> 
<!--{$list_data.kana02|escape}--><br>
郵便:〒<!--{$list_data.zip01|escape}--> -
<!--{$list_data.zip02|escape}--><br>
住所:
<!--{$arrPref[$list_data.pref]|escape}--><!--{$list_data.addr01|escape}--><!
--{$list_data.addr02|escape}--><br>
電話:
<!--{$list_data.tel01|escape}-->-<!--{$list_data.tel02|escape}-->-<!--{$list
_data.tel03|escape}--><br>
Mail :<!--{$list_data.email|escape}--><br>

<div align="center"><input type="submit" name="submit" value="次へ"></div>
<div align="center"><input type="submit" name="return" value="戻る"></div>

<!--{foreach from=$list_data key=key item=item}-->
<input type="hidden" name="<!--{$key|escape}-->"
value="<!--{$item|escape}-->">
<!--{/foreach}-->
<!--{section name=question loop=$QUESTION.question}-->
<!--{if $QUESTION.question[question].kind eq 3}-->

<!--{section name=option
loop=$list_data.option[$smarty.section.question.index]}-->
<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->][<!--{$smarty.section.o
ption.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index][$smarty.sectio
n.option.index]}-->">
<!--{/section}-->

<!--{else}-->

<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index]|escape}-->">

<!--{/if}-->
<!--{/section}-->
</form>

<br>

<hr>

<a href="<!--{$smarty.const.MOBILE_URL_SITE_TOP}-->"
accesskey="0"><!--{0|numeric_emoji}-->TOPページへ</a><br>

<br>

<!-- ▼フッター ここから -->
<!--{include file='footer.tpl'}-->
<!-- ▲フッター ここまで -->


/shop/data/Smarty/templates/default/mobile/inquiry/index.tpl
<!--{*
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
*}-->
<div align="center">質問 <!--{$QUESTION.title|escape}--></div>
<hr>
<form name="form1" method="post"
action="<!--{$smarty.server.PHP_SELF|escape}-->">
<input type="hidden" name="mode" value="set1">
<input type="hidden" name="question_id" value="<!--{$question_id}-->">

【質問内容】<br>
<!--{$QUESTION.contents_mobile}-->
<br>
<!--{include file=inquiry/inquiry.tpl}-->

<div align="center"><input type="submit" name="submit" value="次へ"></div>

<!--{foreach from=$list_data key=key item=item}-->
<input type="hidden" name="<!--{$key|escape}-->"
value="<!--{$item|escape}-->">
<!--{/foreach}-->
</form>

<br>

<hr>

<a href="<!--{$smarty.const.MOBILE_URL_SITE_TOP}-->"
accesskey="0"><!--{0|numeric_emoji}-->TOPページへ</a><br>

<br>

<!-- ▼フッター ここから -->
<!--{include file='footer.tpl'}-->
<!-- ▲フッター ここまで -->


/shop/data/Smarty/templates/default/mobile/inquiry/inquiry.tpl
<!--{*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*}-->
<!--{section name=question loop=$QUESTION.question}-->
<!--{if $QUESTION.question[question].kind }-->
<br>
【<!--{$QUESTION.question[question].name|escape}-->】
<br>
<!--{if $QUESTION.question[question].kind eq 1}-->

<textarea name="option[<!--{$smarty.section.question.index}-->]"
cols="55" rows="8" class="area55"
wrap="physical"><!--{$arrForm.option[$smarty.section.question.index]|escape}
--></textarea>
<!--{if $arrErr.option[$smarty.section.question.index]}-->
<br><font
color="#FF0000"><!--{$QUESTION.question[question].name|escape}-->を入力して
下さい</font></span>
<!--{/if}-->
<br>

<!--{elseif $QUESTION.question[question].kind eq 2}-->

<input type="text"
name="option[<!--{$smarty.section.question.index}-->]" size="55"
class="box50"
value="<!--{$arrForm.option[$smarty.section.question.index]|escape}-->">
<!--{if $arrErr.option[$smarty.section.question.index]}-->
<br><font
color="#FF0000"><!--{$QUESTION.question[question].name|escape}-->を入力して
下さい</font></span>
<!--{/if}-->
<br>

<!--{elseif $QUESTION.question[question].kind eq 3}-->

<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->][0]" value="">
<span><!--{html_checkboxes
name="option[`$smarty.section.question.index`]"
options=$QUESTION.question[question].option
selected=$arrForm.option[question] separator="<br>"}--></span>
<!--{if $arrErr.option[$smarty.section.question.index]}-->
<br><font
color="#FF0000"><!--{$QUESTION.question[question].name|escape}-->を入力して
下さい</font></span>
<!--{/if}-->

<!--{elseif $QUESTION.question[question].kind eq 4}-->

<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->][0]" value="">
<!--{section name=sub loop=$QUESTION.question[question].option}-->
<span>
<!--{if $QUESTION.question[question].option[sub]}-->
<input type="radio"
name="option[<!--{$smarty.section.question.index}-->]"
value="<!--{$smarty.section.sub.index|escape}-->" <!--{if
$smarty.section.sub.index eq
$arrForm.option[question]|default:"-1" }-->checked<!--{/if}-->>
<!--{$QUESTION.question[question].option[sub]|escape}-->
<!--{/if}-->
</span>
<!--{/section}-->
<!--{if $arrErr.option[$smarty.section.question.index]}-->
<br><font
color="#FF0000"><!--{$QUESTION.question[question].name|escape}-->を入力して
下さい</font></span>
<!--{/if}-->
<br>

<!--{/if}-->
<!--{/if}-->

<!--{/section}-->

/shop/data/Smarty/templates/default/mobile/inquiry/set1.tpl
<!--{*
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
*}-->
<div align="center">質問 <!--{$QUESTION.title|escape}--></div>
<hr>
<form name="form1" method="post"
action="<!--{$smarty.server.PHP_SELF|escape}-->">
<input type="hidden" name="mode" value="set2">
<input type="hidden" name="question_id" value="<!--{$question_id}-->">

<font color="#FF0000">*は必須項目です。</font><br>
<br>

【お名前】<font color="#FF0000">*</font><br>
<font
color="#FF0000"><!--{$arrErr.name01}--><!--{$arrErr.name02}--></font>
姓(例:渋谷)<br>
<input type="text" name="name01" value="<!--{$arrForm.name01|escape}-->"
maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>

名(例:花子)<br>
<input type="text" name="name02" value="<!--{$arrForm.name02|escape}-->"
maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
<font
color="#FF0000"><!--{$arrErr.kana01}--><!--{$arrErr.kana02}--></font>

カナ/姓(例:シブヤ)<br>
<input type="text" name="kana01" value="<!--{$arrForm.kana01|escape}-->"
maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
カナ/名(例:ハナコ)<br>
<input type="text" name="kana02" value="<!--{$arrForm.kana02|escape}-->"
maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>

<br>

<!--{assign var=key1 value="zip01"}-->
<!--{assign var=key2 value="zip02"}-->
【郵便番号】<font color="#FF0000">*</font><br>
<font
color="#FF0000"><!--{$arrErr[$key1]}--><!--{$arrErr[$key2]}--></font>
<!--{assign var="size1" value="`$smarty.const.ZIP01_LEN+2`"}-->
<!--{assign var="size2" value="`$smarty.const.ZIP02_LEN+2`"}-->
<input size="<!--{$size1}-->" type="text" name="zip01" value="<!--{if
$arrForm.zip01 !=
""}--><!--{$arrForm.zip01|escape}--><!--{else}--><!--{$zip01|escape}--><!--{
/if}-->" maxlength="<!--{$smarty.const.ZIP01_LEN}-->" istyle="4">
 - 
<input size="<!--{$size2}-->" type="text" name="zip02" value="<!--{if
$arrForm.zip02 !=
""}--><!--{$arrForm.zip02|escape}--><!--{else}--><!--{$zip02|escape}--><!--{
/if}-->" maxlength="<!--{$smarty.const.ZIP02_LEN}-->" istyle="4"><br>

<br>

<div align="center"><input type="submit" name="submit" value="次へ"></div>
<div align="center"><input type="submit" name="return" value="戻る"></div>

<!--{foreach from=$list_data key=key item=item}-->
<input type="hidden" name="<!--{$key|escape}-->"
value="<!--{$item|escape}-->">
<!--{/foreach}-->
<!--{section name=question loop=$QUESTION.question}-->
<!--{if $QUESTION.question[question].kind eq 3}-->

<!--{section name=option
loop=$list_data.option[$smarty.section.question.index]}-->
<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->][<!--{$smarty.section.o
ption.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index][$smarty.sectio
n.option.index]}-->">
<!--{/section}-->

<!--{else}-->

<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index]|escape}-->">

<!--{/if}-->
<!--{/section}-->
</form>

<br>

<hr>

<a href="<!--{$smarty.const.MOBILE_URL_SITE_TOP}-->"
accesskey="0"><!--{0|numeric_emoji}-->TOPページへ</a><br>

<br>

<!-- ▼フッター ここから -->
<!--{include file='footer.tpl'}-->
<!-- ▲フッター ここまで -->


/shop/data/Smarty/templates/default/mobile/inquiry/set2.tpl
<!--{*
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
*}-->
<div align="center">質問 <!--{$QUESTION.title|escape}--></div>
<hr>
<form name="form1" method="post"
action="<!--{$smarty.server.PHP_SELF|escape}-->">
<input type="hidden" name="mode" value="confirm">
<input type="hidden" name="question_id" value="<!--{$question_id}-->">

<font color="#FF0000">*は必須項目です。</font><br>
<br>

【都道府県】<font color="#FF0000">*</font><br>
<font color="#FF0000"><!--{$arrErr.pref}--></font>
<select name="pref">
<option value="">都道府県を選択</option>
<!--{html_options options=$arrPref selected=$arrForm.pref}-->
</select><br>

【市区町村】<font color="#FF0000">*</font><br>
<font color="#FF0000"><!--{$arrErr.addr01}--></font>
<input type="text" name="addr01" value="<!--{$arrForm.addr01|escape}-->"
istyle="1"><br>

【番地】<font color="#FF0000">*</font><br>
<font color="#FF0000"><!--{$arrErr.addr02}--></font>
<input type="text" name="addr02" value="<!--{$arrForm.addr02|escape}-->"
istyle="3"><br>

【メールアドレス】<font color="#FF0000">*</font><br>
<font color="#FF0000"><!--{$arrErr.email}--></font>
<input type="text" name="email" value="<!--{$arrForm.email|escape}-->"
istyle="1"><br>

【電話番号】<font color="#FF0000">*</font><br>
<font
color="#FF0000"><!--{$arrErr.tel01}--><!--{$arrErr.tel02}--><!--{$arrErr.tel
03}--></font>
<!--{assign var="size" value="`$smarty.const.TEL_ITEM_LEN+2`"}-->
<input type="text" size="<!--{$size}-->" name="tel01"
value="<!--{$arrForm.tel01|escape}-->"
maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
 - 
<input type="text" size="<!--{$size}-->" name="tel02"
value="<!--{$arrForm.tel02|escape}-->"
maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
 - 
<input type="text" size="<!--{$size}-->" name="tel03"
value="<!--{$arrForm.tel03|escape}-->"
maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4"><br>

<br>

<div align="center"><input type="submit" name="submit" value="次へ"></div>
<div align="center"><input type="submit" name="return" value="戻る"></div>

<!--{foreach from=$list_data key=key item=item}-->
<input type="hidden" name="<!--{$key|escape}-->"
value="<!--{$item|escape}-->">
<!--{/foreach}-->
<!--{section name=question loop=$QUESTION.question}-->
<!--{if $QUESTION.question[question].kind eq 3}-->

<!--{section name=option
loop=$list_data.option[$smarty.section.question.index]}-->
<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->][<!--{$smarty.section.o
ption.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index][$smarty.sectio
n.option.index]}-->">
<!--{/section}-->

<!--{else}-->

<input type="hidden"
name="option[<!--{$smarty.section.question.index}-->]"

value="<!--{$list_data.option[$smarty.section.question.index]|escape}-->">

<!--{/if}-->
<!--{/section}-->
</form>

<br>

<hr>

<a href="<!--{$smarty.const.MOBILE_URL_SITE_TOP}-->"
accesskey="0"><!--{0|numeric_emoji}-->TOPページへ</a><br>

<br>

<!-- ▼フッター ここから -->
<!--{include file='footer.tpl'}-->
<!-- ▲フッター ここまで -->


新規作成
/shop/html/mobile/inquiry
index.php

/shop/html/mobile/inquiryindex.php
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/

// {{{ requires
require_once("../require.php");
require_once(CLASS_EX_PATH . "page_extends/inquiry/LC_Page_Inquiry_Ex.php");

// }}}
// {{{ generate page

$objPage = new LC_Page_Inquiry_Ex();
register_shutdown_function(array($objPage, "destroy"));
$objPage->mobileInit();
$objPage->mobileProcess();
?>

修正
/shop/data/class/pages/inquiry/LC_Page_Inquiry.php

<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/

// {{{ requires
require_once(CLASS_PATH . "pages/LC_Page.php");

/**
* アンケート のページクラス.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id:LC_Page_Inquiry.php 15532 2007-08-31 14:39:46Z nanasess $
*/
class LC_Page_Inquiry extends LC_Page {

// }}}
// {{{ functions

/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$this->tpl_mainpage = 'inquiry/index.tpl';
$this->tpl_mainno = 'contents';
}

/**
* Page のプロセス.
*
* @return void
*/
function process() {
$conn = new SC_DBConn();
$objPage = new LC_Page();
$objView = new SC_SiteView();
$objSess = new SC_Session();


// 都道府県プルダウン用配列
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData("mtb_pref",
array("pref_id", "pref_name", "rank"));

// CSV保存項目
//---- 登録用カラム配列 オプション以外


$arrRegistColumn = array(
array( "column" => "name01", "convert"
=> "aKV" ),
array( "column" => "name02", "convert"
=> "aKV" ),
array( "column" => "kana01", "convert"
=> "CKV" ),
array( "column" => "kana02", "convert"
=> "CKV" ),
array( "column" => "zip01", "convert"
=> "n" ),
array( "column" => "zip02", "convert"
=> "n" ),
array( "column" => "pref", "convert"
=> "n" ),
array( "column" => "addr01", "convert"
=> "aKV" ),
array( "column" => "addr02", "convert"
=> "aKV" ),
array( "column" => "email", "convert"
=> "a" ),
array( "column" => "email02",
"convert" => "a" ),
array( "column" => "tel01", "convert"
=> "n" ),
array( "column" => "tel02", "convert"
=> "n" ),
array( "column" => "tel03", "convert"
=> "n" ),
);


if (!isset($_POST['mode'])) $_POST['mode'] = "";

if ( ( ! $_POST['mode'] == 'confirm' ) && ( !
is_numeric($_REQUEST['question_id']) ) ){
SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
}

// テンプレート登録項目取得


$sql = "SELECT question_id, question FROM dtb_question WHERE
question_id = ?";
$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
if ( count($result) <= 0 ){
SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
}
$this->QUESTION = $this->lfGetArrInput( unserialize(
$result[0]['question'] ) );

$this->question_id = $_REQUEST['question_id'];

$this->arrHidden = SC_Utils_Ex::sfMakeHiddenArray($_POST);
unset($this->arrHidden['mode']);

if (isset($result[0]["del_flg"]) && (int)$result[0]["del_flg"] !==
0 ){
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "申し訳
ありません。該当の応募は終了致しました。");
}

if (isset($this->QUESTION["active"]) &&
(int)$this->QUESTION["active"] !== 0 ){
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "申し訳
ありません。該当の応募は終了致しました。");
}

if( $_POST['mode'] == "confirm" ) {

//-- 入力エラーチェック
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);

$this->arrErr = $this->lfErrorCheck($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);

if( ! $this->arrErr ) {
$this->tpl_mainpage = "inquiry/confirm.tpl";
}


}elseif( $_POST['mode'] == "return"){
$this->arrForm = $_POST;

}elseif( $_POST['mode'] == "regist" ) {

//-- 入力文字・変換&エラーチェック
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);
$this->arrErr = $this->lfErrorCheck($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);


if( ! $this->arrErr ) {

//完了画面
$this->tpl_mainpage = "inquiry/complete.tpl";


//--------- ▼ SQL ---------//

// テーブルに入れるように整形する
$arrOption = $this->arrForm['option'];
unset ($this->arrForm['email02']);
$this->arrForm['mail01'] = $this->arrForm['email'];
unset ($this->arrForm['email']);
unset ($this->arrForm['option']);
$this->arrForm['question_id'] = $this->question_id;
$this->arrForm['question_name'] =
$this->QUESTION['title'];
for ( $i=0; $i<(count($arrOption)); $i++ ){
$tmp = "";
if ( is_array($arrOption[$i]) ){
for( $j=0; $j<count($arrOption[$i]); $j++){
if ( $j>0 ) $tmp .= ",";
$tmp .= $arrOption[$i][$j];
}
$this->arrForm['question0'.($i+1)] = $tmp;
} else {
$this->arrForm['question0'.($i+1)] =
$arrOption[$i];
}
}
$this->arrForm['create_date'] = "now()";
// DB登録
$objQuery = new SC_Query();
$objQuery->insert("dtb_question_result",
$this->arrForm );

//--------- ▲ SQL ---------//

}
}

$this->cnt_question = 6;
$this->arrActive = isset($arrActive) ? $arrActive : "";
$this->arrQuestion = isset($arrQuestion) ? $arrQuestion : "";


//---- ページ表示
$objView->_smarty->register_function("lfArray_Search_key_Smarty",
array("LC_Page_Inquiry", "lfArray_Search_key_Smarty"));


$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}

/**
* モバイルページを初期化する.
*
* @return void
*/
function mobileInit() {
$this->tpl_mainpage = 'inquiry/index.tpl';
$this->tpl_title = "";
}

/**
* Page のプロセス(モバイル).
*
* @return void
*/
function mobileProcess() {
$objView = new SC_MobileView(false);
$objDb = new SC_Helper_DB_Ex();
$CONF = $objDb->sf_getBasisData();
$this->CONF = $CONF;

// データ設定
foreach($_POST as $key => $val) {
if ($key != "log" && $key != "mode" && $key != "return" && $key
!= "submit" && $key != session_name()) {
$this->list_data[ $key ] = $val;
}
}
// データ設定
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData("mtb_pref",
array("pref_id", "pref_name", "rank"));

// CSV保存項目
//---- 登録用カラム配列 オプション以外
$arrRegistColumn = array(
array( "column" => "name01",
"convert" => "aKV" ),
array( "column" => "name02",
"convert" => "aKV" ),
array( "column" => "kana01",
"convert" => "CKV" ),
array( "column" => "kana02",
"convert" => "CKV" ),
array( "column" => "zip01", "convert"
=> "n" ),
array( "column" => "zip02", "convert"
=> "n" ),
array( "column" => "pref", "convert"
=> "n" ),
array( "column" => "addr01",
"convert" => "aKV" ),
array( "column" => "addr02",
"convert" => "aKV" ),
array( "column" => "email", "convert"
=> "a" ),
array( "column" => "email02",
"convert" => "a" ),
array( "column" => "tel01", "convert"
=> "n" ),
array( "column" => "tel02", "convert"
=> "n" ),
array( "column" => "tel03", "convert"
=> "n" ),
);


if (!isset($_POST['mode'])) $_POST['mode'] = "";

if ( ( ! $_POST['mode'] == 'confirm' ) && ( !
is_numeric($_REQUEST['question_id']) ) ){
echo "不正アクセス";
exit;
}

$objQuery = new SC_Query();
if ( ( ! $_POST['mode'] == 'confirm' ) && (
$objQuery->count("dtb_question", "question_id = ?",
array($_REQUEST['question_id'])) <= 0 ) ){
echo "不正アクセス";
exit;
}

// テンプレート登録項目取得
$conn = new SC_DBConn();
$sql = "SELECT question_id, question FROM dtb_question WHERE
question_id = ?";
$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
$this->QUESTION = $this->lfGetArrInput( unserialize(
$result[0]['question'] ) );

$this->question_id = $_REQUEST['question_id'];

$this->arrHidden = SC_Utils_Ex::sfMakeHiddenArray($_POST);
unset($this->arrHidden['mode']);

if (isset($result[0]["del_flg"]) && (int)$result[0]["del_flg"] !==
0 ){
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "申し訳
ありません。該当の応募は終了致しました。");
}

if (isset($this->QUESTION["active"]) &&
(int)$this->QUESTION["active"] !== 0 ){
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "申し訳
ありません。該当の応募は終了致しました。");
}

// 戻るボタン用処理
if (!empty($_POST["return"])) {
switch ($_POST["mode"]) {
case 'complete':
$_POST["mode"] = "confirm";
break;
case 'confirm':
$_POST["mode"] = "set2";
break;
case 'set2':
$_POST["mode"] = "set1";
break;
default:
}
}

switch ($_POST['mode']){
case 'set1':
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);
$this->arrErr = $this->lfErrorCheck0($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);
if (count($this->arrErr) == 0 && empty($_POST["return"])) {
$this->tpl_mainpage = 'inquiry/set1.tpl';

$checkVal = array("name01", "name02", "kana01", "kana02",
"zip01", "zip02");
foreach($checkVal as $key) {
unset($this->list_data[$key]);
}

} else {
$this->tpl_mainpage = 'inquiry/index.tpl';

$checkVal = array("option");
foreach($checkVal as $key) {
unset($this->list_data[$key]);
}
}
break;
case 'set2':
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);
$this->arrErr = $this->lfErrorCheck1($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);
if (count($this->arrErr) == 0 && empty($_POST["return"])) {
$this->tpl_mainpage = 'inquiry/set2.tpl';

$checkVal = array("pref", "addr01", "addr02", "addr03",
"tel01", "tel02", "tel03", "email");
foreach($checkVal as $key) {
unset($this->list_data[$key]);
}
} else {
$this->tpl_mainpage = 'inquiry/set1.tpl';

$checkVal = array("name01", "name02", "kana01", "kana02",
"zip01", "zip02");
foreach($checkVal as $key) {
unset($this->list_data[$key]);
}
}
break;
case 'confirm':
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);
$this->arrErr = $this->lfErrorCheck2($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);
if (count($this->arrErr) == 0 && empty($_POST["return"])) {
$this->tpl_mainpage = 'inquiry/confirm.tpl';
} else {
$this->tpl_mainpage = 'inquiry/set2.tpl';
$checkVal = array("pref", "addr01", "addr02", "addr03",
"tel01", "tel02", "tel03", "email");
foreach($checkVal as $key) {
unset($this->list_data[$key]);
}
}
break;
case 'complete':
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm,
$arrRegistColumn);
$this->arrErr = $this->lfErrorCheckMobile($this->arrForm);
$this->arrErr = $this->lfGetArrInput($this->arrErr);

if (count($this->arrErr) == 0) {
//完了画面
$this->tpl_mainpage = "inquiry/complete.tpl";


//--------- ▼ SQL ---------//

// テーブルに入れるように整形する
$arrOption = $this->arrForm['option'];
unset ($this->arrForm['email02']);
$this->arrForm['mail01'] = $this->arrForm['email'];
unset ($this->arrForm['email']);
unset ($this->arrForm['option']);
$this->arrForm['question_id'] = $this->question_id;
$this->arrForm['question_name'] =
$this->QUESTION['title'];
for ( $i=0; $i<(count($arrOption)); $i++ ){
$tmp = "";
if ( is_array($arrOption[$i]) ){
for( $j=0; $j<count($arrOption[$i]); $j++){
if ( $j>0 ) $tmp .= ",";
$tmp .= $arrOption[$i][$j];
}
$this->arrForm['question0'.($i+1)] = $tmp;
} else {
$this->arrForm['question0'.($i+1)] =
$arrOption[$i];
}
}
$this->arrForm['create_date'] = "now()";
// DB登録
$objQuery = new SC_Query();
$objQuery->insert("dtb_question_result",
$this->arrForm );

//--------- ▲ SQL ---------//

} else {
SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "",
true);
}
break;
default:
// データ設定
foreach($_POST as $key => $val) {
if ($key != "log" && $key != "mode" && $key != "return" && $key
!= "submit" && $key != session_name()) {
$this->list_data[ $key ] = $val;
}
}
}

$this->cnt_question = 6;
$this->arrActive = isset($arrActive) ? $arrActive : "";
$this->arrQuestion = isset($arrQuestion) ? $arrQuestion : "";

//---- ページ表示
//参考:
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=1620&forum=8&p
ost_id=5462#forumpost5462

//$objView->_smarty->register_modifier("lfArray_Search_key_Smarty","lfArray_
Search_key_Smarty");

$objView->_smarty->register_function("lfArray_Search_key_Smarty","lfArray_Se
arch_key_Smarty");

$objView->assignobj($this);
$objView->display(SITE_FRAME);
}

/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}

// }}}
// {{{ protected functions

/**
* エラーチェック
*
* @param array FormParam の配列
* @return array エラー情報の配列
**/
function lfErrorCheck($array) {

$objErr = new SC_CheckError($array);

$objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN),
array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN),
array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("フリガナ(セイ)", 'kana01', STEXT_LEN),
array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("フリガナ(メイ)", 'kana02', STEXT_LEN),
array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号", "zip01", "zip02"),
array("ALL_EXIST_CHECK"));
$objErr->doFunc(array("都道府県", 'pref'),
array("SELECT_CHECK","NUM_CHECK"));
$objErr->doFunc(array("ご住所1", "addr01", MTEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("ご住所2", "addr02", MTEXT_LEN),
array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK",
"NUM_CHECK"));
$objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK",
"NUM_CHECK"));
$objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK",
"NUM_CHECK"));
$objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN)
,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK",
"MAX_LENGTH_CHECK"));
$objErr->doFunc(array('メールアドレス(確認)', "email02", MTEXT_LEN)
,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK",
"MAX_LENGTH_CHECK"));
$objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)',
"email", "email02") ,array("EQUAL_CHECK"));

$objErr->arrErr["option"] = array_map(array($this, "lfCheckNull"),
(array)$_POST['option'] );

return $objErr->arrErr;
}

/**
* エラーチェック 携帯*
*
* @param array FormParam の配列
* @return array エラー情報の配列
**/
function lfErrorCheckMobile($array) {
$objErr = new SC_CheckError($array);

$objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(カナ/姓)", 'kana01', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("お名前(カナ/名)", 'kana02', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号", "zip01", "zip02"),
array("ALL_EXIST_CHECK"));
$objErr->doFunc(array("都道府県", 'pref'),
array("SELECT_CHECK","NUM_CHECK"));
$objErr->doFunc(array("市区町村", "addr01", MTEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("番地", "addr02", MTEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("電話番号1", 'tel01'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号2", 'tel02'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号3", 'tel03'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03",
TEL_LEN) ,array("TEL_CHECK"));
$objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN)
,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK",
"MAX_LENGTH_CHECK"));

return $objErr->arrErr;

}

/**
* エラーチェック 携帯0
*
* @param array FormParam の配列
* @return array エラー情報の配列
**/
function lfErrorCheck0($array) {
$objErr = new SC_CheckError($array);

$objErr->arrErr["option"] = array_map(array($this, "lfCheckNull"),
(array)$_POST['option'] );

return $objErr->arrErr;

}

/**
* エラーチェック 携帯1
*
* @param array FormParam の配列
* @return array エラー情報の配列
**/
function lfErrorCheck1($array) {
$objErr = new SC_CheckError($array);

$objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(カナ/姓)", 'kana01', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("お名前(カナ/名)", 'kana02', STEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN )
,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号", "zip01", "zip02"),
array("ALL_EXIST_CHECK"));
return $objErr->arrErr;

}

/**
* エラーチェック 携帯2
*
* @param array FormParam の配列
* @return array エラー情報の配列
**/
function lfErrorCheck2($array) {
$objErr = new SC_CheckError($array);

$objErr->doFunc(array("都道府県", 'pref'),
array("SELECT_CHECK","NUM_CHECK"));
$objErr->doFunc(array("市区町村", "addr01", MTEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("番地", "addr02", MTEXT_LEN),
array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("電話番号1", 'tel01'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号2", 'tel02'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号3", 'tel03'),
array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03",
TEL_LEN) ,array("TEL_CHECK"));
$objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN)
,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK",
"MAX_LENGTH_CHECK"));
return $objErr->arrErr;

}

/**
* 取得文字列の変換
*
* @param array $array 取得文字列の配列
* @param array フォームパラメータの配列
* @return array 変換後の文字列
**/
function lfConvertParam($array, $arrRegistColumn) {

// カラム名とコンバート情報
foreach ($arrRegistColumn as $data) {
$arrConvList[ $data["column"] ] = $data["convert"];
}
// 文字変換
$new_array = array();
foreach ($arrConvList as $key => $val) {
$new_array[$key] = $array[$key];
if( strlen($val) > 0) {
$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
}
}

// オプション配列用
for ($i=0; $i<count($array['option']); $i++){
if ( is_array($array['option'][$i]) ){
$new_array['option'][$i] = $array['option'][$i];
} else {
$new_array['option'][$i] =
mb_convert_kana($array['option'][$i] ,"aKV");
}
}

return $new_array;
}

/**
* 値が入力された配列のみを返す.
*
* @param array $arr 入力文字列
* @return array 値が入力された配列
*/
function lfGetArrInput( $arr ){
// 値が入力された配列のみを返す
$return = array();

if ( is_array($arr) ){
foreach ( $arr as $key=>$val ) {
if ( is_string($val) && strlen($val) > 0 ){
$return[$key] = $val;
} elseif ( is_array( $val ) ) {
$data = $this->lfGetArrInput ( $val );
if ( $data ){
$return[$key] = $data;
}
}
}
}
return $return;
}

/**
* 配列の Smarty 変数の存在をチェックする.
*
* @param array $params フォームパラメータの配列
* @return Smarty 変数が存在する場合 true
*/
function lfArray_Search_key_Smarty ( $params ){

$val = $params['val'];
$arr = $params['arr'];

$revers_arr = array_flip($arr);
return array_search( $val ,$revers_arr );


}

/**
* 引数が null かチェックする.
*
* @param mixed $val 入力データ
* @return integer|array 引数に null が含まれる場合 1, それ以外は空の配

*/
function lfCheckNull ( $val ){
$return = array();

if ( ( ! is_array( $val ) ) && ( strlen( $val ) < 1 ) ){
$return = "1";
} elseif ( is_array( $val ) ) {
foreach ($val as $line) {
$return = $this->lfCheckNull( $line );
}
}
return $return;
}
}
?>

コメントする