Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDL-14945
MDL-14946
Now checks properly for mod/choice:deleteresponses and mod/choice:downloadresponses
  • Loading branch information
thepurpleblob committed May 22, 2008
1 parent 0ad0dbe commit cb4db90
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions mod/choice/lib.php
Expand Up @@ -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">';
Expand Down Expand Up @@ -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> ';
Expand Down
32 changes: 17 additions & 15 deletions mod/choice/report.php
Expand Up @@ -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"));

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);

?>

0 comments on commit cb4db90

Please sign in to comment.