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 2013 Petr Skoda {@link http://skodak.org} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace core\plugininfo; 25 26 use part_of_admin_tree, admin_settingpage; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Class for calendar type plugins. 32 */ 33 class calendartype extends base { 34 35 public function is_uninstall_allowed() { 36 // We can delete all calendar types, except Gregorian. Gregorian comes with core and was the calendar 37 // type used before the calendar types were introduced as plugins in Moodle. If all calendar types were 38 // deleted then Moodle would break completely wherever any dates are displayed. 39 if ($this->name !== 'gregorian') { 40 return true; 41 } 42 43 return false; 44 } 45 46 public function get_settings_section_name() { 47 return 'calendartype_' . $this->name . '_settings'; 48 } 49 50 public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) { 51 global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them. 52 $ADMIN = $adminroot; // May be used in settings.php. 53 $plugininfo = $this; // Also can be used inside settings.php. 54 $qtype = $this; // Also can be used inside settings.php. 55 56 if (!$this->is_installed_and_upgraded()) { 57 return; 58 } 59 60 $section = $this->get_settings_section_name(); 61 62 $settings = null; 63 $systemcontext = \context_system::instance(); 64 if (($hassiteconfig) && 65 file_exists($this->full_path('settings.php'))) { 66 $settings = new admin_settingpage($section, $this->displayname, 67 'moodle/site:config', $this->is_enabled() === false); 68 include($this->full_path('settings.php')); // This may also set $settings to null. 69 } 70 if ($settings) { 71 $ADMIN->add($parentnodename, $settings); 72 } 73 } 74 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body