You are here

function theme_multichoice_report in Quiz 6.6

Same name and namespace in other branches
  1. 5.2 multichoice.module \theme_multichoice_report()
  2. 6.2 multichoice.module \theme_multichoice_report()
  3. 6.3 question_types/multichoice/multichoice.module \theme_multichoice_report()
  4. 6.5 question_types/multichoice/multichoice.module \theme_multichoice_report()

Theme a multichoice question report for quiz feedback.

File

question_types/multichoice/multichoice.module, line 1207
Multiple choice question type for the Quiz module.

Code

function theme_multichoice_report($question, $showpoints, $showfeedback) {

  // Build the question answers header (add blank space for IE).
  $innerheader = array(
    t('Answers'),
  );
  if ($showpoints) {
    $innerheader[] = t('Correct Answer');
  }
  $innerheader[] = t('User Answer');
  if ($showfeedback) {
    $innerheader[] = ' ';
  }
  foreach ($question->answers as $aid => $answer) {
    $cols = array();
    $cols[] = check_markup($answer['answer'], $answer['format']);
    if ($showpoints) {
      $cols[] = $answer['is_correct'] ? theme_multichoice_selected() : theme_multichoice_unselected();
    }
    $cols[] = $answer['user_answer'] ? theme_multichoice_selected() : theme_multichoice_unselected();
    $cols[] = $showfeedback && $answer['user_answer'] ? '<div class="quiz_answer_feedback">' . check_markup($answer['feedback'], $answer['format']) . '</div>' : '';
    $rows[] = $cols;
  }

  // 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($question->body) . '</div>';
  $q_output .= theme('table', $innerheader, $rows) . '<br />';
  return $q_output;
}