MDL-74054 qbank: Miscellaneous coding style fixes
[moodle.git] / question / bank / columnsortorder / classes / output / reset_columns.php
blob1cecdf5f8d0f609298eb49913532ef0bed4d0424
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\output;
19 use renderer_base;
21 /**
22 * Renderable for resetting customised column settings.
24 * This will display a link that resets all customised column settings and redirects back to the current page.
26 * @package qbank_columnsortorder
27 * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
28 * @author Mark Johnson <mark.johnson@catalyst-eu.net>
29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 class reset_columns implements \renderable, \templatable {
32 /** @var \moodle_url The current page URL to redirect back to. */
33 protected \moodle_url $returnurl;
35 /** @var bool True if we are changing global config, false for user preferences. */
36 protected bool $global;
38 /**
39 * Store data for generating the template context.
41 * @param \moodle_url $returnurl
42 * @param bool $global
44 public function __construct(\moodle_url $returnurl, bool $global = false) {
45 $this->returnurl = $returnurl;
46 $this->global = $global;
49 public function export_for_template(renderer_base $output): array {
50 $reseturl = new \moodle_url('/question/bank/columnsortorder/actions.php', [
51 'action' => 'reset',
52 'global' => $this->global,
53 'sesskey' => sesskey(),
54 'returnurl' => $this->returnurl->out(),
55 ]);
56 return [
57 'reseturl' => $reseturl->out(false),