qtype admin: MDL-16412 Enforce the allowed question types when a user tries to create a question.

This commit is contained in:
tjhunt
2009-02-26 06:06:18 +00:00
parent 7cf3af550c
commit 8ed358dbca
+6
View File
@@ -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);
}