MDL-37257 improve enrol overview page and enrol plugin info
This commit is contained in:
+16
-9
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user