MDL-14945

MDL-14946
Now checks properly for mod/choice:deleteresponses and mod/choice:downloadresponses
This commit is contained in:
thepurpleblob
2008-05-22 10:12:13 +00:00
parent 57fb427c9b
commit fd17bd94da
2 changed files with 18 additions and 16 deletions
+2 -2
View File
@@ -380,7 +380,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
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">';
@@ -422,7 +422,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
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> ';
+16 -14
View File
@@ -204,21 +204,23 @@
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"));
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>";
echo "</td></tr></table>";
}
print_footer($course);
?>