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 /** 18 * Admin tool presets plugin to load some settings. 19 * 20 * @package tool_admin_presets 21 * @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> 22 * @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David MonllaĆ³ <david.monllao@urv.cat> code 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 require_once(__DIR__ . '/../../../config.php'); 27 28 global $CFG, $PAGE; 29 30 $action = optional_param('action', 'base', PARAM_ALPHA); 31 $mode = optional_param('mode', 'show', PARAM_ALPHAEXT); 32 33 require_login(); 34 35 if (!$context = context_system::instance()) { 36 throw new moodle_exception('wrongcontext', 'error'); 37 } 38 39 require_capability('moodle/site:config', $context); 40 41 // Loads the required action class and form. 42 $fileclassname = $action; 43 $classname = 'tool_admin_presets\\local\\action\\'.$action; 44 45 if (!class_exists($classname)) { 46 throw new moodle_exception('falseaction', 'tool_admin_presets', $action); 47 } 48 49 $url = new moodle_url('/admin/tool/admin_presets/index.php'); 50 $url->param('action', $action); 51 $url->param('mode', $mode); 52 $PAGE->set_url($url); 53 $PAGE->set_pagelayout('admin'); 54 $PAGE->set_context($context); 55 $PAGE->set_primary_active_tab('siteadminnode'); 56 57 // Executes the required action. 58 $instance = new $classname(); 59 if (!method_exists($instance, $mode)) { 60 throw new moodle_exception('falsemode', 'tool_admin_presets', $mode); 61 } 62 63 // Executes the required method and displays output. 64 $instance->$mode(); 65 $instance->log(); 66 $instance->display();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body