1 |
efrain |
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.
|
|
|
13 |
//
|
|
|
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/>.
|
|
|
16 |
|
|
|
17 |
namespace qbank_columnsortorder;
|
|
|
18 |
|
|
|
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;
|
|
|
25 |
|
|
|
26 |
/**
|
|
|
27 |
* Plugin features for qbank_columnsortorder
|
|
|
28 |
*
|
|
|
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
|
|
|
33 |
*/
|
|
|
34 |
class plugin_feature extends plugin_features_base {
|
|
|
35 |
/**
|
|
|
36 |
* Override the default column manager.
|
|
|
37 |
*
|
|
|
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.
|
|
|
40 |
*
|
|
|
41 |
* @return ?column_manager_base
|
|
|
42 |
*/
|
|
|
43 |
public function get_column_manager(): ?column_manager_base {
|
|
|
44 |
return new column_manager();
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* Return add and reset column controls.
|
|
|
49 |
*
|
|
|
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[]
|
|
|
54 |
*/
|
|
|
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),
|
|
|
62 |
];
|
|
|
63 |
}
|
|
|
64 |
}
|