if ($courseid != SITEID) { $userheading = array('user' => $user, 'usercontext' => $personalcontext); echo $OUTPUT->context_header($userheading, 2); } // Time to filter records from. if ($mode === 'today') { $timefrom = usergetmidnight(time()); } else { $timefrom = 0; } $output = $PAGE->get_renderer('report_log'); $reportlog = new report_log_renderable($logreader, $course, $user->id, 0, '', -1, -1, false, false, true, false, $PAGE->url, $timefrom, '', $page, $perpage, 'timecreated DESC'); // Setup table if log reader is enabled. if (!empty($reportlog->selectedlogreader)) { $reportlog->setup_table(); $reportlog->tablelog->is_downloadable(false); } echo $output->reader_selector($reportlog); if ($mode === 'today') { echo '<div class="graph">'; report_log_print_graph($course, $user->id, "userday.png", 0, $logreader); echo '</div>'; echo $output->render($reportlog); } else { echo '<div class="graph">'; report_log_print_graph($course, $user->id, "usercourse.png", 0, $logreader); echo '</div>'; $reportlog->selecteddate = 0; echo $output->render($reportlog); } echo $OUTPUT->footer();
// Trigger a user logs viewed event. $event = \report_log\event\user_report_viewed::create(array('context' => $coursecontext, 'relateduserid' => $userid, 'other' => array('mode' => $mode))); $event->trigger(); echo $OUTPUT->header(); if ($courseid != SITEID) { $userheading = array('user' => $user, 'usercontext' => $personalcontext); echo $OUTPUT->context_header($userheading, 2); } // Time to filter records from. if ($mode === 'today') { $timefrom = usergetmidnight(time()); } else { $timefrom = 0; } $output = $PAGE->get_renderer('report_log'); $reportlog = new report_log_renderable($logreader, $course, $user->id, 0, '', -1, -1, false, false, true, false, $PAGE->url, $timefrom, '', $page, $perpage, 'timecreated DESC'); // Setup table if log reader is enabled. if (!empty($reportlog->selectedlogreader)) { $reportlog->setup_table(); $reportlog->tablelog->is_downloadable(false); } echo $output->reader_selector($reportlog); if ($mode === 'all') { $reportlog->selecteddate = 0; } // Print the graphic chart accordingly to the mode (all, today). echo '<div class="graph">'; report_log_print_graph($course, $user, $mode, 0, $logreader); echo '</div>'; echo $output->render($reportlog); echo $OUTPUT->footer();
require_capability('report/log:view', $coursecontext); } } add_to_log($course->id, 'course', 'report log', "report/log/user.php?id=$user->id&course=$course->id&mode=$mode", $course->id); $stractivityreport = get_string('activityreport'); $PAGE->set_pagelayout('admin'); $PAGE->set_url('/report/log/user.php', array('id'=>$user->id, 'course'=>$course->id, 'mode'=>$mode)); $PAGE->navigation->extend_for_user($user); $PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed. $PAGE->set_title("$course->shortname: $stractivityreport"); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); if ($mode === 'today') { echo '<div class="graph">'; report_log_print_graph($course, $user->id, "userday.png"); echo '</div>'; print_log($course, $user->id, usergetmidnight(time()), "l.time DESC", $page, $perpage, "user.php?course=$course->id&id=$user->id&mode=$mode"); } else { echo '<div class="graph">'; report_log_print_graph($course, $user->id, "usercourse.png"); echo '</div>'; print_log($course, $user->id, 0, "l.time DESC", $page, $perpage, "user.php?course=$course->id&id=$user->id&mode=$mode"); } echo $OUTPUT->footer();