From c015c2bcb3d700bc404da2baaf17a8bea6356961 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 28 Mar 2002 05:52:30 +0000 Subject: [PATCH] If students view surveys after having done them, then they are now shown the survey results compared to the class. Needs docs still. --- mod/survey/graph.php | 8 ++++++-- mod/survey/view.php | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mod/survey/graph.php b/mod/survey/graph.php index c262ba2f5e..74cadf7cff 100644 --- a/mod/survey/graph.php +++ b/mod/survey/graph.php @@ -5,6 +5,8 @@ require("lib.php"); require_variable($id); // Course Module ID + require_variable($type); // Graph Type + optional_variable($sid); // Student ID if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); @@ -16,8 +18,10 @@ require_login($course->id); - if (!isteacher($course->id)) { - error("Sorry, only teachers can see this."); + if (!isteacher($course->id) && !isadmin()) { + if (! ($type == "student.png" && $sid == $USER->id) ) { + error("Sorry, you aren't allowed to see this."); + } } if (! $survey = get_record("survey", "id", $cm->instance)) { diff --git a/mod/survey/view.php b/mod/survey/view.php index 2421e428b4..11451c89f1 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -38,7 +38,11 @@ // Check the survey hasn't already been filled out. if (survey_already_done($survey->id, $USER->id)) { - notice("You've already done this survey, $USER->firstname!", $HTTP_REFERER); + print_heading("You've completed this survey. The graph below shows a summary of your results compared to the class averages."); + echo "
"; + echo "wwwroot/mod/survey/graph.php?id=$cm->id&sid=$USER->id&type=student.png\">"; + echo "
"; + print_footer($course); exit; } -- 2.39.5