function multichoice_render_question_form in Quiz 5
Same name and namespace in other branches
- 5.2 multichoice.module \multichoice_render_question_form()
- 6.6 question_types/multichoice/multichoice.module \multichoice_render_question_form()
- 6.2 multichoice.module \multichoice_render_question_form()
- 6.3 question_types/multichoice/multichoice.module \multichoice_render_question_form()
- 6.5 question_types/multichoice/multichoice.module \multichoice_render_question_form()
Print question to screen
Parameters
$node: Question node
Return value
HTML output
1 string reference to 'multichoice_render_question_form'
File
- ./
multichoice.module, line 323 - Multiple choice question type for quiz module
Code
function multichoice_render_question_form($node) {
// Radio buttons for single selection questions, checkboxes for multiselect
if ($node->multiple_answers == 0) {
$type = 'radios';
}
else {
$type = 'checkboxes';
}
// Get options
$options = array();
while (list($key, $answer) = each($node->answers)) {
if (empty($answer['correct']) && !isset($answer['answer']) && empty($answer['feedback'])) {
unset($node->answers[$key]);
}
else {
$options[$key] = '<div class="multichoice_answer_text">' . check_markup($answer['answer'], $node->format, FALSE) . '</div>';
}
}
$form['start'] = array(
'#type' => 'markup',
'#value' => '<div class="multichoice_form">',
);
$form['question'] = array(
'#type' => 'markup',
'#value' => check_markup($node->body, $node->format, FALSE),
);
// Create form
$form['tries'] = array(
'#type' => $type,
'#options' => $options,
'#default_value' => -1,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}