public function LongAnswerResponse::formatReport in Quiz 6.5
Same name and namespace in other branches
- 6.6 question_types/long_answer/long_answer.classes.inc \LongAnswerResponse::formatReport()
- 6.3 question_types/long_answer/long_answer.classes.inc \LongAnswerResponse::formatReport()
File
- question_types/
long_answer/ long_answer.classes.inc, line 217 - Long answer classes.
Class
Code
public function formatReport($showpoints = TRUE, $showfeedback = TRUE) {
$slug = '<div class="quiz_summary_question"><span class="quiz_question_bullet">Q:</span> ' . check_markup($this->question->body, $this->question->filter) . '</div>';
$result = '<div class="quiz_answer_feedback">';
if ($this->question && !empty($this->question->answers)) {
$answer = (object) current($this->question->answers);
if ($answer->is_evaluated == 1) {
// Show score:
if ($showpoints) {
$args = array(
'@yours' => $answer->score,
'@total' => $this->question->maximum_score,
);
$result .= t('Score: @yours of @total possible points', $args);
}
// Show feedback, if any.
if ($showfeedback && !empty($answer->feedback)) {
$result .= '</div><div class="quiz_answer_feedback">' . check_markup($answer->feedback, $this->question->format);
}
}
else {
$result .= t('This answer has not yet been scored.') . '<br/>' . t('Until the answer is scored, the total score will not be correct.');
}
if (user_access('score long answer')) {
$path = sprintf('admin/quiz/score-long-answer/%s/%s', $this->question->vid, $this->rid);
$result .= '<p>' . l(t('Score this answer'), $path) . '</p>';
}
}
else {
$result .= t('This question was not answered.');
}
$result .= '</div>';
return $slug . $result;
}