mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-61132 Quiz: "Random" question from "Top" categories
* Support for adding ranodm questions from "Top" categories
This commit is contained in:
parent
9275220de3
commit
3b8f3198de
6 changed files with 68 additions and 7 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue