course)) { error("Course module is misconfigured"); } require_login($course->id); if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (! $choice = get_record("choice", "id", $cm->instance)) { error("Course module is incorrect"); } add_to_log($course->id, "choice", "report", "report.php?id=$cm->id", "$choice->id"); print_header("$course->shortname: $choice->name: Responses", "$course->fullname", "id>$course->shortname -> id>Choices -> id>$choice->name -> Responses", ""); if (! $participants = get_records_sql("SELECT u.* FROM user u, user_students s, user_teachers t WHERE (s.course = '$course->id' AND s.user = u.id) OR (t.course = '$course->id' AND t.user = u.id) ORDER BY u.lastaccess DESC")) { notify("No participants (strange)", "/course/view.php?id=$course->id"); die; } if ( $allanswers = get_records_sql("SELECT * FROM choice_answers WHERE choice='$choice->id'")) { foreach ($allanswers as $aa) { $answers[$aa->user] = $aa; } } else { $answers = array () ; } $timenow = time(); echo ""; foreach ($participants as $user) { $answer = $answers[$user->id]; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
body\" WIDTH=35 VALIGN=TOP>"; print_user_picture($user->id, $course->id, $user->picture); echo "cellheading\">$user->firstname $user->lastname

 "; if ($answer->timemodified) { echo moodledate($answer->timemodified); } echo "

cellcontent\">

"; switch ($answer->answer) { case 1: echo "$choice->answer1"; break; case 2: echo "$choice->answer2"; break; default: echo "Undecided"; break; } echo "

"; print_footer($course); ?>