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\output; 18 19 use renderer_base; 20 21 /** 22 * Renderable for resetting customised column settings. 23 * 24 * This will display a link that resets all customised column settings and redirects back to the current page. 25 * 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 30 */ 31 class reset_columns implements \renderable, \templatable { 32 /** @var \moodle_url The current page URL to redirect back to. */ 33 protected \moodle_url $returnurl; 34 35 /** @var bool True if we are changing global config, false for user preferences. */ 36 protected bool $global; 37 38 /** 39 * Store data for generating the template context. 40 * 41 * @param \moodle_url $returnurl 42 * @param bool $global 43 */ 44 public function __construct(\moodle_url $returnurl, bool $global = false) { 45 $this->returnurl = $returnurl; 46 $this->global = $global; 47 } 48 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), 58 ]; 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body