MDL-48942 mod_survey: synced security checks in view.php and graph.php

This commit is contained in:
Andrew Davis
2015-01-26 15:06:28 +01:00
parent c06aa292b1
commit 2e77d5ec7b
2 changed files with 14 additions and 5 deletions
+1
View File
@@ -242,6 +242,7 @@ $string['selectedquestions'] = 'Selected questions from a scale, all students';
$string['summary'] = 'Summary';
$string['survey:addinstance'] = 'Add a new survey';
$string['surveycompleted'] = 'You\'ve completed this survey. The graph below shows a summary of your results compared to the class averages.';
$string['surveycompletednograph'] = 'You have completed this survey.';
$string['survey:download'] = 'Download responses';
$string['surveygraph'] = 'Survey graph';
$string['surveyname'] = 'Survey name';
+13 -5
View File
@@ -107,11 +107,19 @@ $completion->set_module_viewed($cm);
$numusers = survey_count_responses($survey->id, $currentgroup, $groupingid);
if ($showscales) {
echo $OUTPUT->box(get_string("surveycompleted", "survey"));
echo $OUTPUT->box(get_string("peoplecompleted", "survey", $numusers));
echo '<div class="resultgraph">';
survey_print_graph("id=$cm->id&amp;sid=$USER->id&amp;group=$currentgroup&amp;type=student.png");
echo '</div>';
// Ensure that graph.php will allow the user to see the graph.
if (has_capability('mod/survey:readresponses', $context) || !$groupmode || groups_is_member($currentgroup)) {
echo $OUTPUT->box(get_string("surveycompleted", "survey"));
echo $OUTPUT->box(get_string("peoplecompleted", "survey", $numusers));
echo '<div class="resultgraph">';
survey_print_graph("id=$cm->id&amp;sid=$USER->id&amp;group=$currentgroup&amp;type=student.png");
echo '</div>';
} else {
echo $OUTPUT->box(get_string("surveycompletednograph", "survey"));
echo $OUTPUT->box(get_string("peoplecompleted", "survey", $numusers));
}
} else {