2 // Displays different views of the logs.
4 require_once("../config.php");
5 require_once("lib.php");
7 require_variable($id); // Course ID
8 optional_variable($user, 0); // User to display
9 optional_variable($date, 0); // Date to display
13 if (! $course = get_record("course", "id", $id) ) {
14 error("That's an invalid course id");
17 if (! isteacher($course->id
)) {
18 error("Only teachers can view logs");
21 if (! $course->category
) {
23 error("Only administrators can look at the site logs");
28 $strlogs = get_string("logs");
29 $stradministration = get_string("administration");
33 $userinfo = get_string("allparticipants");
34 $dateinfo = get_string("alldays");
37 if (!$u = get_record("user", "id", $user) ) {
38 error("That's an invalid user!");
40 $userinfo = "$u->firstname $u->lastname";
43 $dateinfo = userdate($date, get_string("strftimedaydate"));
46 if ($course->category
) {
47 print_header("$course->shortname: $strlogs", "$course->fullname",
48 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> ->
49 <A HREF=\"log.php?id=$course->id\">$strlogs</A> -> $userinfo, $dateinfo", "");
51 print_header("$course->shortname: $strlogs", "$course->fullname",
52 "<A HREF=\"../$CFG->admin/index.php\">$stradministration</A> ->
53 <A HREF=\"log.php?id=$course->id\">$strlogs</A> -> $userinfo, $dateinfo", "");
56 print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
58 print_log_selector_form($course, $user, $date);
60 print_log($course, $user, $date, "ORDER BY l.time DESC");
63 if ($course->category
) {
64 print_header("$course->shortname: $strlogs", "$course->fullname",
65 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> $strlogs", "");
67 print_header("$course->shortname: $strlogs", "$course->fullname",
68 "<A HREF=\"../$CFG->admin/index.php\">$stradministration</A> -> $strlogs", "");
71 print_heading(get_string("chooselogs").":");
73 print_log_selector_form($course);
76 print_heading(get_string("chooselivelogs").":");
79 link_to_popup_window("/course/loglive.php?id=$course->id","livelog", get_string("livelogs"), 500, 800);
80 echo "</H3></CENTER>";
83 print_footer($course);