| @@ 7080-7137 (lines=58) @@ | ||
| 7077 | } |
|
| 7078 | } |
|
| 7079 | ||
| 7080 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
| 7081 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 7082 | ||
| 7083 | $answer_input = '<label class="checkbox">'; |
|
| 7084 | $answer_input .= Display::input('checkbox', 'choice['.$questionId.']['.$numAnswer.']', $numAnswer, $attributes); |
|
| 7085 | $answer_input .= $answer; |
|
| 7086 | $answer_input .= '</label>'; |
|
| 7087 | ||
| 7088 | if ($show_comment) { |
|
| 7089 | $s .= '<tr><td>'; |
|
| 7090 | $s .= $answer_input; |
|
| 7091 | $s .= '</td>'; |
|
| 7092 | $s .= '<td>'; |
|
| 7093 | $s .= $comment; |
|
| 7094 | $s .= '</td>'; |
|
| 7095 | $s .='</tr>'; |
|
| 7096 | } else { |
|
| 7097 | $s .= $answer_input; |
|
| 7098 | } |
|
| 7099 | } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 7100 | ||
| 7101 | $my_choice = array(); |
|
| 7102 | if (!empty($user_choice_array)) { |
|
| 7103 | foreach ($user_choice_array as $item) { |
|
| 7104 | $item = explode(':', $item); |
|
| 7105 | $my_choice[$item[0]] = $item[1]; |
|
| 7106 | } |
|
| 7107 | } |
|
| 7108 | ||
| 7109 | $s .='<tr>'; |
|
| 7110 | $s .= Display::tag('td', $answer); |
|
| 7111 | ||
| 7112 | if (!empty($quiz_question_options)) { |
|
| 7113 | foreach ($quiz_question_options as $id => $item) { |
|
| 7114 | $id = $item['iid']; |
|
| 7115 | if (isset($my_choice[$numAnswer]) && $id == $my_choice[$numAnswer]) { |
|
| 7116 | $attributes = array('checked' => 1, 'selected' => 1); |
|
| 7117 | } else { |
|
| 7118 | $attributes = array(); |
|
| 7119 | } |
|
| 7120 | ||
| 7121 | if ($debug_mark_answer) { |
|
| 7122 | if ($id == $answerCorrect) { |
|
| 7123 | $attributes['checked'] = 1; |
|
| 7124 | $attributes['selected'] = 1; |
|
| 7125 | } |
|
| 7126 | } |
|
| 7127 | $s .= Display::tag('td', Display::input('radio', 'choice['.$questionId.']['.$numAnswer.']', $id, $attributes), array('style' => '')); |
|
| 7128 | } |
|
| 7129 | } |
|
| 7130 | ||
| 7131 | if ($show_comment) { |
|
| 7132 | $s .= '<td>'; |
|
| 7133 | $s .= $comment; |
|
| 7134 | $s .= '</td>'; |
|
| 7135 | } |
|
| 7136 | $s.='</tr>'; |
|
| 7137 | } |
|
| 7138 | ||
| 7139 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
|
| 7140 | ||
| @@ 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; |
|