function _quiz_form_prepare_date in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.module \_quiz_form_prepare_date()
- 5.2 quiz.module \_quiz_form_prepare_date()
- 5 quiz.module \_quiz_form_prepare_date()
- 6.6 quiz.module \_quiz_form_prepare_date()
- 6.2 quiz.module \_quiz_form_prepare_date()
- 6.3 quiz.module \_quiz_form_prepare_date()
- 6.4 quiz.module \_quiz_form_prepare_date()
- 6.5 quiz.module \_quiz_form_prepare_date()
- 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_form in ./
quiz.module - Implements hook_form().
- quiz_make_new in ./
quiz.module - Makes, saves and returns a new quiz node.
File
- ./
quiz.module, line 3679 - 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;
}