// if user report preference set or site report setting set use it, otherwise use course or site setting
$switch = $this->get_pref('aggregationposition');
- if ($switch == GRADE_REPORT_PREFERENCE_INHERIT) {
+ if (empty($switch)) {
$switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition);
}
if (has_capability('gradereport/grader:view', $context)) {
$preferences['prefgeneral']['studentsperpage'] = 'text';
$preferences['prefgeneral']['aggregationposition'] = array(GRADE_REPORT_PREFERENCE_DEFAULT => '*default*',
- GRADE_REPORT_PREFERENCE_INHERIT => get_string('inherit', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'));
// $preferences['prefgeneral']['enableajax'] = $checkbox_default;
$options = $type;
$type = 'select';
// MDL-11478
- if (isset($options[$CFG->{$full_pref}])) {
+ // get default aggregationposition from grade_settings
+ if ($pref == 'aggregationposition') {
+ $default = $options[grade_get_setting($course->id, $pref, $CFG->{$full_pref})];
+ } elseif (isset($options[$CFG->{$full_pref}])) {
$default = $options[$CFG->{$full_pref}];
} else {
$default = '';
$settings->add(new admin_setting_configcheckbox('grade_report_quickfeedback', get_string('quickfeedback', 'grades'),
get_string('configquickfeedback', 'grades'), 1));
-$settings->add(new admin_setting_configselect('grade_report_aggregationposition', get_string('aggregationposition', 'grades'),
- get_string('configaggregationposition', 'grades'), GRADE_REPORT_PREFERENCE_INHERIT,
- array(GRADE_REPORT_PREFERENCE_INHERIT => $strinherit,
- GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
- GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
-
$settings->add(new admin_setting_configselect('grade_report_aggregationview', get_string('aggregationview', 'grades'),
get_string('configaggregationview', 'grades'), GRADE_REPORT_AGGREGATION_VIEW_FULL,
array(GRADE_REPORT_AGGREGATION_VIEW_FULL => get_string('full', 'grades'),