<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Defines classes used for plugin info. * * @package core * @copyright 2013 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core\plugininfo; use part_of_admin_tree, admin_settingpage; defined('MOODLE_INTERNAL') || die(); /** * Class for calendar type plugins. */ class calendartype extends base { public function is_uninstall_allowed() { // We can delete all calendar types, except Gregorian. Gregorian comes with core and was the calendar // type used before the calendar types were introduced as plugins in Moodle. If all calendar types were // deleted then Moodle would break completely wherever any dates are displayed. if ($this->name !== 'gregorian') { return true; } return false; } public function get_settings_section_name() { return 'calendartype_' . $this->name . '_settings'; } public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) { global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.> /** @var \admin_root $ADMIN */$ADMIN = $adminroot; // May be used in settings.php. $plugininfo = $this; // Also can be used inside settings.php. $qtype = $this; // Also can be used inside settings.php. if (!$this->is_installed_and_upgraded()) { return; } $section = $this->get_settings_section_name(); $settings = null; $systemcontext = \context_system::instance(); if (($hassiteconfig) && file_exists($this->full_path('settings.php'))) { $settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false); include($this->full_path('settings.php')); // This may also set $settings to null. } if ($settings) { $ADMIN->add($parentnodename, $settings); } } }