From cb4db90d27c935ef5468b150a57ee96e76a368af Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 22 May 2008 10:13:55 +0000 Subject: [PATCH] MDL-14945 MDL-14946 Now checks properly for mod/choice:deleteresponses and mod/choice:downloadresponses --- mod/choice/lib.php | 4 ++-- mod/choice/report.php | 32 +++++++++++++++++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 9917fecd29..3ebd07616d 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -380,7 +380,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish foreach ($allresponses[$optionid] as $user) { $columncount[$optionid] += 1; echo ''; - if ($viewresponses) { + if ($viewresponses and has_capability('mod/choice:deleteresponses',$context)) { echo ''; } echo ''; @@ -422,7 +422,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish echo ""; /// Print "Select all" etc. - if ($viewresponses) { + if ($viewresponses and has_capability('mod/choice:deleteresponses',$context)) { echo ''; echo ''.get_string('selectall', 'quiz').' / '; echo ''.get_string('selectnone', 'quiz').' '; diff --git a/mod/choice/report.php b/mod/choice/report.php index 5e2a62e422..3bee4b3e6a 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -204,21 +204,23 @@ choice_show_results($choice, $course, $cm, $users, $format); //show table with students responses. //now give links for downloading spreadsheets. - echo "
\n"; - echo "\n"; - echo "
"; - $options = array(); - $options["id"] = "$cm->id"; - $options["download"] = "ods"; - print_single_button("report.php", $options, get_string("downloadods")); - echo ""; - $options["download"] = "xls"; - print_single_button("report.php", $options, get_string("downloadexcel")); - echo ""; - $options["download"] = "txt"; - print_single_button("report.php", $options, get_string("downloadtext")); - - echo "
"; + if (has_capability('mod/choice:downloadresponses',$context)) { + echo "
\n"; + echo "\n"; + echo "
"; + $options = array(); + $options["id"] = "$cm->id"; + $options["download"] = "ods"; + print_single_button("report.php", $options, get_string("downloadods")); + echo ""; + $options["download"] = "xls"; + print_single_button("report.php", $options, get_string("downloadexcel")); + echo ""; + $options["download"] = "txt"; + print_single_button("report.php", $options, get_string("downloadtext")); + + echo "
"; + } print_footer($course); ?> -- 2.39.5