mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
merged fixing wrong default for gradebook roles when upgrading from < 1.7
This commit is contained in:
parent
89c5cbc525
commit
60f7d402ef
1 changed files with 6 additions and 4 deletions
|
@ -2313,14 +2313,17 @@ class admin_setting_special_gradebookroles extends admin_setting {
|
|||
$visiblename = get_string('gradebookroles', 'admin');
|
||||
$description = get_string('configgradebookroles', 'admin');
|
||||
$default = array(5=>'1'); // The student role in a default install
|
||||
|
||||
parent::admin_setting($name, $visiblename, $description, $default);
|
||||
}
|
||||
|
||||
function get_setting() {
|
||||
global $CFG;
|
||||
if (!empty($CFG->{$this->name})) {
|
||||
return explode(',', $CFG->{$this->name});
|
||||
$result = explode(',', $CFG->{$this->name});
|
||||
foreach ($result as $roleid) {
|
||||
$array[$roleid] = 1;
|
||||
}
|
||||
return $array;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -2347,13 +2350,12 @@ class admin_setting_special_gradebookroles extends admin_setting {
|
|||
} else {
|
||||
$currentsetting = $this->get_setting();
|
||||
}
|
||||
|
||||
// from to process which roles to display
|
||||
if ($roles = get_records('role')) {
|
||||
$return = '<div class="form-group">';
|
||||
$first = true;
|
||||
foreach ($roles as $roleid=>$role) {
|
||||
if (is_array($currentsetting) && in_array($roleid, $currentsetting)) {
|
||||
if (is_array($currentsetting) && in_array($roleid, array_keys($currentsetting))) {
|
||||
$checked = 'checked="checked"';
|
||||
} else {
|
||||
$checked = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue