Skip to content
Permalink
Browse files

MDL-27541 course reports - allow teachers to view individual reports

  • Loading branch information...
stronk7 committed May 17, 2011
1 parent 16b5541 commit 5fba6731d31a9d364afbe9044f6fddcd42cf912a
Showing with 13 additions and 6 deletions.
  1. +13 −6 lib/navigationlib.php
@@ -1700,9 +1700,16 @@ protected function load_for_user($user=null, $forceforcontext=false) {
}
// Add a reports tab and then add reports the the user has permission to see.
$anyreport = has_capability('moodle/user:viewuseractivitiesreport', $usercontext);
$anyreport = has_capability('moodle/user:viewuseractivitiesreport', $usercontext);
$viewreports = ($anyreport || ($course->showreports && $iscurrentuser && $forceforcontext));
$outlinetreport = ($anyreport || has_capability('coursereport/outline:view', $coursecontext));
$logtodayreport = ($anyreport || has_capability('coursereport/log:viewtoday', $coursecontext));
$logreport = ($anyreport || has_capability('coursereport/log:view', $coursecontext));
$statsreport = ($anyreport || has_capability('coursereport/stats:view', $coursecontext));
$somereport = $outlinetreport || $logtodayreport || $logreport || $statsreport;
$viewreports = ($anyreport || $somereport || ($course->showreports && $iscurrentuser && $forceforcontext));
if ($viewreports) {
$reporttab = $usernode->add(get_string('activityreports'));
$reportargs = array('user'=>$user->id);
@@ -1711,21 +1718,21 @@ protected function load_for_user($user=null, $forceforcontext=false) {
} else {
$reportargs['id'] = SITEID;
}
if ($viewreports || has_capability('coursereport/outline:view', $coursecontext)) {
if ($viewreports || $outlinetreport) {
$reporttab->add(get_string('outlinereport'), new moodle_url('/course/user.php', array_merge($reportargs, array('mode'=>'outline'))));
$reporttab->add(get_string('completereport'), new moodle_url('/course/user.php', array_merge($reportargs, array('mode'=>'complete'))));
}
if ($viewreports || has_capability('coursereport/log:viewtoday', $coursecontext)) {
if ($viewreports || $logtodayreport) {
$reporttab->add(get_string('todaylogs'), new moodle_url('/course/user.php', array_merge($reportargs, array('mode'=>'todaylogs'))));
}
if ($viewreports || has_capability('coursereport/log:view', $coursecontext)) {
if ($viewreports || $logreport ) {
$reporttab->add(get_string('alllogs'), new moodle_url('/course/user.php', array_merge($reportargs, array('mode'=>'alllogs'))));
}
if (!empty($CFG->enablestats)) {
if ($viewreports || has_capability('coursereport/stats:view', $coursecontext)) {
if ($viewreports || $statsreport) {
$reporttab->add(get_string('stats'), new moodle_url('/course/user.php', array_merge($reportargs, array('mode'=>'stats'))));
}
}

0 comments on commit 5fba673

Please sign in to comment.
You can’t perform that action at this time.