]> git.mjollnir.org Git - moodle.git/commitdiff
Merged fixes for gradebookroles from stable MDL-7253
authormoodler <moodler>
Sun, 29 Oct 2006 15:02:45 +0000 (15:02 +0000)
committermoodler <moodler>
Sun, 29 Oct 2006 15:02:45 +0000 (15:02 +0000)
admin/settings/appearance.php
grade/lib.php
lang/en_utf8/admin.php
lib/adminlib.php

index f00c04b35cd933c71ef9bfcc9a6020c36b3f3591..789241c9361dfa25d3bc82ee407958c545a1a8a6 100644 (file)
@@ -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);
 
 
index e457291ae6d3535a3ef9db954e242fe2dfa1a5af..56662634f3ff7759ac4a82451cfa70aeec2ad4f0 100644 (file)
@@ -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;  
index 043f16436b354867a670dcaf5750481d33ddfa1e..e2691203fe6ab61feb6b4defd54da1d5451ad762 100644 (file)
@@ -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';
index f87546f0db3f28a5bdadcd1d156995037b918122..2ba357303367069e0c5882a8a7e5c0a5eef2cf7c 100644 (file)
@@ -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.',';
                 }