2 // Displays live view of recent logs
4 require_once("../../../config.php");
5 require_once("../../lib.php");
7 $id = required_param('id', PARAM_INT
);
8 $page = optional_param('page', 0, PARAM_INT
); // which page to show
12 if (! $course = get_record("course", "id", $id) ) {
13 error("That's an invalid course id");
16 $context = get_context_instance(CONTEXT_COURSE
, $course->id
);
17 if (!has_capability('moodle/site:viewreports', $context)) {
18 error('You need do not have the required permission to view this report');
21 add_to_log($course->id
, "course", "report live", "report/log/live.php?id=$course->id", $course->id
);
23 session_write_close();
25 // we override the default framename so header/footer
26 // links open in a new window
27 if (empty($CFG->framename
) ||
$CFG->framename
==='_top') {
28 $CFG->framename
= '_blank';
31 $strlivelogs = get_string("livelogs");
32 $strupdatesevery = get_string("updatesevery", "moodle", COURSE_LIVELOG_REFRESH
);
34 print_header("$strlivelogs ($strupdatesevery)", "$strlivelogs", "", "",
35 '<meta http-equiv="Refresh" content="'.COURSE_LIVELOG_REFRESH
.'; url=live.php?id='.$course->id
.'" />');
40 print_log($course, $user, $date, "l.time DESC", $page, 500,
41 "live.php?id=$course->id&user=$user&date=$date");