forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.php
104 lines (80 loc) · 4.26 KB
/
log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php // $Id$
// Displays different views of the logs.
require_once('../config.php');
require_once('lib.php');
$id = required_param('id',PARAM_INT);// Course ID
$group = optional_param('group', -1, PARAM_INT); // Group to display
$user = optional_param('user', 0, PARAM_INT); // User to display
$date = optional_param('date', 0, PARAM_CLEAN); // Date to display
$modname = optional_param('modname', ''); // course_module->id
$modid = optional_param('modid', ''); // course_module->id
$modaction = optional_param('modaction', ''); // an action as recorded in the logs
$page = optional_param('page', '0', PARAM_INT); // which page to show
$perpage = optional_param('perpage', '100', PARAM_INT); // how many per page
$showcourses = optional_param('showcourses',0,PARAM_INT); // whether to show courses if we're over our limit.
$showusers = optional_param('showusers',0,PARAM_INT); // whether to show users if we're over our limit.
$chooselog = optional_param('chooselog',0,PARAM_INT);
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($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,
"<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
} else {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> ->
<a href=\"log.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
}
print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
echo '<p align="center">[ <a href="'.$CFG->wwwroot.'/course/stats.php?course='.$course->id.'">'.get_string('seealsostats').'</a> ]</p>';
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,
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strlogs", '');
} else {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strlogs", '');
}
print_heading(get_string('chooselogs') .':');
print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
echo '<br />';
print_heading(get_string('chooselivelogs') .':');
echo '<center><h3>';
link_to_popup_window('/course/loglive.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
echo '</h3></center>';
$activityreport = get_string( 'activityreport' );
echo "<center><a href=\"{$CFG->wwwroot}/course/outline_rep.php?id={$course->id}\">";
echo "$activityreport</a></center>\n";
}
print_footer($course);
exit;
?>