public function DragDropQuestion::getAnsweringForm in Quiz Drag Drop 7
Generates the question form.
This is called whenever a question is rendered, either to an administrator or to a quiz taker.
File
- ./
quiz_drag_drop.classes.inc, line 128 - Question type, enabling the creation of drag drop type of questions.
Class
- DragDropQuestion
- Extension of QuizQuestion.
Code
public function getAnsweringForm(array $form_state = NULL, $rid) {
$form = parent::getAnsweringForm($form_state, $rid);
list($matches, $images) = $this
->getSubquestions();
$matches = $this
->customShuffle($matches);
$images = $this
->customShuffle($images);
$data = array(
'placeholder' => $matches,
'images' => $images,
);
$form['drag_drop_answer'] = array(
'#markup' => theme('quiz_drag_drop_answer_form', array(
'data' => $data,
)),
);
$form['answerCount'] = array(
'#type' => 'hidden',
'#value' => '',
'#name' => 'answerCount',
'#attributes' => array(
'id' => 'answerCount',
),
);
$form['dropCount'] = array(
'#type' => 'hidden',
'#value' => '',
'#name' => 'dropCount',
'#attributes' => array(
'id' => 'dropCount',
),
);
$form['tries'] = array(
'#type' => 'hidden',
'#value' => 0,
);
$form['reset'] = array(
'#type' => 'button',
'#value' => t('Reset'),
'#attributes' => array(
'class' => array(
'reset_btn',
),
),
'#id' => 'btnReset',
);
return $form;
}