function _quiz_add_fields_for_random_quiz in Quiz 6.4
Same name and namespace in other branches
- 8.4 quiz.admin.inc \_quiz_add_fields_for_random_quiz()
- 7.6 quiz.admin.inc \_quiz_add_fields_for_random_quiz()
- 7 quiz.admin.inc \_quiz_add_fields_for_random_quiz()
- 7.4 quiz.admin.inc \_quiz_add_fields_for_random_quiz()
- 7.5 quiz.admin.inc \_quiz_add_fields_for_random_quiz()
Add fields for random quiz to the quiz_questions_form
Parameters
$form: FAPI form array
$quiz: The quiz node(object)
1 call to _quiz_add_fields_for_random_quiz()
- quiz_questions_form in ./
quiz.admin.inc - Handles "manage questions" tab.
File
- ./
quiz.admin.inc, line 916 - Administrator interface for Quiz module.
Code
function _quiz_add_fields_for_random_quiz(&$form, $quiz) {
if ($quiz->randomization != 2) {
return;
}
$form['question_list']['random_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Settings for random questions'),
'#collapsible' => TRUE,
);
$form['question_list']['random_settings']['num_random_questions'] = array(
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#weight' => -5,
'#title' => t('Number of random questions'),
'#description' => t('The number of questions to be randomly selected each time someone takes this quiz'),
'#default_value' => isset($quiz->number_of_random_questions) ? $quiz->number_of_random_questions : 10,
);
$form['question_list']['random_settings']['max_score_for_random'] = array(
'#type' => 'textfield',
'#size' => 3,
'#maxlength' => 3,
'#weight' => -5,
'#title' => t('Max score for each random question'),
'#default_value' => isset($quiz->max_score_for_random) ? $quiz->max_score_for_random : 1,
);
$terms = _quiz_taxonomy_select($quiz->tid);
if (!empty($terms) && function_exists('taxonomy_get_vocabularies')) {
$form['question_list']['random_settings']['random_term_id'] = array(
'#type' => 'select',
'#title' => t('Terms'),
'#size' => 1,
'#options' => _quiz_taxonomy_select($quiz->tid),
'#default_value' => $quiz->tid,
'#description' => t('Randomly select from questions with this term, or choose from the question pool below'),
'#weight' => -4,
);
}
}