mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-62992 question: conditionaly enable question tags feature
This commit is contained in:
parent
3271c39c74
commit
2cfd8d1678
1 changed files with 9 additions and 3 deletions
|
@ -462,7 +462,7 @@ class view {
|
||||||
*/
|
*/
|
||||||
public function display($tabname, $page, $perpage, $cat,
|
public function display($tabname, $page, $perpage, $cat,
|
||||||
$recurse, $showhidden, $showquestiontext, $tagids = []) {
|
$recurse, $showhidden, $showquestiontext, $tagids = []) {
|
||||||
global $PAGE;
|
global $PAGE, $CFG;
|
||||||
|
|
||||||
if ($this->process_actions_needing_ui()) {
|
if ($this->process_actions_needing_ui()) {
|
||||||
return;
|
return;
|
||||||
|
@ -473,7 +473,14 @@ class view {
|
||||||
$thiscontext = $this->get_most_specific_context();
|
$thiscontext = $this->get_most_specific_context();
|
||||||
// Category selection form.
|
// Category selection form.
|
||||||
$this->display_question_bank_header();
|
$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\hidden_condition(!$showhidden));
|
||||||
array_unshift($this->searchconditions, new \core_question\bank\search\category_condition(
|
array_unshift($this->searchconditions, new \core_question\bank\search\category_condition(
|
||||||
$cat, $recurse, $editcontexts, $this->baseurl, $this->course));
|
$cat, $recurse, $editcontexts, $this->baseurl, $this->course));
|
||||||
|
@ -485,7 +492,6 @@ class view {
|
||||||
null, $page, $perpage, $showhidden, $showquestiontext,
|
null, $page, $perpage, $showhidden, $showquestiontext,
|
||||||
$this->contexts->having_cap('moodle/question:add'));
|
$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) {
|
protected function print_choose_category_message($categoryandcontext) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue