MDL-81115 question: Question bank tag filter to use all available tags.

This makes the tags which are available to the user on the question
bank tag filter, use tags from all available contexts, not just
that course. This means they can filter by tags assigned to system
questions as well, for example.
This commit is contained in:
Conn Warwicker 2024-12-06 14:05:52 +00:00
parent 0888a6d324
commit c5633888e2
No known key found for this signature in database
GPG Key ID: DA5D0AD62F47BE87

View File

@ -49,20 +49,7 @@ class tag_condition extends condition {
return;
}
parent::__construct($qbank);
$cat = $qbank->get_pagevars('cat');
if (is_array($cat)) {
foreach ($cat as $value) {
[, $contextid] = explode(',', $value);
$catcontext = \context::instance_by_id($contextid);
$this->contexts[] = $catcontext;
}
} else {
[, $contextid] = explode(',', $qbank->get_pagevars('cat'));
$catcontext = \context::instance_by_id($contextid);
$this->contexts[] = $catcontext;
}
$thiscontext = $qbank->get_most_specific_context();
$this->contexts[] = $thiscontext;
$this->contexts = $qbank->contexts->all();
$this->selectedtagids = $this->filter->values ?? [];
}