require_variable($id); // Course ID
require_variable($type); // Graph Type
optional_variable($user); // Student ID
+ optional_variable($date); // Midnight of a date
if (! $course = get_record("course", "id", $id)) {
error("Course is misconfigured");
require_login($course->id);
if (!isteacher($course->id)) {
- if (! ($type == "student.png" and $user == $USER->id) ) {
+ if (! ($type == "usercourse.png" and $user == $USER->id) ) {
error("Sorry, you aren't allowed to see this.");
}
}
switch ($type) {
- case "user.png":
+ case "usercourse.png":
$timestart = $course->startdate;
$i = 0;
$maxlogs = max($logs);
- $graph = new graph(600, 300);
+ $graph = new graph(750, 400);
$graph->parameter['title'] = "Rough usage of $course->shortname by $user->firstname $user->lastname";
$graph->x_data = $days;
$graph->y_data['logs'] = $logs;
$graph->y_format['logs'] = array('colour' => 'blue','bar' => 'fill','legend' =>'actual','bar_size' => 0.4);
$graph->y_label_left = "Hits";
+ $graph->label_size = "6";
$graph->y_order = array('logs');
break;
+ case "userday.png":
+
+ if (! $date) {
+ error("Must specify a date if you use userday.png format");
+ }
+
+ // XXX still to be done. The day was getting long!
+
+ break;
+
default:
break;
}
require_variable($id); // course id
require_variable($user); // user id
- optional_variable($mode, "graph");
+ optional_variable($mode, "outline");
if (! $course = get_record("course", "id", $id)) {
error("Course id is incorrect.");
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
- print_header("$course->shortname: Activity Report", "$course->fullname",
+ print_header("$course->shortname: Activity Report ($mode)", "$course->fullname",
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
<A HREF=\"../user/index.php?id=$course->id\">Participants</A> ->
<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
echo "<TABLE CELLPADDING=10 ALIGN=CENTER><TR>";
echo "<TD>Reports: </TD>";
- if ($mode != "graph") {
- echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=graph>Graph</A></TD>";
- } else {
- echo "<TD><U>Graph</U></TD>";
- }
if ($mode != "outline") {
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=outline>Outline</A></TD>";
} else {
} else {
echo "<TD><U>Complete</U></TD>";
}
+ if ($mode != "today") {
+ echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=today>Today</A></TD>";
+ } else {
+ echo "<TD><U>Today</U></TD>";
+ }
+ if ($mode != "alllogs") {
+ echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=alllogs>All logs</A></TD>";
+ } else {
+ echo "<TD><U>All logs</U></TD>";
+ }
echo "</TR></TABLE>";
get_all_mods($course->id, $mods, $modtype);
switch ($mode) {
- case "graph" :
- echo "<HR>";
- echo "<CENTER><IMG SRC=\"loggraph.php?id=$course->id&user=$user->id&type=user.png\">";
+ case "today" :
+ echo "<HR><CENTER>";
+ print_log_graph($course, $user->id, "userday.png", usergetmidnight(time()) );
+ echo "</CENTER>";
+ print_log($course, $user->id, usergetmidnight(time()), "ORDER BY l.time DESC");
+ break;
+
+ case "alllogs" :
+ echo "<HR><CENTER>";
+ print_log_graph($course, $user->id, "usercourse.png");
+ echo "</CENTER>";
+ print_log($course, $user->id, 0, "ORDER BY l.time DESC");
break;
case "outline" :