Differences Between: [Versions 311 and 400] [Versions 311 and 401] [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 * Subplugin info class. 19 * 20 * @package tool_log 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 tool_log\plugininfo; 25 26 use core\plugininfo\base, moodle_url, part_of_admin_tree, admin_settingpage; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Plugin info class for logging store plugins. 32 */ 33 class logstore extends base { 34 35 public function is_enabled() { 36 $enabled = get_config('tool_log', 'enabled_stores'); 37 if (!$enabled) { 38 return false; 39 } 40 41 $enabled = array_flip(explode(',', $enabled)); 42 return isset($enabled['logstore_' . $this->name]); 43 } 44 45 public function get_settings_section_name() { 46 return 'logsetting' . $this->name; 47 } 48 49 public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) { 50 global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them. 51 $ADMIN = $adminroot; // May be used in settings.php. 52 $section = $this->get_settings_section_name(); 53 54 if (!$this->is_installed_and_upgraded()) { 55 return; 56 } 57 58 if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) { 59 return; 60 } 61 62 $settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false); 63 include($this->full_path('settings.php')); 64 65 if ($settings) { 66 $ADMIN->add($parentnodename, $settings); 67 } 68 } 69 70 public static function get_manage_url() { 71 return new moodle_url('/admin/settings.php', array('section' => 'managelogging')); 72 } 73 74 public function is_uninstall_allowed() { 75 return true; 76 } 77 78 public function uninstall_cleanup() { 79 $enabled = get_config('tool_log', 'enabled_stores'); 80 if ($enabled) { 81 $enabled = array_flip(explode(',', $enabled)); 82 unset($enabled['logstore_' . $this->name]); 83 $enabled = array_flip($enabled); 84 set_config('enabled_stores', implode(',', $enabled), 'tool_log'); 85 } 86 87 parent::uninstall_cleanup(); 88 } 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body