Changeset 18469


Ignore:
Timestamp:
2010/01/07 12:02:22 (14 years ago)
Author:
Yammy
Message:

http://svn.ec-cube.net/open_trac/ticket/535
[アンケート管理]チェックボックスの回答に同じ回答を登録した場合に不具合となる場合がある

Location:
branches/version-2_4-dev/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_4-dev/data/Smarty/templates/default/admin/contents/inquiry.tpl

    r16761 r18469  
    145145                            </tr>        
    146146                            <!--{section name=question loop=$cnt_question}--> 
     147              <!--{assign var=index value=$smarty.section.question.index}--> 
    147148                            <tr class="fs12n"> 
    148149                                <td width="140" bgcolor="#f2f1ec">質問<!--{$smarty.section.question.iteration}--><!--{if $smarty.section.question.iteration eq 1}--><span class="red">*</span><!--{/if}--></td> 
    149150                                <td width="637" bgcolor="#ffffff"> 
    150                                 <input type="text" name="question[<!--{$smarty.section.question.index}-->][name]" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].name|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].name}--><!--{sfSetErrorStyle}--><!--{/if}-->> 
    151                                 <!--{if $ERROR.question[$smarty.section.question.index].name}--><br><span class="red"><!--{$ERROR.question[$smarty.section.question.index].name}--></span><!--{/if}--> 
     151                                <input type="text" name="question[<!--{$index}-->][name]" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].name|escape}-->" <!--{if $ERROR.question[$index].name}--><!--{sfSetErrorStyle}--><!--{/if}-->> 
     152                                <!--{if $ERROR.question[$index].name}--><br><span class="red"><!--{$ERROR.question[$index].name}--></span><!--{/if}--> 
    152153                                </td> 
    153154                            </tr> 
    154155                            <tr class="fs12n" bgcolor="#ffffff"> 
    155156                                <td colspan="2"> 
    156                                 <span style=background-color:"<!--{$ERROR_COLOR.question[$smarty.section.question.index].kind}-->"> 
    157                                 <!--{html_radios_ex onClick="func_disp(`$smarty.section.question.index`)" name="question[`$smarty.section.question.index`][kind]" options="$arrQuestion" selected="`$smarty.post.question[$smarty.section.question.index].kind`"}--> 
     157                                <span style=background-color:"<!--{$ERROR_COLOR.question[$index].kind}-->"> 
     158                                <!--{html_radios_ex onClick="func_disp(`$index`)" name="question[`$index`][kind]" options="$arrQuestion" selected="`$smarty.post.question[$index].kind`"}--> 
    158159                                </span> 
    159                                 <!--{if $ERROR.question[$smarty.section.question.index].kind}--><br><span class="red"><!--{$ERROR.question[$smarty.section.question.index].kind}--></span><!--{/if}--> 
    160                                 </td> 
    161                             </tr> 
     160                                <!--{if $ERROR.question[$index].kind}--><br><span class="red"><!--{$ERROR.question[$index].kind}--></span><!--{/if}--> 
     161                                </td> 
     162                            </tr> 
     163              <!--{** 回答 **}--> 
    162164                            <tr class="fs12n" bgcolor="#ffffff"><td colspan="2"> 
    163                                 <table id="TD<!--{$smarty.section.question.index}-->"> 
    164                                 <tr class="fs12n" bgcolor="#ffffff"> 
    165                                     <td colspan="2">1 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][0]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.0|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].kind}--><!--{sfSetErrorStyle}--><!--{/if}-->> 2 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][1]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.1|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].kind}--><!--{sfSetErrorStyle}--><!--{/if}-->></td> 
    166                                 </tr> 
    167                                 <tr class="fs12n" bgcolor="#ffffff"> 
    168                                     <td colspan="2">3 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][2]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.2|escape}-->"> 4 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][3]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.3|escape}-->"></td> 
    169                                 </tr> 
    170                                 <tr class="fs12n" bgcolor="#ffffff"> 
    171                                     <td colspan="2">5 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][4]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.4|escape}-->"> 6 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][5]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.5|escape}-->"></td> 
    172                                 </tr> 
    173                                 <tr class="fs12n" bgcolor="#ffffff"> 
    174                                     <td colspan="2">7 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][6]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.6|escape}-->"> 8 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][7]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.7|escape}-->"></td> 
    175                                 </tr> 
     165                                <table id="TD<!--{$index}-->"> 
     166                              <!--{section name=option loop=4 start=0 max=7}--> 
     167                                  <tr class="fs12n" bgcolor="#ffffff"> 
     168                                    <td colspan="2"> 
     169                      <!--{assign var=option_index1 value=$smarty.section.option.index*2}--> 
     170                      <!--{assign var=option_index2 value=$option_index1+1}--> 
     171                      <!--{assign var=num1 value=$option_index1+1}--> 
     172                      <!--{assign var=num2 value=$option_index2+1}--> 
     173                      <!--{** 回答エラー **}--> 
     174                      <!--{assign var=error1 value=$ERROR.question[$index].option[$option_index1]}--> 
     175                                      <!--{if $error1}--><span class="red"><!--{$error1}--></span><br /><!--{/if}--> 
     176                      <!--{assign var=error2 value=$ERROR.question[$index].option[$option_index2]}--> 
     177                                      <!--{if $error2}--><span class="red"><!--{$error2}--></span><br /><!--{/if}--> 
     178                      <!--{** 回答フォーム **}--> 
     179                      <!--{$num1}--> <input type="text" name="question[<!--{$index}-->][option][<!--{$option_index1}-->]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].option[$option_index1]|escape}-->" <!--{if $error1}--><!--{sfSetErrorStyle}--><!--{/if}-->>  
     180                      <!--{$num2}--> <input type="text" name="question[<!--{$index}-->][option][<!--{$option_index2}-->]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].option[$option_index2]|escape}-->" <!--{if $error2}--><!--{sfSetErrorStyle}--><!--{/if}-->> 
     181                    </td> 
     182                                  </tr> 
     183                <!--{/section}--> 
    176184                                </table> 
    177185                            </td></tr> 
  • branches/version-2_4-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php

    r17845 r18469  
    113113            } 
    114114 
     115            for( $i = 0; $i < count( $_POST["question"] ); $i++ ) { 
     116                if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) { 
     117                    $temp_data = array(); 
     118                    // 項目間(テキストボックス)があいていたら詰めていく 
     119                    for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 
     120                        if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" ); 
     121                    } 
     122                    $_POST["question"][$i]["option"] = $temp_data; 
     123                } else { 
     124                    $_POST["question"][$i]["option"] = NULL; 
     125                } 
     126            } 
     127 
    115128            $error = $this->lfErrCheck(); 
    116129 
     
    150163                //エラー表示 
    151164                $this->ERROR = $error; 
     165var_dump($this->ERROR); 
    152166                $this->QUESTION_ID = $_REQUEST['question_id']; 
    153167                $this->ERROR_COLOR = $this->lfGetErrColor($error, ERR_COLOR); 
     
    294308            if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) { 
    295309 
    296                 $temp_data = array(); 
    297310                for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 
    298  
    299                     // 項目間(テキストボックス)があいていたら詰めていく 
    300                     if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" ); 
    301  
    302                 } 
    303  
    304                 $_POST["question"][$i]["option"] = $temp_data; 
     311                    // 同じ回答がないかチェック 
     312                    if (strlen($_POST["question"][$i]["option"][$j]) > 0) { 
     313                        $checkArray = $_POST["question"][$i]["option"]; 
     314                        // 自身の値をunset 
     315                        unset($checkArray[$j]); 
     316                        if (in_array($_POST["question"][$i]["option"][$j], $checkArray)) { 
     317                            $objErr->arrErr["question"][$i]["option"][$j] = "同じ質問に同じ回答は設定出来ません。"; 
     318                        } 
     319                    } 
     320                } 
    305321 
    306322                if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0 
    307323                                                                                 && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "下記の2つ以上の項目に記入してください。"; 
     324 
    308325            } 
    309326        } 
Note: See TracChangeset for help on using the changeset viewer.