MDL-62992 question: conditionaly enable question tags feature

This commit is contained in:
Simey Lameze
2019-03-27 10:26:33 +08:00
parent d70651f787
commit 89b9e4f805
+9 -3
View File
@@ -462,7 +462,7 @@ class view {
*/
public function display($tabname, $page, $perpage, $cat,
$recurse, $showhidden, $showquestiontext, $tagids = []) {
global $PAGE;
global $PAGE, $CFG;
if ($this->process_actions_needing_ui()) {
return;
@@ -473,7 +473,14 @@ class view {
$thiscontext = $this->get_most_specific_context();
// Category selection form.
$this->display_question_bank_header();
array_unshift($this->searchconditions, new \core_question\bank\search\tag_condition([$catcontext, $thiscontext], $tagids));
// Display tag filter if usetags setting is enabled.
if ($CFG->usetags) {
array_unshift($this->searchconditions,
new \core_question\bank\search\tag_condition([$catcontext, $thiscontext], $tagids));
$PAGE->requires->js_call_amd('core_question/edit_tags', 'init', ['#questionscontainer']);
}
array_unshift($this->searchconditions, new \core_question\bank\search\hidden_condition(!$showhidden));
array_unshift($this->searchconditions, new \core_question\bank\search\category_condition(
$cat, $recurse, $editcontexts, $this->baseurl, $this->course));
@@ -485,7 +492,6 @@ class view {
null, $page, $perpage, $showhidden, $showquestiontext,
$this->contexts->having_cap('moodle/question:add'));
$PAGE->requires->js_call_amd('core_question/edit_tags', 'init', ['#questionscontainer']);
}
protected function print_choose_category_message($categoryandcontext) {