MDL-61132 Quiz: "Random" question from "Top" categories

* Support for adding ranodm questions from "Top" categories
This commit is contained in:
Shamim Rezaie 2018-01-30 13:46:39 +11:00
parent 9275220de3
commit 3b8f3198de
6 changed files with 68 additions and 7 deletions

View file

@ -85,6 +85,10 @@ if ($data = $mform->get_data()) {
if (!empty($data->existingcategory)) {
list($categoryid) = explode(',', $data->category);
$includesubcategories = !empty($data->includesubcategories);
if (!$includesubcategories) {
// If the chosen category is a top category.
$includesubcategories = $DB->record_exists('question_categories', ['id' => $categoryid, 'parent' => 0]);
}
$returnurl->param('cat', $data->category);
} else if (!empty($data->newcategory)) {