You are here

public function MatchingQuestion::getCreationForm in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  2. 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  3. 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  4. 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  5. 7 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  6. 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()
  7. 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCreationForm()

Get the form used to create a new question.

Return value

Must return a FAPI array.

Overrides QuizQuestion::getCreationForm

File

question_types/matching/matching.classes.inc, line 152
quiz_directions.classes

Class

MatchingQuestion
Implementation of Matching.

Code

public function getCreationForm($edit) {
  $form['match'] = array(
    '#type' => 'fieldset',
    '#title' => t('Answer'),
    '#tree' => TRUE,
    '#theme' => 'matching_question_form',
    '#description' => t('Write you pairs in the question and answer columns. For the user the question will be fixed and the answers will be shown as alternatives in a dropdown box.'),
  );
  for ($i = 1; $i <= variable_get('quiz_matching_form_size', 5); ++$i) {
    $form['match'][$i] = array(
      '#type' => 'fieldset',
      '#title' => t('Question ' . $i),
    );
    $form['match'][$i]['match_id'] = array(
      '#type' => 'hidden',
      '#default_value' => isset($this->node->match[$i - 1]['match_id']) ? $this->node->match[$i - 1]['match_id'] : '',
    );
    $form['match'][$i]['question'] = array(
      '#type' => 'textarea',
      '#rows' => 2,
      '#default_value' => isset($this->node->match[$i - 1]['question']) ? $this->node->match[$i - 1]['question'] : '',
    );
    $form['match'][$i]['answer'] = array(
      '#type' => 'textarea',
      '#rows' => 2,
      '#default_value' => isset($this->node->match[$i - 1]['answer']) ? $this->node->match[$i - 1]['answer'] : '',
    );
    $form['match'][$i]['feedback'] = array(
      '#type' => 'textarea',
      '#rows' => 2,
      '#default_value' => isset($this->node->match[$i - 1]['feedback']) ? $this->node->match[$i - 1]['feedback'] : '',
    );
  }
  return $form;
}