Typo on add_to_log URL
[moodle.git] / course / log.php
CommitLineData
f9903ed0 1<?PHP // $Id$
2
3// log.php - displays different views of the logs.
4
5 require("../config.php");
6 require("lib.php");
7
8 require_login($id);
9
10 if (! $course = get_record("course", "id", $id) ) {
11 error("That's an invalid course id");
12 }
13
0d97d1e3 14 if ( ! isteacher($course->id)) {
f9903ed0 15 error("Only teachers can view logs");
16 }
17
18
19 if (isset($user) || isset($date)) {
20
21 $userinfo = "all users";
22 $dateinfo = "any day";
23
24 if ($user) {
25 if (!$u = get_record("user", "id", $user) ) {
26 error("That's an invalid user!");
27 }
28 $userinfo = "$u->firstname $u->lastname";
29 }
30 if ($date) {
873960de 31 $dateinfo = userdate($date, "l, j F Y");
f9903ed0 32 }
33
34 print_header("$course->shortname: Logs", "$course->shortname : Logs",
35 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> ->
36 <A HREF=\"log.php?id=$course->id\">Logs</A> -> Logs for $userinfo, $dateinfo", "");
37
38 print_heading("Logs for $userinfo, $dateinfo");
39
40 print_log_selector_form($course, $user, $date);
41
42 print_log($course, $user, $date, "ORDER BY l.time DESC");
43
44
45 } else {
46 print_header("$course->shortname: Logs", "$course->shortname : Logs",
47 "<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> Logs", "");
48
49 print_heading("Choose which logs you want to look at");
50
51 print_log_selector_form($course);
52
53 print_heading("Or see what is happening right now");
54
55 echo "<CENTER><H3>";
56 link_to_popup_window("/course/loglive.php?id=$course->id","livelog","Live logs", 500, 800);
57 echo "</H3></CENTER>";
58
59 }
60
61 print_footer($course);
62
63 exit;
64
65?>