* @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]) {
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);
}
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(
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];