[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/classes/plugininfo/ -> tool.php (source)

   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          return true;
  37      }
  38  
  39      /**
  40       * Tools cannot be disabled.
  41       *
  42       * @return boolean
  43       */
  44      public function is_enabled() {
  45          return true;
  46      }
  47  
  48      /**
  49       * Return URL used for management of plugins of this type.
  50       * @return moodle_url
  51       */
  52      public static function get_manage_url() {
  53          return new moodle_url('/admin/tools.php');
  54      }
  55  
  56      /**
  57       * Loads plugin settings to the settings tree
  58       *
  59       * This function usually includes settings.php file in plugins folder.
  60       * Alternatively it can create a link to some settings page (instance of admin_externalpage)
  61       *
  62       * @param \part_of_admin_tree $adminroot
  63       * @param string $parentnodename
  64       * @param bool $hassiteconfig whether the current user has moodle/site:config capability
  65       */
  66      public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
  67          global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
  68          $ADMIN = $adminroot; // May be used in settings.php.
  69          $plugininfo = $this; // Also can be used inside settings.php.
  70  
  71          if (!$this->is_installed_and_upgraded()) {
  72              return;
  73          }
  74  
  75          if (file_exists($this->full_path('settings.php'))) {
  76              include($this->full_path('settings.php'));
  77          }
  78      }
  79  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1