$forcepublish = $choice->publish;
}
- if (!$allresponses) {
+ if (empty($allresponses)) {
print_heading(get_string("nousersyet"));
+ return false;
}
$totalresponsecount = 0;
}
echo "</tr><tr>";
- if ($choice->showunanswered) {
+ if ($choice->showunanswered && !empty($allresponses[0])) {
echo "<td class=\"col$count data\" >";
// added empty row so that when the next iteration is empty,
// we do not get <table></table> erro from w3c validator
}
}
}
-
+ if (empty($allresponses[0])) {
+ unset($allresponses[0]);
+ }
return $allresponses;
}
choice_show_results($choice, $course, $cm, $users, $format); //show table with students responses.
//now give links for downloading spreadsheets.
- if (has_capability('mod/choice:downloadresponses',$context)) {
+ if (!empty($users) && has_capability('mod/choice:downloadresponses',$context)) {
echo "<br />\n";
echo "<table class=\"downloadreport\"><tr>\n";
echo "<td>";
}
print_footer($course);
-?>
+?>
\ No newline at end of file