MDL-50833 report: Still make a chart if there are no logs

This commit is contained in:
Eric Merrill 2015-07-14 16:14:37 -04:00
parent e5eefbbf01
commit 06c9c36bdc

View File

@ -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);