You are here

function theme_quiz_take_summary in Quiz 6.6

Same name and namespace in other branches
  1. 8.4 quiz.pages.inc \theme_quiz_take_summary()
  2. 5.2 quiz.module \theme_quiz_take_summary()
  3. 5 quiz.module \theme_quiz_take_summary()
  4. 6.2 quiz.pages.inc \theme_quiz_take_summary()
  5. 6.3 quiz.pages.inc \theme_quiz_take_summary()
  6. 6.4 quiz.pages.inc \theme_quiz_take_summary()
  7. 6.5 quiz.pages.inc \theme_quiz_take_summary()
  8. 7 quiz.pages.inc \theme_quiz_take_summary()
  9. 7.4 quiz.pages.inc \theme_quiz_take_summary()

Theme the summary page after the quiz has been completed.

Parameters

$quiz: The quiz node object.

$questions: The questions array as defined by _quiz_get_answers.

$score: Array of score information as returned by quiz_calculate_score().

$summary: Filtered text of the summary.

Return value

Themed html.

1 theme call to theme_quiz_take_summary()
quiz_take_quiz in ./quiz.module
Handles quiz taking.

File

./quiz.pages.inc, line 406
User pages.

Code

function theme_quiz_take_summary($quiz, $questions, $score, $summary) {

  // Set the title here so themers can adjust.
  drupal_set_title(check_plain($quiz->title));

  // Display overall result.
  $output = '';

  // Only display scoring information if this is not a personality test:

  //if ($score['percentage_score']) {
  if (!empty($score['possible_score'])) {
    if (!$score['is_evaluated']) {
      $msg = t('Parts of this @quiz have not been evaluated yet. The score below is not final.', array(
        '@quiz' => QUIZ_NAME,
      ));
      drupal_set_message($msg, 'error');
    }
    $output .= '<div id="quiz_score_possible">' . t('You got %num_correct of %question_count possible points.', array(
      '%num_correct' => $score['numeric_score'],
      '%question_count' => $score['possible_score'],
    )) . '</div>' . "\n";
    $output .= '<div id="quiz_score_percent">' . t('Your score: %score%', array(
      '%score' => $score['percentage_score'],
    )) . '</div><br />' . "\n";
  }
  $output .= '<div id="quiz_summary">' . check_markup($summary, $quiz->format) . '</div><br />' . "\n";

  // Get the feedback for all questions.
  $output .= theme('quiz_feedback', $questions, $quiz->pass_rate > 0, TRUE);
  return $output;
}