mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
merged fix for MDL-10818, do not display graph if user has no permission
This commit is contained in:
parent
beb67c0526
commit
a683deeca6
@ -959,12 +959,16 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
|
||||
|
||||
|
||||
function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
if (empty($CFG->gdversion)) {
|
||||
echo "(".get_string("gdneed").")";
|
||||
} else {
|
||||
echo '<img src="'.$CFG->wwwroot.'/course/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
// MDL-10818, do not display broken graph when user has no permission to view graph
|
||||
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id)) ||
|
||||
($course->showreports and $USER->id == $userid)) {
|
||||
echo '<img src="'.$CFG->wwwroot.'/course/report/log/graph.php?id='.$course->id.
|
||||
'&user='.$userid.'&type='.$type.'&date='.$date.'" alt="" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,8 @@
|
||||
}
|
||||
|
||||
// MDL-10818, do not display broken graph when user has no permission to view graph
|
||||
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id)) ||
|
||||
($course->showreports and $USER->id == $user->id)) {
|
||||
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user