public function TrueFalseResponse::formatReport in Quiz 6.6
Same name and namespace in other branches
- 6.3 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::formatReport()
- 6.5 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::formatReport()
File
- question_types/
truefalse/ truefalse.classes.inc, line 197 - 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">Q:</span> ' . check_markup($this->question->body, $this->question->format) . '</div>';
$q_output .= theme('table', $innerheader, $rows) . '<br />';
return $q_output;
}