From 06c9c36bdcfaffc8d64e98b404d898e3cba387e3 Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Tue, 14 Jul 2015 16:14:37 -0400 Subject: [PATCH] MDL-50833 report: Still make a chart if there are no logs --- report/log/graph.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/report/log/graph.php b/report/log/graph.php index 604d16366b2..0f4ac60fb44 100644 --- a/report/log/graph.php +++ b/report/log/graph.php @@ -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);