| @@ 376-450 (lines=75) @@ | ||
| 373 | } |
|
| 374 | } |
|
| 375 | ||
| 376 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
| 377 | $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 378 | ||
| 379 | $answer_input = '<label class="checkbox">'; |
|
| 380 | $answer_input .= Display::input( |
|
| 381 | 'checkbox', |
|
| 382 | 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 383 | $numAnswer, |
|
| 384 | $attributes |
|
| 385 | ); |
|
| 386 | $answer_input .= $answer; |
|
| 387 | $answer_input .= '</label>'; |
|
| 388 | ||
| 389 | if ($show_comment) { |
|
| 390 | $s .= '<tr><td>'; |
|
| 391 | $s .= $answer_input; |
|
| 392 | $s .= '</td>'; |
|
| 393 | $s .= '<td>'; |
|
| 394 | $s .= $comment; |
|
| 395 | $s .= '</td>'; |
|
| 396 | $s .= '</tr>'; |
|
| 397 | } else { |
|
| 398 | $s .= $answer_input; |
|
| 399 | } |
|
| 400 | } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 401 | ||
| 402 | $my_choice = array(); |
|
| 403 | if (!empty($user_choice_array)) { |
|
| 404 | foreach ($user_choice_array as $item) { |
|
| 405 | $item = explode(':', $item); |
|
| 406 | $my_choice[$item[0]] = $item[1]; |
|
| 407 | } |
|
| 408 | } |
|
| 409 | ||
| 410 | $s .= '<tr>'; |
|
| 411 | $s .= Display::tag('td', $answer); |
|
| 412 | ||
| 413 | if (!empty($quiz_question_options)) { |
|
| 414 | foreach ($quiz_question_options as $id => $item) { |
|
| 415 | ||
| 416 | if (isset($my_choice[$numAnswer]) && $id == $my_choice[$numAnswer]) { |
|
| 417 | $attributes = array( |
|
| 418 | 'checked' => 1, |
|
| 419 | 'selected' => 1 |
|
| 420 | ); |
|
| 421 | } else { |
|
| 422 | $attributes = array(); |
|
| 423 | } |
|
| 424 | ||
| 425 | if ($debug_mark_answer) { |
|
| 426 | if ($id == $answerCorrect) { |
|
| 427 | $attributes['checked'] = 1; |
|
| 428 | $attributes['selected'] = 1; |
|
| 429 | } |
|
| 430 | } |
|
| 431 | $s .= Display::tag( |
|
| 432 | 'td', |
|
| 433 | Display::input( |
|
| 434 | 'radio', |
|
| 435 | 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 436 | $id, |
|
| 437 | $attributes |
|
| 438 | ), |
|
| 439 | array('style' => '') |
|
| 440 | ); |
|
| 441 | } |
|
| 442 | } |
|
| 443 | ||
| 444 | if ($show_comment) { |
|
| 445 | $s .= '<td>'; |
|
| 446 | $s .= $comment; |
|
| 447 | $s .= '</td>'; |
|
| 448 | } |
|
| 449 | $s .= '</tr>'; |
|
| 450 | } |
|
| 451 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
| 452 | // multiple answers |
|
| 453 | $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| @@ 7069-7126 (lines=58) @@ | ||
| 7066 | } |
|
| 7067 | } |
|
| 7068 | ||
| 7069 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
| 7070 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 7071 | ||
| 7072 | $answer_input = '<label class="checkbox">'; |
|
| 7073 | $answer_input .= Display::input('checkbox', 'choice['.$questionId.']['.$numAnswer.']', $numAnswer, $attributes); |
|
| 7074 | $answer_input .= $answer; |
|
| 7075 | $answer_input .= '</label>'; |
|
| 7076 | ||
| 7077 | if ($show_comment) { |
|
| 7078 | $s .= '<tr><td>'; |
|
| 7079 | $s .= $answer_input; |
|
| 7080 | $s .= '</td>'; |
|
| 7081 | $s .= '<td>'; |
|
| 7082 | $s .= $comment; |
|
| 7083 | $s .= '</td>'; |
|
| 7084 | $s .='</tr>'; |
|
| 7085 | } else { |
|
| 7086 | $s .= $answer_input; |
|
| 7087 | } |
|
| 7088 | } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 7089 | ||
| 7090 | $my_choice = array(); |
|
| 7091 | if (!empty($user_choice_array)) { |
|
| 7092 | foreach ($user_choice_array as $item) { |
|
| 7093 | $item = explode(':', $item); |
|
| 7094 | $my_choice[$item[0]] = $item[1]; |
|
| 7095 | } |
|
| 7096 | } |
|
| 7097 | ||
| 7098 | $s .='<tr>'; |
|
| 7099 | $s .= Display::tag('td', $answer); |
|
| 7100 | ||
| 7101 | if (!empty($quiz_question_options)) { |
|
| 7102 | foreach ($quiz_question_options as $id => $item) { |
|
| 7103 | $id = $item['iid']; |
|
| 7104 | if (isset($my_choice[$numAnswer]) && $id == $my_choice[$numAnswer]) { |
|
| 7105 | $attributes = array('checked' => 1, 'selected' => 1); |
|
| 7106 | } else { |
|
| 7107 | $attributes = array(); |
|
| 7108 | } |
|
| 7109 | ||
| 7110 | if ($debug_mark_answer) { |
|
| 7111 | if ($id == $answerCorrect) { |
|
| 7112 | $attributes['checked'] = 1; |
|
| 7113 | $attributes['selected'] = 1; |
|
| 7114 | } |
|
| 7115 | } |
|
| 7116 | $s .= Display::tag('td', Display::input('radio', 'choice['.$questionId.']['.$numAnswer.']', $id, $attributes), array('style' => '')); |
|
| 7117 | } |
|
| 7118 | } |
|
| 7119 | ||
| 7120 | if ($show_comment) { |
|
| 7121 | $s .= '<td>'; |
|
| 7122 | $s .= $comment; |
|
| 7123 | $s .= '</td>'; |
|
| 7124 | } |
|
| 7125 | $s.='</tr>'; |
|
| 7126 | } |
|
| 7127 | ||
| 7128 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
| 7129 | ||