Fixes for empty logs array MDL-6145

This commit is contained in:
moodler
2006-09-27 07:41:38 +00:00
parent acad3401f1
commit 2b2d182aa7
+14
View File
@@ -387,6 +387,11 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
echo "<th class=\"c5 header\">".get_string('info')."</th>\n";
echo "</tr>\n";
if (empty($logs['logs'])) {
echo "</table>\n";
return;
}
$row = 1;
foreach ($logs['logs'] as $log) {
@@ -479,6 +484,10 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
echo get_string('savedat').userdate(time(), $strftimedatetime)."\n";
echo $text;
if (empty($logs['logs'])) {
return true;
}
foreach ($logs['logs'] as $log) {
if (isset($ldcache[$log->module][$log->action])) {
$ld = $ldcache[$log->module][$log->action];
@@ -565,6 +574,11 @@ function print_log_xls($course, $user, $date, $order='l.time DESC', $modname,
}
}
if (empty($logs['logs'])) {
$workbook->close();
return true;
}
$formatDate =& $workbook->add_format();
$formatDate->set_num_format(get_string('log_excel_date_format'));