MDL-18951 standardised group support in grader report (not complete yet); backported from HEAD
This commit is contained in:
@@ -138,10 +138,7 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
$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();
|
||||
}
|
||||
@@ -417,12 +414,6 @@ class grade_report_grader extends grade_report {
|
||||
$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);
|
||||
@@ -1013,10 +1004,10 @@ class grade_report_grader extends grade_report {
|
||||
// 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>';
|
||||
}
|
||||
@@ -1064,7 +1055,7 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
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;
|
||||
$avgcssclass = 'groupavg';
|
||||
|
||||
@@ -72,7 +72,6 @@ class grader_report_preferences_form extends moodleform {
|
||||
if ($canviewhidden) {
|
||||
$preferences['prefshow']['showaverages'] = $checkbox_default;
|
||||
}
|
||||
$preferences['prefshow']['showgroups'] = $checkbox_default;
|
||||
$preferences['prefshow']['showlocks'] = $checkbox_default;
|
||||
|
||||
$preferences['prefrows'] = array(
|
||||
|
||||
@@ -65,9 +65,6 @@ $settings->add(new admin_setting_configcheckbox('grade_report_showeyecons', get_
|
||||
$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));
|
||||
|
||||
|
||||
+13
-5
@@ -108,6 +108,12 @@ class grade_report {
|
||||
*/
|
||||
var $currentgroup;
|
||||
|
||||
/**
|
||||
* Current course group mode
|
||||
* @var int $groupmode
|
||||
*/
|
||||
var $groupmode;
|
||||
|
||||
/**
|
||||
* A HTML select element used to select the current group.
|
||||
* @var string $group_selector
|
||||
@@ -294,12 +300,14 @@ class grade_report {
|
||||
global $CFG;
|
||||
|
||||
/// 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->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, true);
|
||||
|
||||
if ($this->currentgroup) {
|
||||
$this->groupsql = " JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";
|
||||
$this->groupwheresql = " AND gm.groupid = $this->currentgroup ";
|
||||
if ($this->currentgroup) {
|
||||
$this->groupsql = " JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";
|
||||
$this->groupwheresql = " AND gm.groupid = $this->currentgroup ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3154,6 +3154,11 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
set_field('grade_items', 'needsupdate', 1, 'needsupdate', 0);
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2007101546.06) {
|
||||
unset_config('grade_report_showgroups');
|
||||
upgrade_main_savepoint($result, 2007101546.06);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2007101546.05; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
$version = 2007101546.06; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
// X = release number 1.9.[0,1,2,3,4,5...]
|
||||
// Y.YY = micro-increments between releases
|
||||
|
||||
|
||||
Reference in New Issue
Block a user