You are here

function theme_quiz_feedback in Quiz 5.2

Same name and namespace in other branches
  1. 5 quiz.module \theme_quiz_feedback()
  2. 6.6 \theme_quiz_feedback()
  3. 6.2 \theme_quiz_feedback()
  4. 6.3 \theme_quiz_feedback()
  5. 6.5 \theme_quiz_feedback()

Theme the question feedback.


$questions: Array of quiz objects as returned by _quiz_get_answers.

showpoints: Binary flag for whether to show the actual answers or not.

$showfeedback: Binary flag for whether to show question feedback.

Return value

Themed html.

3 theme calls to theme_quiz_feedback()
theme_quiz_admin_summary in ./quiz.module
Theme the summary page for admins.
theme_quiz_take_summary in ./quiz.module
Theme the summary page after the quiz has been completed.
theme_quiz_user_summary in ./quiz.module
Theme the summary page for user results.


./quiz.module, line 2426


function theme_quiz_feedback($questions, $showpoints = TRUE, $showfeedback = FALSE) {
  $header = array(
    t('Question Result(s)'),

  // Go through each of the questions.
  foreach ($questions as $question) {
    $cols = array();

    // Ask each question to render a themed report of how the user did.
    $cols[] = array(
      'data' => theme($question->type . '_report', $question, $showpoints, $showfeedback),
      'class' => 'quiz_summary_qrow',

    // Get the score result for each question only if it's a scored quiz.
    if ($showpoints) {
      $theme = $question->correct ? 'quiz_score_correct' : 'quiz_score_incorrect';
      $cols[] = array(
        'data' => theme($theme),
        'class' => 'quiz_summary_qcell',

    // Pack all of this into a table row.
    $rows[] = array(
      'data' => $cols,
      'class' => 'quiz_summary_qrow',
  return theme('table', $header, $rows);