]> git.mjollnir.org Git - moodle.git/commitdiff
If students view surveys after having done them, then they are now shown
authormartin <martin>
Thu, 28 Mar 2002 05:52:30 +0000 (05:52 +0000)
committermartin <martin>
Thu, 28 Mar 2002 05:52:30 +0000 (05:52 +0000)
the survey results compared to the class.  Needs docs still.

mod/survey/graph.php
mod/survey/view.php

index c262ba2f5eb6976f825828edd577aca633a4cb72..74cadf7cffad2616e320b2a1d9227a60b169e76e 100644 (file)
@@ -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");
 
     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)) {
index 2421e428b48d686e3c2660800fdefb0f9c307565..11451c89f139017341375d3019a040b9ddaed026 100644 (file)
 //  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 "<CENTER>";
+        echo "<IMG SRC=\"$CFG->wwwroot/mod/survey/graph.php?id=$cm->id&sid=$USER->id&type=student.png\">";
+        echo "</CENTER>";
+        print_footer($course);
         exit;
     }