New translation added.
[moodle.git] / course / log.php
blob68442e0c5b9135f0ee5eedb3b2fccdb03e94dda7
1 <?PHP // $Id$
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
11 require_login();
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) {
22 if (!isadmin()) {
23 error("Only administrators can look at the site logs");
25 $user = "";
28 $strlogs = get_string("logs");
29 $stradministration = get_string("administration");
32 if ($user || $date) {
33 $userinfo = get_string("allparticipants");
34 $dateinfo = get_string("alldays");
36 if ($user) {
37 if (!$u = get_record("user", "id", $user) ) {
38 error("That's an invalid user!");
40 $userinfo = "$u->firstname $u->lastname";
42 if ($date) {
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", "");
50 } else {
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");
62 } else {
63 if ($course->category) {
64 print_header("$course->shortname: $strlogs", "$course->fullname",
65 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> $strlogs", "");
66 } else {
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);
75 echo "<BR>";
76 print_heading(get_string("chooselivelogs").":");
78 echo "<CENTER><H3>";
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);
85 exit;