MDL-37257 improve enrol overview page and enrol plugin info

This commit is contained in:
Petr Škoda
2012-12-21 14:28:05 +01:00
parent a5ec499521
commit c7a3399041
2 changed files with 53 additions and 28 deletions
+16 -9
View File
@@ -3063,21 +3063,28 @@ class plugininfo_enrol extends plugininfo_base {
}
public function get_settings_section_name() {
return 'enrolsettings' . $this->name;
if (file_exists($this->full_path('settings.php'))) {
return 'enrolsettings' . $this->name;
} else {
return null;
}
}
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
$ADMIN = $adminroot; // may be used in settings.php
$enrol = $this; // also can be used inside settings.php
if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) {
return;
}
$section = $this->get_settings_section_name();
$settings = null;
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
}
$ADMIN = $adminroot; // may be used in settings.php
$enrol = $this; // also can be used inside 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);
}