MDL-74054 qbank: Miscellaneous coding style fixes
[moodle.git] / question / bank / columnsortorder / classes / plugin_feature.php
blob11a23a442bb232d0380ec6bf45ebf9f33edc743b
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 namespace qbank_columnsortorder;
19 use core\context;
20 use core_question\local\bank\column_manager_base;
21 use core_question\local\bank\plugin_features_base;
22 use core_question\local\bank\view;
23 use qbank_columnsortorder\output\add_column;
24 use qbank_columnsortorder\output\reset_columns;
26 /**
27 * Plugin features for qbank_columnsortorder
29 * @package qbank_columnsortorder
30 * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
31 * @author Mark Johnson <mark.johnson@catalyst-eu.net>
32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34 class plugin_feature extends plugin_features_base {
35 /**
36 * Override the default column manager.
38 * This will set the column order, size and visibility based on the global settings defined on the admin screen, or on the
39 * current user's preference if they have set one.
41 * @return ?column_manager_base
43 public function get_column_manager(): ?column_manager_base {
44 return new column_manager();
47 /**
48 * Return add and reset column controls.
50 * @param view $qbank The question bank view.
51 * @param context $context The current context, for permission checks.
52 * @param int $categoryid The current question category ID.
53 * @return \renderable[]
55 public function get_question_bank_controls(view $qbank, context $context, int $categoryid): array {
56 global $PAGE;
57 $PAGE->requires->js_call_amd('qbank_columnsortorder/user_actions', 'init');
58 $returnurl = new \moodle_url($qbank->returnurl);
59 return [
60 200 => new add_column(new column_manager(), $returnurl),
61 300 => new reset_columns($returnurl),