You are here

function _quiz_remove_unscored_message in Quiz 7

Same name and namespace in other branches
  1. 8.6 quiz.pages.inc \_quiz_remove_unscored_message()
  2. 8.4 quiz.pages.inc \_quiz_remove_unscored_message()
  3. 8.5 quiz.pages.inc \_quiz_remove_unscored_message()
  4. 6.4 quiz.pages.inc \_quiz_remove_unscored_message()
  5. 7.6 quiz.pages.inc \_quiz_remove_unscored_message()
  6. 7.4 quiz.pages.inc \_quiz_remove_unscored_message()
  7. 7.5 quiz.pages.inc \_quiz_remove_unscored_message()

Helper function to remove the message saying the quiz haven't been scored

1 call to _quiz_remove_unscored_message()
quiz_report_form_submit in ./quiz.pages.inc
Submit the report form

File

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

Code

function _quiz_remove_unscored_message() {
  if (is_array($_SESSION['messages']['warning'])) {

    // Search for the message, and remove it if we find it.
    foreach ($_SESSION['messages']['warning'] as $key => $val) {
      if ($val == t('This quiz has not been scored yet.')) {
        unset($_SESSION['messages']['warning'][$key]);
      }
    }

    // Clean up if the message array was left empty
    if (empty($_SESSION['messages']['warning'])) {
      unset($_SESSION['messages']['warning']);
      if (empty($_SESSION['messages'])) {
        unset($_SESSION['messages']);
      }
    }
  }
}