$this->pbarurl = 'index.php?id='.$this->courseid.$perpage.'&';
- // Setup groups if requested
- if ($this->get_pref('showgroups')) {
- $this->setup_groups();
- }
+ $this->setup_groups();
$this->setup_sortitemid();
}
$html .= $this->print_toggle('averages', true);
}
- 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
- $html .= $this->print_toggle('groups', true);
- }
-
$html .= $this->print_toggle('ranges', true);
if (!empty($CFG->enableoutcomes)) {
$html .= $this->print_toggle('nooutcomes', true);
// Averages heading
$straverage_group = get_string('groupavg', 'grades');
- $showaverages_group = $this->currentgroup && $this->get_pref('showgroups');
$straverage = get_string('overallaverage', 'grades');
$showaverages = $this->get_pref('showaverages');
-
+ $showaverages_group = $this->currentgroup && $showaverages;
+
if ($showaverages_group) {
$studentshtml .= '<tr class="groupavg r'.$this->rowcount++.'"><th class="header c0" '.$colspan.'scope="row">'.$straverage_group.'</th></tr>';
}
if ($grouponly) {
$straverage = get_string('groupavg', 'grades');
- $showaverages = $this->currentgroup && $this->get_pref('showgroups');
+ $showaverages = $this->currentgroup && $this->get_pref('showaverages');
$groupsql = $this->groupsql;
$groupwheresql = $this->groupwheresql;
$groupwheresql_params = $this->groupwheresql_params;
if ($canviewhidden) {
$preferences['prefshow']['showaverages'] = $checkbox_default;
}
- $preferences['prefshow']['showgroups'] = $checkbox_default;
$preferences['prefshow']['showlocks'] = $checkbox_default;
$preferences['prefrows'] = array(
$settings->add(new admin_setting_configcheckbox('grade_report_showaverages', get_string('showaverages', 'grades'),
get_string('configshowaverages', 'grades'), 1));
-$settings->add(new admin_setting_configcheckbox('grade_report_showgroups', get_string('showgroups', 'grades'),
- get_string('configshowgroups', 'grades'), 0));
-
$settings->add(new admin_setting_configcheckbox('grade_report_showlocks', get_string('showlocks', 'grades'),
get_string('configshowlocks', 'grades'), 0));
*/
public $currentgroup;
+ /**
+ * Current course group mode
+ * @var int $groupmode
+ */
+ var $groupmode;
+
/**
* A HTML select element used to select the current group.
* @var string $group_selector
*/
protected function setup_groups() {
/// find out current groups mode
- $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
- $this->currentgroup = groups_get_course_group($this->course);
-
- if ($this->currentgroup) {
- $this->groupsql = " JOIN {groups_members} gm ON gm.userid = u.id ";
- $this->groupwheresql = " AND gm.groupid = :gr_grpid ";
- $this->groupwheresql_params = array('gr_grpid'=>$this->currentgroup);
+ if ($this->groupmode = groups_get_course_groupmode($this->course)) {
+ $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
+ $this->currentgroup = groups_get_course_group($this->course);
+
+ if ($this->currentgroup) {
+ $this->groupsql = " JOIN {groups_members} gm ON gm.userid = u.id ";
+ $this->groupwheresql = " AND gm.groupid = :gr_grpid ";
+ $this->groupwheresql_params = array('gr_grpid'=>$this->currentgroup);
+ }
}
}
upgrade_main_savepoint($result, 2009042700);
}
+ if ($result && $oldversion < 2009043000) {
+ unset_config('grade_report_showgroups');
+ upgrade_main_savepoint($result, 2009043000);
+ }
+
return $result;
}
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2009042700; // YYYYMMDD = date of the last version bump
+ $version = 2009043000; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20090430)'; // Human-friendly version name