// 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);
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;
// 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';
/*
* 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() {
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.',';
}