Skip to content
Permalink
Browse files

MDL-46036 mod_survey: added logic to prevent user trying to download …

…when there are no results
  • Loading branch information...
andyjdavis committed Jun 24, 2014
1 parent 9663e6f commit dbf541f8e119ad55c27800da053f050ca7aa430b
Showing with 18 additions and 12 deletions.
  1. +18 −12 mod/survey/report.php
@@ -477,22 +477,28 @@
require_capability('mod/survey:download', $context);
echo '<p class="centerpara">'.get_string("downloadinfo", "survey").'</p>';
$numusers = survey_count_responses($survey->id, $currentgroup, $groupingid);
if ($numusers > 0) {
echo html_writer::tag('p', get_string("downloadinfo", "survey"), array('class' => 'centerpara'));
echo $OUTPUT->container_start('reportbuttons');
$options = array();
$options["id"] = "$cm->id";
$options["group"] = $currentgroup;
echo $OUTPUT->container_start('reportbuttons');
$options = array();
$options["id"] = "$cm->id";
$options["group"] = $currentgroup;
$options["type"] = "ods";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadods"));
$options["type"] = "ods";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadods"));
$options["type"] = "xls";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadexcel"));
$options["type"] = "xls";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadexcel"));
$options["type"] = "txt";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadtext"));
echo $OUTPUT->container_end();
$options["type"] = "txt";
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadtext"));
echo $OUTPUT->container_end();
} else {
echo html_writer::tag('p', get_string("nobodyyet", "survey"), array('class' => 'centerpara'));
}
break;

0 comments on commit dbf541f

Please sign in to comment.
You can’t perform that action at this time.