Differences Between: [Versions 311 and 402] [Versions 311 and 403]
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 * Defines classes used for plugin info. 19 * 20 * @package core 21 * @copyright 2011 David Mudrak <david@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace core\plugininfo; 25 26 use moodle_url; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Class for admin tool plugins 32 */ 33 class tool extends base { 34 35 public function is_uninstall_allowed() { 36 // Some mobile settings are used by the core. 37 if ($this->name === 'mobile') { 38 return false; 39 } else { 40 return true; 41 } 42 } 43 44 /** 45 * Tools cannot be disabled. 46 * 47 * @return boolean 48 */ 49 public function is_enabled() { 50 return true; 51 } 52 53 /** 54 * Return URL used for management of plugins of this type. 55 * @return moodle_url 56 */ 57 public static function get_manage_url() { 58 return new moodle_url('/admin/tools.php'); 59 } 60 61 /** 62 * Loads plugin settings to the settings tree 63 * 64 * This function usually includes settings.php file in plugins folder. 65 * Alternatively it can create a link to some settings page (instance of admin_externalpage) 66 * 67 * @param \part_of_admin_tree $adminroot 68 * @param string $parentnodename 69 * @param bool $hassiteconfig whether the current user has moodle/site:config capability 70 */ 71 public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) { 72 global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them. 73 $ADMIN = $adminroot; // May be used in settings.php. 74 $plugininfo = $this; // Also can be used inside settings.php. 75 76 if (!$this->is_installed_and_upgraded()) { 77 return; 78 } 79 80 if (file_exists($this->full_path('settings.php'))) { 81 include($this->full_path('settings.php')); 82 } 83 } 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body