You are here

function _quiz_availability in Quiz 5

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

Determine quiz availability status

Return value

String representing status open, closed or future

2 calls to _quiz_availability()
theme_quiz_availability in ./quiz.module
Themes a message about the quiz's availability for quiz takers
_quiz_status_access in ./quiz.module
Determine who should have access to the Take Quiz tab depending on the quiz status

File

./quiz.module, line 1490
Quiz Module

Code

function _quiz_availability($node) {
  if (!$node->quiz_always) {

    // the quiz is open
    if ($node->quiz_open > time()) {
      $status = 'future';

      // the quiz is currently closed but will open in the future
    }
    elseif ($node->quiz_open < time() && $node->quiz_close > time()) {
      $status = 'open';

      // the quiz was open and is now closed
    }
    else {
      $status = 'closed';
    }
  }
  else {
    $status = 'open';
  }
  return $status;
}