You are here

function _quiz_form_prepare_date in Quiz 8.4

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

Takes a time element and prepares to send it to form_date().

Parameters

$time: The time to be turned into an array. This can be:

  • A timestamp when from the database.
  • An array (day, month, year) when previewing.
  • NULL for new nodes.

Return value

An array for form_date (day, month, year).

2 calls to _quiz_form_prepare_date()
quiz_options_form in ./quiz.pages.inc
Page callback for quiz options form
_quiz_get_node_defaults in ./quiz.module
Returns default values for all quiz settings.

File

./quiz.module, line 1022
Quiz Module

Code

function _quiz_form_prepare_date($time = '', $offset = 0) {

  // If this is empty, get the current time.
  if ($time == '') {
    $time = REQUEST_TIME + $offset * 86400;
  }

  // If we are previewing, $time will be an array so just pass it through.
  $time_array = array();
  if (is_array($time)) {
    $time_array = $time;
  }
  elseif (is_numeric($time)) {
    $time_array = array(
      'day' => _quiz_date('j', $time),
      'month' => _quiz_date('n', $time),
      'year' => _quiz_date('Y', $time),
    );
  }
  return $time_array;
}