3 // log.php - displays different views of the logs.
5 require("../config.php");
8 require_variable($id); // Course ID
9 optional_variable($user); // User to display
10 optional_variable($date); // Date to display
14 if (! $course = get_record("course", "id", $id) ) {
15 error("That's an invalid course id");
18 if (! isteacher($course->id)) {
19 error("Only teachers can view logs");
22 if (! $course->category) {
24 error("Only administrators can look at the site logs");
32 $userinfo = "all users";
33 $dateinfo = "any day";
36 if (!$u = get_record("user", "id", $user) ) {
37 error("That's an invalid user!");
39 $userinfo = "$u->firstname $u->lastname";
42 $dateinfo = userdate($date, "l, j F Y");
45 print_header("$course->shortname: Logs", "$course->fullname",
46 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> ->
47 <A HREF=\"log.php?id=$course->id\">Logs</A> -> Logs for $userinfo, $dateinfo", "");
49 print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
51 print_log_selector_form($course, $user, $date);
53 print_log($course, $user, $date, "ORDER BY l.time DESC");
57 print_header("$course->shortname: Logs", "$course->fullname",
58 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> Logs", "");
60 print_heading("Choose which logs you want to look at");
62 print_log_selector_form($course);
64 print_heading("Or see what is happening right now");
67 link_to_popup_window("/course/loglive.php?id=$course->id","livelog","Live logs", 500, 800);
68 echo "</H3></CENTER>";
72 print_footer($course);