function _quiz_add_revision_checkbox in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.admin.inc \_quiz_add_revision_checkbox()
- 6.4 quiz.admin.inc \_quiz_add_revision_checkbox()
- 7.6 quiz.admin.inc \_quiz_add_revision_checkbox()
- 7.4 quiz.admin.inc \_quiz_add_revision_checkbox()
- 7.5 quiz.admin.inc \_quiz_add_revision_checkbox()
Adds checkbox for creating new revision. Checks it by default if answers exists.
Parameters
$form: FAPI form(array)
$quiz: Quiz node(object)
2 calls to _quiz_add_revision_checkbox()
- quiz_categorized_form in ./
quiz.admin.inc - Form for managing what questions should be added to a quiz with categorized random questions.
- quiz_questions_form in ./
quiz.admin.inc - Handles "manage questions" tab.
File
- ./
quiz.admin.inc, line 1207 - Administrator interface for Quiz module.
Code
function _quiz_add_revision_checkbox(&$form, &$quiz) {
// Recomend and preselect to create the quiz as a new revision if it already has been answered
if (quiz_has_been_answered($quiz)) {
$rev_default = TRUE;
$rev_description = t('This quiz has been answered. To maintain correctnes of existing answer reports changes should be saved as a new revision.');
}
else {
$rev_default = in_array('revision', variable_get('node_options_quiz', array()));
$rev_description = t('Allow question status changes to create a new revision of the quiz?');
}
if (user_access('manual quiz revisioning') && !variable_get('quiz_auto_revisioning', 1)) {
$form['new_revision'] = array(
'#type' => 'checkbox',
'#default_value' => $rev_default,
'#title' => t('New revision'),
'#description' => $rev_description,
);
}
else {
$form['new_revision'] = array(
'#type' => 'value',
'#value' => $rev_default,
);
}
}