You are here

function _quiz_get_summary_text in Quiz 5

Same name and namespace in other branches
  1. 8.4 quiz.module \_quiz_get_summary_text()
  2. 5.2 quiz.module \_quiz_get_summary_text()
  3. 6.6 quiz.module \_quiz_get_summary_text()
  4. 6.2 quiz.module \_quiz_get_summary_text()
  5. 6.3 quiz.module \_quiz_get_summary_text()
  6. 6.4 quiz.module \_quiz_get_summary_text()
  7. 6.5 quiz.module \_quiz_get_summary_text()
  8. 7.6 quiz.module \_quiz_get_summary_text()
  9. 7 quiz.module \_quiz_get_summary_text()
  10. 7.4 quiz.module \_quiz_get_summary_text()
  11. 7.5 quiz.module \_quiz_get_summary_text()
3 calls to _quiz_get_summary_text()
quiz_admin_results in ./quiz.module
quiz_take_quiz in ./quiz.module
Handles quiz taking
quiz_user_results in ./quiz.module

File

./quiz.module, line 702
Quiz Module

Code

function _quiz_get_summary_text($quiz, $score) {
  $summary = '';

  // if we are using pass / fail and they passed
  if (trim($quiz->summary_pass) != '' && $quiz->pass_rate > 0 && $score['percentage_score'] >= $quiz->pass_rate) {

    // If we are coming from the admin view page
    if (arg(3) == 'view') {
      $summary = t('The user passed this quiz.');
    }
    else {
      $summary = check_markup($quiz->summary_pass, $quiz->format);
    }
  }
  else {

    // If we are coming from the admin view page
    // only show a summary if we are using pass / fail.
    if (arg(3) == 'view') {
      if ($node->pass_rate > 0) {
        $summary = t('The user failed this quiz.');
      }
    }
    else {
      $summary = check_markup($quiz->summary_default, $quiz->format);
    }
  }
  return $summary;
}