foreach ($allresponses[$optionid] as $user) {
$columncount[$optionid] += 1;
echo '<tr><td class="attemptcell">';
- if ($viewresponses) {
+ if ($viewresponses and has_capability('mod/choice:deleteresponses',$context)) {
echo '<input type="checkbox" name="attemptid[]" value="'. $user->id. '" />';
}
echo '</td><td class="picture">';
echo "</tr>";
/// Print "Select all" etc.
- if ($viewresponses) {
+ if ($viewresponses and has_capability('mod/choice:deleteresponses',$context)) {
echo '<tr><td></td><td>';
echo '<a href="javascript:select_all_in(\'DIV\',null,\'tablecontainer\');">'.get_string('selectall', 'quiz').'</a> / ';
echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'tablecontainer\');">'.get_string('selectnone', 'quiz').'</a> ';
choice_show_results($choice, $course, $cm, $users, $format); //show table with students responses.
//now give links for downloading spreadsheets.
- echo "<br />\n";
- echo "<table class=\"downloadreport\"><tr>\n";
- echo "<td>";
- $options = array();
- $options["id"] = "$cm->id";
- $options["download"] = "ods";
- print_single_button("report.php", $options, get_string("downloadods"));
- echo "</td><td>";
- $options["download"] = "xls";
- print_single_button("report.php", $options, get_string("downloadexcel"));
- echo "</td><td>";
- $options["download"] = "txt";
- print_single_button("report.php", $options, get_string("downloadtext"));
-
- echo "</td></tr></table>";
+ if (has_capability('mod/choice:downloadresponses',$context)) {
+ echo "<br />\n";
+ echo "<table class=\"downloadreport\"><tr>\n";
+ echo "<td>";
+ $options = array();
+ $options["id"] = "$cm->id";
+ $options["download"] = "ods";
+ print_single_button("report.php", $options, get_string("downloadods"));
+ echo "</td><td>";
+ $options["download"] = "xls";
+ print_single_button("report.php", $options, get_string("downloadexcel"));
+ echo "</td><td>";
+ $options["download"] = "txt";
+ print_single_button("report.php", $options, get_string("downloadtext"));
+
+ echo "</td></tr></table>";
+ }
print_footer($course);
?>