]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17226 Hiding the group show/hide settings and toggle for grader report. Merging...
authornicolasconnault <nicolasconnault>
Thu, 13 Nov 2008 15:44:01 +0000 (15:44 +0000)
committernicolasconnault <nicolasconnault>
Thu, 13 Nov 2008 15:44:01 +0000 (15:44 +0000)
grade/report/grader/lib.php
grade/report/grader/preferences_form.php

index 1cbcdeb0c29380299d076d6cbb1cd0ba2609ee83..bcc868305dbd655614c90d263e4575e0d43781a5 100644 (file)
@@ -400,7 +400,7 @@ class grade_report_grader extends grade_report {
      * @return string HTML code
      */
     public function get_toggles_html() {
-        global $CFG, $USER;
+        global $CFG, $USER, $COURSE;
 
         $html = '<div id="grade-report-toggles">';
         if ($USER->gradeediting[$this->courseid]) {
@@ -427,7 +427,7 @@ class grade_report_grader extends grade_report {
 
         if (has_capability('moodle/grade:viewall', $this->context)
          and has_capability('moodle/site:accessallgroups', $this->context)
-         and $course_has_groups = true) { // TODO replace that last condition with proper check
+         and $COURSE->groupmode != NOGROUPS) { // TODO replace that last condition with proper check
             $html .= $this->print_toggle('groups', true);
         }
 
index a32a63f828f5d2dd52f08c4a0503ea76178ba754..60c229e7a4c220c6da1a0564128e36dc35344ea6 100644 (file)
@@ -72,7 +72,10 @@ class grader_report_preferences_form extends moodleform {
             if ($canviewhidden) {
                 $preferences['prefshow']['showaverages']  = $checkbox_default;
             }
-            $preferences['prefshow']['showgroups']        = $checkbox_default;
+            if ($course->groupmode != NOGROUPS) {
+                $preferences['prefshow']['showgroups']        = $checkbox_default;
+            }
+
             $preferences['prefshow']['showlocks']         = $checkbox_default;
 
             $preferences['prefrows'] = array(
@@ -156,7 +159,7 @@ class grader_report_preferences_form extends moodleform {
                     if (!empty($CFG->{$full_pref})) {
                         $course_value = grade_get_setting($course->id, $pref, $CFG->{$full_pref});
                     }
-                    
+
                     if ($pref == 'aggregationposition') {
                         if (!empty($options[$course_value])) {
                             $default = $options[$course_value];