Skip to content

Commit

Permalink
Merge branch 'MDL-48572' of git://github.com/rlorenzo/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Mar 10, 2015
2 parents 5091a63 + c288300 commit 11db2e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions grade/report/grader/lib.php
Expand Up @@ -1345,7 +1345,7 @@ public function get_right_range_row($rows=array()) {
* @return array Array of rows for the right part of the report
*/
public function get_right_avg_row($rows=array(), $grouponly=false) {
global $USER, $DB, $OUTPUT;
global $USER, $DB, $OUTPUT, $CFG;

if (!$this->canviewhidden) {
// Totals might be affected by hiding, if user can not see hidden grades the aggregations might be altered
Expand Down Expand Up @@ -1377,7 +1377,11 @@ public function get_right_avg_row($rows=array(), $grouponly=false) {
list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');

// Limit to users with an active enrollment.
list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
$coursecontext = $this->context->get_course_context(true);
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
$showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $coursecontext);
list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context, '', 0, $showonlyactiveenrol);

// We want to query both the current context and parent contexts.
list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($this->context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
Expand Down

0 comments on commit 11db2e1

Please sign in to comment.