You are here

public function ScaleQuestion::getQuestionForm in Quiz 6.6

Generates the question form.

This is called whenever a question is rendered, either to an administrator or to a quiz taker.

Overrides QuizQuestion::getQuestionForm

1 call to ScaleQuestion::getQuestionForm()
ScaleQuestion::view in question_types/scale/scale.classes.inc
Implementation of view

File

question_types/scale/scale.classes.inc, line 291
The main classes for the scale question type.

Class

ScaleQuestion
Implementation of QuizQuestion.

Code

public function getQuestionForm($node, $context = NULL) {
  $options = array();
  for ($i = 0; $i < variable_get('scale_max_num_of_alts', 10); $i++) {
    if (strlen($node->{$i}->answer) > 0) {
      $options[$node->{$i}->id] = check_plain($node->{$i}->answer);
    }
  }
  $form['question'] = array(
    '#type' => 'markup',
    '#value' => check_markup($node->body, $node->format, FALSE),
  );
  $form['tries'] = array(
    '#type' => 'radios',
    '#title' => t('Choose one'),
    '#options' => $options,
  );
  return $form;
}