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');
|
$visiblename = get_string('gradebookroles', 'admin');
|
||||||
$description = get_string('configgradebookroles', 'admin');
|
$description = get_string('configgradebookroles', 'admin');
|
||||||
$default = array(5=>'1'); // The student role in a default install
|
$default = array(5=>'1'); // The student role in a default install
|
||||||
|
|
||||||
parent::admin_setting($name, $visiblename, $description, $default);
|
parent::admin_setting($name, $visiblename, $description, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_setting() {
|
function get_setting() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
if (!empty($CFG->{$this->name})) {
|
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 {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2347,13 +2350,12 @@ class admin_setting_special_gradebookroles extends admin_setting {
|
||||||
} else {
|
} else {
|
||||||
$currentsetting = $this->get_setting();
|
$currentsetting = $this->get_setting();
|
||||||
}
|
}
|
||||||
|
|
||||||
// from to process which roles to display
|
// from to process which roles to display
|
||||||
if ($roles = get_records('role')) {
|
if ($roles = get_records('role')) {
|
||||||
$return = '<div class="form-group">';
|
$return = '<div class="form-group">';
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach ($roles as $roleid=>$role) {
|
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"';
|
$checked = 'checked="checked"';
|
||||||
} else {
|
} else {
|
||||||
$checked = '';
|
$checked = '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue