Merge branch 'MDL-79281_main' of https://github.com/cwarwicker/moodle
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
issueNumber: MDL-79281
|
||||
notes:
|
||||
core_question:
|
||||
- message: >-
|
||||
The `get_bulk_actions()` method on the base `plugin_features_base` class
|
||||
has been changed to allow a qbank view object to be passed through. This
|
||||
is nullable and therefore optional for qbank plugins which don't need
|
||||
to do so.
|
||||
type: improved
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
namespace qbank_deletequestion;
|
||||
|
||||
use core_question\local\bank\view;
|
||||
|
||||
/**
|
||||
* Class bulk_delete_action is the base class for delete bulk actions ui.
|
||||
*
|
||||
@@ -35,7 +37,11 @@ class bulk_delete_action extends \core_question\local\bank\bulk_action_base {
|
||||
}
|
||||
|
||||
public function get_bulk_action_url(): \moodle_url {
|
||||
return new \moodle_url('/question/bank/deletequestion/delete.php');
|
||||
$params = [];
|
||||
if (!$this->qbank->is_listing_specific_versions()) {
|
||||
$params['deleteall'] = 1;
|
||||
}
|
||||
return new \moodle_url('/question/bank/deletequestion/delete.php', $params);
|
||||
}
|
||||
|
||||
public function get_bulk_action_capabilities(): ?array {
|
||||
|
||||
@@ -92,7 +92,7 @@ class delete_action extends question_action_base {
|
||||
'q' . $question->id => 1,
|
||||
'sesskey' => sesskey());
|
||||
$deleteparams = array_merge($deleteparams, $this->returnparams);
|
||||
if ($this->qbank->base_url()->get_param('deleteall')) {
|
||||
if (!$this->qbank->is_listing_specific_versions()) {
|
||||
$deleteparams['deleteall'] = 1;
|
||||
}
|
||||
$url = new \moodle_url($this->deletequestionurl, $deleteparams);
|
||||
|
||||
@@ -60,7 +60,6 @@ if (plugin_supports('mod', $cm->modname, FEATURE_PUBLISHES_QUESTIONS, false)) {
|
||||
$PAGE->navbar->add($modnode->text, $modnode->action, $modnode->type, $modnode->shorttext, icon: $modnode->icon);
|
||||
}
|
||||
|
||||
$thispageurl->param('deleteall', 1);
|
||||
$questionbank = new view($contexts, $thispageurl, $COURSE, $cm, $pagevars);
|
||||
|
||||
$context = $contexts->lowest();
|
||||
|
||||
+5
-2
@@ -66,6 +66,11 @@ function core_question_output_fragment_question_data(array $args): string {
|
||||
|
||||
$viewclass = empty($args['view']) ? \core_question\local\bank\view::class : clean_param($args['view'], PARAM_NOTAGS);
|
||||
|
||||
// Make sure the class passed through is valid (exists and is view or subclass of view).
|
||||
if (!class_exists($viewclass) || !is_a($viewclass, \core_question\local\bank\view::class, true)) {
|
||||
throw new invalid_parameter_exception('view parameter must be a valid view class');
|
||||
}
|
||||
|
||||
if (!empty($args['lastchanged'])) {
|
||||
$thispageurl->param('lastchanged', clean_param($args['lastchanged'], PARAM_INT));
|
||||
}
|
||||
@@ -75,8 +80,6 @@ function core_question_output_fragment_question_data(array $args): string {
|
||||
if (!empty($args['extraparams'])) {
|
||||
$thispageurl->param('extraparams', clean_param($args['extraparams'], PARAM_RAW));
|
||||
}
|
||||
// This is highly suspicious, but it is the same approach taken in /question/edit.php. See MDL-79281.
|
||||
$thispageurl->param('deleteall', 1);
|
||||
$questionbank = new $viewclass($contexts, $thispageurl, $course, $cm, $pagevars, $extraparams);
|
||||
$questionbank->add_standard_search_conditions();
|
||||
ob_start();
|
||||
|
||||
Reference in New Issue
Block a user