diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php index a4913e0..d82fa06 100755 --- a/classes/bank/jazzquiz_question_bank_view.php +++ b/classes/bank/jazzquiz_question_bank_view.php @@ -28,6 +28,7 @@ defined('MOODLE_INTERNAL') || die(); +use \core_question\bank\search\tag_condition as tag_condition; use \core_question\bank\search\hidden_condition as hidden_condition; use \core_question\bank\search\category_condition as category_condition; @@ -73,15 +74,19 @@ protected function wanted_columns() { * @param array $tagids */ public function display($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $tagids = []) { - global $OUTPUT; + global $PAGE; if ($this->process_actions_needing_ui()) { return; } $contexts = $this->contexts->having_one_edit_tab_cap($tabname); + list($categoryid, $contextid) = explode(',', $cat); + $catcontext = \context::instance_by_id($contextid); + $thiscontext = $this->get_most_specific_context(); // Category selection form. - echo $OUTPUT->heading(get_string('questionbank', 'question'), 2); + $this->display_question_bank_header(); + array_unshift($this->searchconditions, new tag_condition([$catcontext, $thiscontext], $tagids)); array_unshift($this->searchconditions, new hidden_condition(!$showhidden)); array_unshift($this->searchconditions, new category_condition($cat, $recurse, $contexts, $this->baseurl, $this->course)); $this->display_options_form($showquestiontext, '/mod/jazzquiz/edit.php'); @@ -99,6 +104,8 @@ public function display($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $this->contexts->having_cap('moodle/question:add') ); + + $PAGE->requires->js_call_amd('core_question/edit_tags', 'init', ['#questionscontainer']); } /** diff --git a/edit.php b/edit.php index dab5a45..a8adb01 100755 --- a/edit.php +++ b/edit.php @@ -123,7 +123,7 @@ function jazzquiz_edit_list_questions($jazzquiz, $contexts, $url, $pagevars) { * View edit page. */ function jazzquiz_edit() { - global $PAGE; + global $PAGE, $COURSE; $action = optional_param('action', 'listquestions', PARAM_ALPHA); @@ -161,6 +161,10 @@ function jazzquiz_edit() { return; } + // Process moving, deleting and unhiding questions... + $questionbank = new \core_question\bank\view($contexts, $url, $COURSE, $cm); + $questionbank->process_actions(); + switch ($action) { case 'order': jazzquiz_edit_order($jazzquiz); diff --git a/version.php b/version.php index ecbddcd..2fe47c6 100755 --- a/version.php +++ b/version.php @@ -24,9 +24,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2018091206; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2018091207; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2016052304; // Moodle 3.1 (or above) $plugin->cron = 0; // Period in seconds for cron to run. $plugin->component = 'mod_jazzquiz'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '0.8.2 (Build: 2018091206)'; +$plugin->release = '0.8.2 (Build: 2018091207)';