| @@ 7133-7190 (lines=58) @@ | ||
| 7130 | } |
|
| 7131 | } |
|
| 7132 | ||
| 7133 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
| 7134 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 7135 | ||
| 7136 | $answer_input = '<label class="checkbox">'; |
|
| 7137 | $answer_input .= Display::input('checkbox', 'choice['.$questionId.']['.$numAnswer.']', $numAnswer, $attributes); |
|
| 7138 | $answer_input .= $answer; |
|
| 7139 | $answer_input .= '</label>'; |
|
| 7140 | ||
| 7141 | if ($show_comment) { |
|
| 7142 | $s .= '<tr><td>'; |
|
| 7143 | $s .= $answer_input; |
|
| 7144 | $s .= '</td>'; |
|
| 7145 | $s .= '<td>'; |
|
| 7146 | $s .= $comment; |
|
| 7147 | $s .= '</td>'; |
|
| 7148 | $s .='</tr>'; |
|
| 7149 | } else { |
|
| 7150 | $s .= $answer_input; |
|
| 7151 | } |
|
| 7152 | } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 7153 | ||
| 7154 | $my_choice = array(); |
|
| 7155 | if (!empty($user_choice_array)) { |
|
| 7156 | foreach ($user_choice_array as $item) { |
|
| 7157 | $item = explode(':', $item); |
|
| 7158 | $my_choice[$item[0]] = $item[1]; |
|
| 7159 | } |
|
| 7160 | } |
|
| 7161 | ||
| 7162 | $s .='<tr>'; |
|
| 7163 | $s .= Display::tag('td', $answer); |
|
| 7164 | ||
| 7165 | if (!empty($quiz_question_options)) { |
|
| 7166 | foreach ($quiz_question_options as $id => $item) { |
|
| 7167 | $id = $item['iid']; |
|
| 7168 | if (isset($my_choice[$numAnswer]) && $id == $my_choice[$numAnswer]) { |
|
| 7169 | $attributes = array('checked' => 1, 'selected' => 1); |
|
| 7170 | } else { |
|
| 7171 | $attributes = array(); |
|
| 7172 | } |
|
| 7173 | ||
| 7174 | if ($debug_mark_answer) { |
|
| 7175 | if ($id == $answerCorrect) { |
|
| 7176 | $attributes['checked'] = 1; |
|
| 7177 | $attributes['selected'] = 1; |
|
| 7178 | } |
|
| 7179 | } |
|
| 7180 | $s .= Display::tag('td', Display::input('radio', 'choice['.$questionId.']['.$numAnswer.']', $id, $attributes), array('style' => '')); |
|
| 7181 | } |
|
| 7182 | } |
|
| 7183 | ||
| 7184 | if ($show_comment) { |
|
| 7185 | $s .= '<td>'; |
|
| 7186 | $s .= $comment; |
|
| 7187 | $s .= '</td>'; |
|
| 7188 | } |
|
| 7189 | $s.='</tr>'; |
|
| 7190 | } |
|
| 7191 | ||
| 7192 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
| 7193 | ||
| @@ 383-457 (lines=75) @@ | ||
| 380 | } |
|
| 381 | } |
|
| 382 | ||
| 383 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
| 384 | $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 385 | ||
| 386 | $answer_input = '<label class="checkbox">'; |
|
| 387 | $answer_input .= Display::input( |
|
| 388 | 'checkbox', |
|
| 389 | 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 390 | $numAnswer, |
|
| 391 | $attributes |
|
| 392 | ); |
|
| 393 | $answer_input .= $answer; |
|
| 394 | $answer_input .= '</label>'; |
|
| 395 | ||
| 396 | if ($show_comment) { |
|
| 397 | $s .= '<tr><td>'; |
|
| 398 | $s .= $answer_input; |
|
| 399 | $s .= '</td>'; |
|
| 400 | $s .= '<td>'; |
|
| 401 | $s .= $comment; |
|
| 402 | $s .= '</td>'; |
|
| 403 | $s .= '</tr>'; |
|
| 404 | } else { |
|
| 405 | $s .= $answer_input; |
|
| 406 | } |
|
| 407 | } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 408 | ||
| 409 | $my_choice = array(); |
|
| 410 | if (!empty($user_choice_array)) { |
|
| 411 | foreach ($user_choice_array as $item) { |
|
| 412 | $item = explode(':', $item); |
|
| 413 | $my_choice[$item[0]] = $item[1]; |
|
| 414 | } |
|
| 415 | } |
|
| 416 | ||
| 417 | $s .= '<tr>'; |
|
| 418 | $s .= Display::tag('td', $answer); |
|
| 419 | ||
| 420 | if (!empty($quiz_question_options)) { |
|
| 421 | foreach ($quiz_question_options as $id => $item) { |
|
| 422 | ||
| 423 | if (isset($my_choice[$numAnswer]) && $id == $my_choice[$numAnswer]) { |
|
| 424 | $attributes = array( |
|
| 425 | 'checked' => 1, |
|
| 426 | 'selected' => 1 |
|
| 427 | ); |
|
| 428 | } else { |
|
| 429 | $attributes = array(); |
|
| 430 | } |
|
| 431 | ||
| 432 | if ($debug_mark_answer) { |
|
| 433 | if ($id == $answerCorrect) { |
|
| 434 | $attributes['checked'] = 1; |
|
| 435 | $attributes['selected'] = 1; |
|
| 436 | } |
|
| 437 | } |
|
| 438 | $s .= Display::tag( |
|
| 439 | 'td', |
|
| 440 | Display::input( |
|
| 441 | 'radio', |
|
| 442 | 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 443 | $id, |
|
| 444 | $attributes |
|
| 445 | ), |
|
| 446 | array('style' => '') |
|
| 447 | ); |
|
| 448 | } |
|
| 449 | } |
|
| 450 | ||
| 451 | if ($show_comment) { |
|
| 452 | $s .= '<td>'; |
|
| 453 | $s .= $comment; |
|
| 454 | $s .= '</td>'; |
|
| 455 | } |
|
| 456 | $s .= '</tr>'; |
|
| 457 | } |
|
| 458 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
| 459 | // multiple answers |
|
| 460 | $input_id = 'choice-' . $questionId . '-' . $answerId; |
|