moodle/course/log.php

76 lines
2.1 KiB
PHP
Raw Normal View History

2001-11-22 06:23:56 +00:00
<?PHP // $Id$
// Displays different views of the logs.
2001-11-22 06:23:56 +00:00
require("../config.php");
require("lib.php");
require_variable($id); // Course ID
2002-12-23 10:27:57 +00:00
optional_variable($user, 0); // User to display
optional_variable($date, 0); // Date to display
2001-11-22 06:23:56 +00:00
require_login($id);
if (! $course = get_record("course", "id", $id) ) {
error("That's an invalid course id");
}
if (! isteacher($course->id)) {
2001-11-22 06:23:56 +00:00
error("Only teachers can view logs");
}
if (! $course->category) {
if (!isadmin()) {
error("Only administrators can look at the site logs");
}
$user = "";
}
$strlogs = get_string("logs");
2001-11-22 06:23:56 +00:00
if ($user || $date) {
$userinfo = get_string("allparticipants");
$dateinfo = get_string("alldays");
2001-11-22 06:23:56 +00:00
if ($user) {
if (!$u = get_record("user", "id", $user) ) {
error("That's an invalid user!");
}
$userinfo = "$u->firstname $u->lastname";
}
if ($date) {
$dateinfo = userdate($date, "%A, %d %B %Y");
2001-11-22 06:23:56 +00:00
}
print_header("$course->shortname: $strlogs", "$course->fullname",
2001-11-22 06:23:56 +00:00
"<A HREF=\"view.php?id=$course->id\">$course->shortname</A> ->
<A HREF=\"log.php?id=$course->id\">$strlogs</A> -> $userinfo, $dateinfo", "");
2001-11-22 06:23:56 +00:00
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
2001-11-22 06:23:56 +00:00
print_log_selector_form($course, $user, $date);
print_log($course, $user, $date, "ORDER BY l.time DESC");
} else {
print_header("$course->shortname: $strlogs", "$course->fullname",
"<A HREF=\"view.php?id=$course->id\">$course->shortname</A> -> $strlogs", "");
2001-11-22 06:23:56 +00:00
print_heading(get_string("chooselogs").":");
2001-11-22 06:23:56 +00:00
print_log_selector_form($course);
echo "<BR>";
print_heading(get_string("chooselivelogs").":");
2001-11-22 06:23:56 +00:00
echo "<CENTER><H3>";
link_to_popup_window("/course/loglive.php?id=$course->id","livelog", get_string("livelogs"), 500, 800);
2001-11-22 06:23:56 +00:00
echo "</H3></CENTER>";
}
print_footer($course);
exit;
?>