mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 18:36:42 +02:00
Merge branch 'MDL-43197-26-2nd' of git://github.com/FMCorz/moodle into MOODLE_26_STABLE
This commit is contained in:
commit
f09f95fefa
3 changed files with 58 additions and 8 deletions
|
@ -79,6 +79,9 @@ $anyreport = has_capability('moodle/user:viewuseractivitiesreport', $personalco
|
|||
|
||||
$modes = array();
|
||||
|
||||
// Used for grade reports, it represents whether we should be viewing the report as ourselves, or as the targetted user.
|
||||
$viewasuser = false;
|
||||
|
||||
if (has_capability('moodle/grade:viewall', $coursecontext)) {
|
||||
//ok - can view all course grades
|
||||
$modes[] = 'grade';
|
||||
|
@ -90,10 +93,12 @@ if (has_capability('moodle/grade:viewall', $coursecontext)) {
|
|||
} else if ($course->showgrades and has_capability('moodle/grade:viewall', $personalcontext)) {
|
||||
// ok - can view grades of this user - parent most probably
|
||||
$modes[] = 'grade';
|
||||
$viewasuser = true;
|
||||
|
||||
} else if ($course->showgrades and $anyreport) {
|
||||
// ok - can view grades of this user - parent most probably
|
||||
$modes[] = 'grade';
|
||||
$viewasuser = true;
|
||||
}
|
||||
|
||||
if (empty($modes)) {
|
||||
|
@ -126,7 +131,7 @@ switch ($mode) {
|
|||
|
||||
$functionname = 'grade_report_'.$CFG->grade_profilereport.'_profilereport';
|
||||
if (function_exists($functionname)) {
|
||||
$functionname($course, $user);
|
||||
$functionname($course, $user, $viewasuser);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue