mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
Merged fixes for gradebookroles from stable MDL-7253
This commit is contained in:
parent
33951ee4f6
commit
0909d44eac
@ -120,7 +120,7 @@ $ADMIN->add('appearance', $temp);
|
||||
|
||||
// new CFG variable for gradebook (what roles to display)
|
||||
$temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
|
||||
$temp->add(new admin_setting_special_gradebook_roles());
|
||||
$temp->add(new admin_setting_special_gradebookroles());
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
|
||||
|
@ -2996,12 +2996,12 @@ function print_student_grade($user, $course) {
|
||||
|
||||
function grade_get_course_students($courseid) {
|
||||
global $CFG;
|
||||
// The list of roles to display is stored in CFG->gradebook_roles
|
||||
// The list of roles to display is stored in CFG->gradebookroles
|
||||
if (!$context = get_context_instance(CONTEXT_COURSE, $courseid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$configvar = get_config('', 'gradebook_roles');
|
||||
$configvar = get_config('', 'gradebookroles');
|
||||
if (empty($configvar->value)) {
|
||||
notify ('no roles defined in admin->appearance->graderoles');
|
||||
return false; // no roles to displayreturn false;
|
||||
|
@ -5,9 +5,9 @@
|
||||
// begin {added with admin cleanup}
|
||||
$string['gradebook'] = 'Gradebook';
|
||||
$string['gradebookroles'] = 'Graded roles';
|
||||
$string['configgradebookroles'] = 'Which roles are gradable?';
|
||||
$string['configgradebookroles'] = 'This setting allows you to control who appears on the gradebook. Users need to have at least one of these roles in a course to be shown in the gradebook for that course.';
|
||||
$string['enableajax'] = 'Enable AJAX';
|
||||
$string['configenableajax'] = 'If you enable AJAX features users can disable them in their profile, otherwise AJAX is disabled for everybody.';
|
||||
$string['configenableajax'] = 'This setting allows you to control the use of AJAX (advanced client/server interfaces using Javascript) across the whole site. With this setting enabled users can sill make a choice in their profile, otherwise AJAX is disabled for everybody.';
|
||||
$string['autologinguests'] = 'Auto-login guests';
|
||||
$string['search'] = 'Search';
|
||||
$string['searchresults'] = 'Search Results';
|
||||
|
@ -2306,22 +2306,14 @@ class admin_setting_special_calendar_weekend extends admin_setting {
|
||||
/*
|
||||
* this is used in config->appearance->gradeconfig
|
||||
*/
|
||||
class admin_setting_special_gradebook_roles extends admin_setting {
|
||||
class admin_setting_special_gradebookroles extends admin_setting {
|
||||
|
||||
function admin_setting_special_gradebook_roles() {
|
||||
$name = 'gradebook_roles';
|
||||
function admin_setting_special_gradebookroles() {
|
||||
$name = 'gradebookroles';
|
||||
$visiblename = get_string('gradebookroles', 'admin');
|
||||
$description = get_string('configgradebookroles', 'admin');
|
||||
|
||||
$value = array();
|
||||
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
foreach ($studentroles as $roleid=>$studentrole) {
|
||||
$value[$roleid] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
parent::admin_setting($name, $visiblename, $description, $value);
|
||||
parent::admin_setting($name, $visiblename, $description, '');
|
||||
}
|
||||
|
||||
function get_setting() {
|
||||
@ -2329,14 +2321,20 @@ class admin_setting_special_gradebook_roles extends admin_setting {
|
||||
if (isset($CFG->{$this->name})) {
|
||||
return explode(',', $CFG->{$this->name});
|
||||
} else {
|
||||
return NULL;
|
||||
$value = array();
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
foreach ($studentroles as $roleid=>$studentrole) {
|
||||
$value[] = $roleid;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
function write_setting($data) {
|
||||
if (!empty($data)) {
|
||||
$str = '';
|
||||
foreach($data as $key => $value) {
|
||||
foreach ($data as $key => $value) {
|
||||
if ($value) {
|
||||
$str .= $key.',';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user