MDL-50833 report: Still make a chart if there are no logs
This commit is contained in:
+10
-8
@@ -123,16 +123,17 @@ if ($type === "usercourse.png") {
|
||||
|
||||
$rawlogs = report_log_usercourse($user->id, $courseselect, $coursestart, $logreader);
|
||||
|
||||
if (empty($rawlogs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($rawlogs as $rawlog) {
|
||||
$logs[$rawlog->day] = $rawlog->num;
|
||||
}
|
||||
|
||||
$graph = new graph(750, 400);
|
||||
|
||||
if (empty($rawlogs)) {
|
||||
$graph->parameter['y_axis_gridlines'] = 2;
|
||||
$graph->parameter['y_max_left'] = 1;
|
||||
}
|
||||
|
||||
$a = new stdClass();
|
||||
$a->coursename = format_string($course->shortname, true, array('context' => $coursecontext));
|
||||
$a->username = fullname($user, true);
|
||||
@@ -197,16 +198,17 @@ if ($type === "usercourse.png") {
|
||||
|
||||
$rawlogs = report_log_userday($user->id, $courseselect, $daystart, $logreader);
|
||||
|
||||
if (empty($rawlogs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($rawlogs as $rawlog) {
|
||||
$logs[$rawlog->hour] = $rawlog->num;
|
||||
}
|
||||
|
||||
$graph = new graph(750, 400);
|
||||
|
||||
if (empty($rawlogs)) {
|
||||
$graph->parameter['y_axis_gridlines'] = 2;
|
||||
$graph->parameter['y_max_left'] = 1;
|
||||
}
|
||||
|
||||
$a = new stdClass();
|
||||
$a->coursename = format_string($course->shortname, true, array('context' => $coursecontext));
|
||||
$a->username = fullname($user, true);
|
||||
|
||||
Reference in New Issue
Block a user