public function QuizfileuploadQuestion::getCreationForm in Quiz File Upload 7.5
Same name and namespace in other branches
- 6 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()
- 7 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()
- 7.4 quizfileupload.classes.inc \QuizfileuploadQuestion::getCreationForm()
Implements getCreationForm().
See also
QuizQuestion#getCreationForm()
File
- ./
quizfileupload.classes.inc, line 172 - File upload question class.
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 file extensions'),
'#description' => t('Separate extensions with a space or comma and do not include the leading dot.'),
'#default_value' => str_replace(' ', ', ', isset($this->node->filetypes) ? $this->node->filetypes : $allowed),
'#element_validate' => array(
'_file_generic_settings_extensions',
),
'#required' => TRUE,
);
$form['filesize'] = array(
'#type' => 'textfield',
'#title' => t('Maximum upload size'),
'#default_value' => isset($this->node->filesize) ? $this->node->filesize : variable_get('quizfileupload_default_filesize', NULL),
'#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).', array(
'%limit' => format_size(file_upload_max_size()),
)),
'#maxlength' => 18,
'#element_validate' => array(
'_file_generic_settings_max_filesize',
),
);
$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;
}