mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-47914 report_stats: better handling of user and mode
This commit is contained in:
parent
d63a81c507
commit
fc8977fbca
@ -57,7 +57,8 @@ if (!empty($userid)) {
|
||||
if (!report_stats_can_access_user_report($user, $course, true)) {
|
||||
require_capability('report/stats:view', $coursecontext);
|
||||
}
|
||||
|
||||
} else if ($mode === STATS_MODE_DETAILED) {
|
||||
print_error('invaliduser');
|
||||
} else {
|
||||
require_capability('report/stats:view', $coursecontext);
|
||||
}
|
||||
|
@ -161,7 +161,11 @@ function report_stats_report($course, $report, $mode, $user, $roleid, $time) {
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
// Display the report if:
|
||||
// - A report has been selected.
|
||||
// - A time frame has been provided
|
||||
// - If the mode is not detailed OR a valid user has been selected.
|
||||
if (!empty($report) && !empty($time) && ($mode !== STATS_MODE_DETAILED || !empty($userid))) {
|
||||
if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) {
|
||||
print_error('reportnotavailable');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user