function theme_multichoice_feedback in Quiz 6.2
Same name and namespace in other branches
- 5.2 multichoice.module \theme_multichoice_feedback()
- 6.6 question_types/multichoice/multichoice.module \theme_multichoice_feedback()
- 6.3 question_types/multichoice/multichoice.module \theme_multichoice_feedback()
- 6.5 question_types/multichoice/multichoice.module \theme_multichoice_feedback()
Displays feedback for multichoice
Parameters
$quiz: The quiz node.
$report: The report variables.
Return value
$output HTML output to be written to the screen.
File
- ./
multichoice.module, line 1037 - Multiple choice question type for the Quiz module.
Code
function theme_multichoice_feedback($quiz, $report) {
$output = '<span class="quiz_summary_text">' . check_markup($report->body, $quiz->format) . '</span><br />';
foreach ($report->answers as $answer) {
if ($answer['user_answer']) {
$answers[] = check_markup($answer['answer'], $answer['format']);
$feedbacks[] = check_markup($answer['feedback'], $answer['format']);
}
if ($answer['is_correct']) {
$corrects[] = check_markup($answer['answer'], $answer['format']);
}
}
$label_answers = format_plural(count($answers), 'Your answer', 'Your answers');
$label_correct = format_plural(count($corrects), 'Correct answer', 'Correct answers');
$output .= '<span class="quiz_summary_header">' . $label_answers . ':</span> <span class="quiz_summary_text">' . implode(', ', $answers) . '</span>';
if ($answer['feedback']) {
$output .= '<div class="quiz_summary_text"><ul>';
foreach ($feedbacks as $feedback) {
$output .= '<li>' . $feedback . '</li>';
}
$output .= '</ul></div>';
}
// $output .= '<br />';
if ($report->correct) {
$output .= '<div class="multichoice_answer_correct">' . t("Correct") . '</div>';
}
else {
$output .= '<div class="multichoice_answer_incorrect">' . t("Incorrect") . "</div>";
$output .= '<span class="quiz_summary_header">' . $label_correct . ':</span> <span class="quiz_summary_text">' . implode(', ', $corrects) . '</span>';
}
return $output;
}