You are here

public function QuizfileuploadQuestion::getCreationForm in Quiz File Upload 7.4

Same name and namespace in other branches
  1. 6 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()
  2. 7.5 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()
  3. 7 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()

Implements getCreationForm().

See also

QuizQuestion#getCreationForm($form_state)

File

./quizfileupload.classes.inc, line 168
The main classes for the quizfileupload question type.

Class

QuizfileuploadQuestion
Extension of QuizQuestion.

Code

public function getCreationForm(array &$form_state = NULL) {
  $allowed = variable_get('quizfileupload_default_extensions', QUIZFILEUPLOAD_DEFAULT_EXTENSIONS);
  $form['filetypes'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed extension'),
    '#description' => t('Enter the allowed file extensions one per line.'),
    '#default_value' => isset($this->node->filetypes) ? $this->node->filetypes : $allowed,
    '#required' => TRUE,
  );
  $options = array(
    self::ANSWER_MATCH => t('Automatic'),
    self::ANSWER_MANUAL => t('Manual'),
  );
  $form['correct_answer_evaluation'] = array(
    '#type' => 'radios',
    '#title' => t('Pick an evaluation method'),
    '#description' => t('Choose how the answer shall be evaluated.'),
    '#options' => $options,
    '#default_value' => isset($this->node->correct_answer_evaluation) ? $this->node->correct_answer_evaluation : self::ANSWER_MATCH,
    '#required' => TRUE,
  );
  return $form;
}