function quiz_translate_form_date in Quiz 6.5
Same name and namespace in other branches
- 8.4 quiz_datetime.inc \quiz_translate_form_date()
- 5.2 quiz_datetime.inc \quiz_translate_form_date()
- 5 quiz_datetime.inc \quiz_translate_form_date()
- 6.6 quiz_datetime.inc \quiz_translate_form_date()
- 6.2 quiz_datetime.inc \quiz_translate_form_date()
- 6.3 quiz_datetime.inc \quiz_translate_form_date()
- 6.4 quiz_datetime.inc \quiz_translate_form_date()
- 7.6 quiz.module \quiz_translate_form_date()
- 7 quiz_datetime.inc \quiz_translate_form_date()
- 7.4 quiz_datetime.inc \quiz_translate_form_date()
- 7.5 quiz.module \quiz_translate_form_date()
@file Handles the start and end times in a node form submission.
- Takes the array from form_date() and turns it into a timestamp
- Adjusts times for time zone offsets.
- Adapted from event.module
Parameters
$node The submitted node with form data.:
$date The name of the date ('quiz_open' or 'quiz_close') to translate.:
3 calls to quiz_translate_form_date()
- quiz_insert in ./
quiz.module - Implementation of hook_insert().
- quiz_update in ./
quiz.module - Implementation of hook_update().
- theme_quiz_view in ./
quiz.pages.inc - Theme the node view for quizzes.
File
- ./
quiz_datetime.inc, line 19 - Handles the start and end times in a node form submission.
Code
function quiz_translate_form_date(&$node, $date) {
$prefix = $node->{$date};
// If we have all the parameters, re-calculate $node->event_$date .
if (isset($prefix['year']) && isset($prefix['month']) && isset($prefix['day'])) {
// Build a timestamp based on the date supplied and the configured timezone.
$node->{$date} = _quiz_mktime(0, 0, 0, $prefix['month'], $prefix['day'], $prefix['year'], 0);
}
else {
form_set_error('quiz_open', t('Please supply a valid date.'));
}
}