id)) {
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");
$stradministration = get_string("administration");
if ($user || $date) {
$userinfo = get_string("allparticipants");
$dateinfo = get_string("alldays");
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");
}
if ($course->category) {
print_header("$course->shortname: $strlogs", "$course->fullname",
"id\">$course->shortname ->
id\">$strlogs -> $userinfo, $dateinfo", "");
} else {
print_header("$course->shortname: $strlogs", "$course->fullname",
"wwwroot/admin/\">$stradministration ->
id\">$strlogs -> $userinfo, $dateinfo", "");
}
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
print_log_selector_form($course, $user, $date);
print_log($course, $user, $date, "ORDER BY l.time DESC");
} else {
if ($course->category) {
print_header("$course->shortname: $strlogs", "$course->fullname",
"id\">$course->shortname -> $strlogs", "");
} else {
print_header("$course->shortname: $strlogs", "$course->fullname",
"wwwroot/admin/\">$stradministration -> $strlogs", "");
}
print_heading(get_string("chooselogs").":");
print_log_selector_form($course);
echo "
";
print_heading(get_string("chooselivelogs").":");
echo "