id
optional_variable($modid, ''); // course_module->id
optional_variable($modaction, ''); // an action as recorded in the logs
optional_variable($page, '0'); // which page to show
optional_variable($perpage, '100'); // how many per page
optional_variable($showcourses,0); // whether to show courses if we're over our limit.
optional_variable($showusers,0); // whether to show users if we're over our limit.
require_login();
if (! $course = get_record('course', 'id', $id) ) {
error('That\'s an invalid course id');
}
if (! isteacher($course->id)) {
error('Only teachers can view logs');
}
if (! $course->category) {
if (!isadmin()) {
error('Only administrators can look at the site logs');
}
}
$strlogs = get_string('logs');
$stradministration = get_string('administration');
session_write_close();
if (!empty($_GET['chooselog'])) {
$userinfo = get_string('allparticipants');
$dateinfo = get_string('alldays');
if ($user) {
if (!$u = get_record('user', 'id', $user) ) {
error('That\'s an invalid user!');
}
$userinfo = fullname($u, isteacher($course->id));
}
if ($date) {
$dateinfo = userdate($date, get_string('strftimedaydate'));
}
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,
"admin/index.php\">$stradministration ->
id\">$strlogs -> $userinfo, $dateinfo", '');
}
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
print_log($course, $user, $date, 'l.time DESC', $page, $perpage,
"log.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction&group=$group",
$modname, $modid, $modaction, $group);
} else {
if ($course->category) {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"id\">$course->shortname -> $strlogs", '');
} else {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"admin/index.php\">$stradministration -> $strlogs", '');
}
print_heading(get_string('chooselogs') .':');
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
echo '
';
print_heading(get_string('chooselivelogs') .':');
echo '