2004-09-12 12:21:27 +00:00
|
|
|
<?php // $Id$
|
2002-08-11 15:41:54 +00:00
|
|
|
// Displays different views of the logs.
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
require_once('../config.php');
|
|
|
|
require_once('lib.php');
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-06-12 04:22:41 +00:00
|
|
|
require_variable($id); // Course ID
|
2004-07-28 15:52:51 +00:00
|
|
|
optional_variable($group, -1); // Group to display
|
2002-12-23 10:27:57 +00:00
|
|
|
optional_variable($user, 0); // User to display
|
|
|
|
optional_variable($date, 0); // Date to display
|
2004-09-25 15:17:08 +00:00
|
|
|
optional_variable($modname, ''); // course_module->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
|
2004-11-23 00:16:24 +00:00
|
|
|
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.
|
2002-06-12 04:22:41 +00:00
|
|
|
|
2003-05-24 07:29:17 +00:00
|
|
|
require_login();
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
if (! $course = get_record('course', 'id', $id) ) {
|
|
|
|
error('That\'s an invalid course id');
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2002-06-10 09:44:37 +00:00
|
|
|
if (! isteacher($course->id)) {
|
2004-09-25 15:17:08 +00:00
|
|
|
error('Only teachers can view logs');
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2002-06-12 04:22:41 +00:00
|
|
|
if (! $course->category) {
|
|
|
|
if (!isadmin()) {
|
2004-09-25 15:17:08 +00:00
|
|
|
error('Only administrators can look at the site logs');
|
2002-06-12 04:22:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
$strlogs = get_string('logs');
|
|
|
|
$stradministration = get_string('administration');
|
2002-08-10 13:42:12 +00:00
|
|
|
|
2005-01-17 05:42:27 +00:00
|
|
|
session_write_close();
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2003-08-22 06:07:18 +00:00
|
|
|
if (!empty($_GET['chooselog'])) {
|
2004-09-25 15:17:08 +00:00
|
|
|
$userinfo = get_string('allparticipants');
|
|
|
|
$dateinfo = get_string('alldays');
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if ($user) {
|
2004-09-25 15:17:08 +00:00
|
|
|
if (!$u = get_record('user', 'id', $user) ) {
|
|
|
|
error('That\'s an invalid user!');
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2004-08-28 17:18:36 +00:00
|
|
|
$userinfo = fullname($u, isteacher($course->id));
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
if ($date) {
|
2004-09-25 15:17:08 +00:00
|
|
|
$dateinfo = userdate($date, get_string('strftimedaydate'));
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2003-01-01 07:37:19 +00:00
|
|
|
if ($course->category) {
|
2004-09-25 15:17:08 +00:00
|
|
|
print_header($course->shortname .': '. $strlogs, $course->fullname,
|
2004-01-15 07:17:12 +00:00
|
|
|
"<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
|
2004-09-25 15:17:08 +00:00
|
|
|
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
|
2003-01-01 07:37:19 +00:00
|
|
|
} else {
|
2004-09-25 15:17:08 +00:00
|
|
|
print_header($course->shortname .': '. $strlogs, $course->fullname,
|
2004-01-15 07:17:12 +00:00
|
|
|
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> ->
|
2004-09-27 14:33:06 +00:00
|
|
|
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
|
2003-01-01 07:37:19 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-06-12 04:22:41 +00:00
|
|
|
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-11-23 00:16:24 +00:00
|
|
|
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
print_log($course, $user, $date, 'l.time DESC', $page, $perpage,
|
2004-09-16 17:13:57 +00:00
|
|
|
"log.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction&group=$group",
|
2004-07-28 15:52:51 +00:00
|
|
|
$modname, $modid, $modaction, $group);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
} else {
|
2003-01-01 07:37:19 +00:00
|
|
|
if ($course->category) {
|
2004-09-25 15:17:08 +00:00
|
|
|
print_header($course->shortname .': '. $strlogs, $course->fullname,
|
|
|
|
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strlogs", '');
|
2003-01-01 07:37:19 +00:00
|
|
|
} else {
|
2004-09-25 15:17:08 +00:00
|
|
|
print_header($course->shortname .': '. $strlogs, $course->fullname,
|
|
|
|
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strlogs", '');
|
2003-01-01 07:37:19 +00:00
|
|
|
}
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
print_heading(get_string('chooselogs') .':');
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-11-23 00:16:24 +00:00
|
|
|
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
echo '<br />';
|
|
|
|
print_heading(get_string('chooselivelogs') .':');
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2004-09-25 15:17:08 +00:00
|
|
|
echo '<center><h3>';
|
|
|
|
link_to_popup_window('/course/loglive.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
|
|
|
|
echo '</h3></center>';
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
2004-09-27 14:33:06 +00:00
|
|
|
?>
|