public function TrueFalseResponse::formatReport in Quiz 6.3
Same name and namespace in other branches
- 6.6 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::formatReport()
- 6.5 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::formatReport()
Return an HTML marked-up report for displaying the results of this question.
Return value
An HTML string.
Overrides QuizQuestionResponse::formatReport
File
- question_types/
quiz_question/ quiz_question.truefalse.inc, line 196 - Defines the classes necessary for a True/False quiz.
Class
Code
public function formatReport($showpoints = TRUE, $showfeedback = TRUE) {
// Build the question answers header (add blank space for IE).
if ($showpoints) {
$innerheader[] = t('Correct Answer');
}
$innerheader[] = t('User Answer');
if ($showfeedback) {
$innerheader[] = ' ';
}
if (empty($this->question->answers)) {
return t('Missing question.');
}
$answer = $this->question->answers[0];
$correct_answer = $answer['is_correct'] ? $answer['answer'] : !$answer['answer'];
$user_answer = $answer['answer'];
if ($showpoints) {
$rows[0][] = $correct_answer ? t('True') : t('False');
}
$rows[0][] = $user_answer ? t('True') : t('False');
if ($showfeedback && !empty($this->question->feedback)) {
$rows[0][] = $this->question->feedback;
}
// Add the cell with the question and the answers.
$q_output = '<div class="quiz_summary_question"><span class="quiz_question_bullet">' . t('Q:') . '</span> ' . check_markup($this->question->body, $this->question->format) . '</div>';
$q_output .= theme('table', $innerheader, $rows) . '<br />';
return $q_output;
}