qtype admin: MDL-16412 Enforce the allowed question types when a user tries to create a question.
This commit is contained in:
@@ -61,6 +61,12 @@ if ($id) {
|
||||
$question = new stdClass;
|
||||
$question->category = $categoryid;
|
||||
$question->qtype = $qtype;
|
||||
|
||||
// Check that users are allowed to create this question type at the moment.
|
||||
$allowedtypes = question_type_menu();
|
||||
if (!isset($allowedtypes[$qtype])) {
|
||||
print_error('cannotenable', 'question', $returnurl, $qtype);
|
||||
}
|
||||
} else {
|
||||
print_error('notenoughdatatoeditaquestion', 'question', $returnurl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user