You are here

function quiz_admin_results in Quiz 7

Same name and namespace in other branches
  1. 8.6 quiz.admin.inc \quiz_admin_results()
  2. 8.4 quiz.admin.inc \quiz_admin_results()
  3. 8.5 quiz.admin.inc \quiz_admin_results()
  4. 5.2 quiz.module \quiz_admin_results()
  5. 5 quiz.module \quiz_admin_results()
  6. 6.6 quiz.admin.inc \quiz_admin_results()
  7. 6.2 quiz.admin.inc \quiz_admin_results()
  8. 6.3 quiz.admin.inc \quiz_admin_results()
  9. 6.4 quiz.admin.inc \quiz_admin_results()
  10. 6.5 quiz.admin.inc \quiz_admin_results()
  11. 7.6 quiz.admin.inc \quiz_admin_results()
  12. 7.4 quiz.admin.inc \quiz_admin_results()
  13. 7.5 quiz.admin.inc \quiz_admin_results()
  14. 6.x quiz.admin.inc \quiz_admin_results()

Quiz result report page for the quiz admin section

Parameters

$quiz: The quiz node

$rid: The result id

1 string reference to 'quiz_admin_results'
quiz_menu in ./quiz.module
Implements hook_menu().

File

./quiz.admin.inc, line 361
Administrator interface for Quiz module.

Code

function quiz_admin_results($quiz, $rid) {
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l(t('Quiz Results'), 'admin/quiz/reports/results');

  // Make sure we have the right version of the quiz
  $vid = db_query('SELECT vid FROM {quiz_node_results} WHERE result_id = :result_id', array(
    ':result_id' => $rid,
  ))
    ->fetchField();
  if ($quiz->vid != $vid) {
    $quiz = node_load($quiz->nid, $vid);
  }

  // Get all the data we need.
  $questions = _quiz_get_answers($quiz, $rid);
  $score = quiz_calculate_score($quiz, $rid);
  $summary = _quiz_get_summary_text($quiz, $score);

  // Lets add the quiz title to the breadcrumb array.
  $breadcrumb[] = l($quiz->title, 'admin/quiz/reports/results/' . $quiz->nid);

  //drupal_set_breadcrumb($breadcrumb);
  return theme('quiz_admin_summary', array(
    'quiz' => $quiz,
    'questions' => $questions,
    'score' => $score,
    'summary' => $summary,
  ));
}