mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Slight tweaks to survey display after it's been done (list # of students)
This commit is contained in:
parent
e07635f4d0
commit
b416a1c34f
@ -49,6 +49,42 @@ function get_responses_for_survey($surveyid) {
|
||||
}
|
||||
}
|
||||
|
||||
function print_all_responses($survey, $results) {
|
||||
|
||||
global $THEME;
|
||||
|
||||
echo "<TABLE CELLPADDING=5 CELLSPACING=2 ALIGN=CENTER>";
|
||||
echo "<TR><TD>Name<TD>Time<TD>Answered</TR>";
|
||||
|
||||
foreach ($results as $a) {
|
||||
|
||||
echo "<TR>";
|
||||
echo "<TD><A HREF=\"report.php?action=student&student=$a->id&id=$survey\">$a->firstname $a->lastname</A></TD>";
|
||||
echo "<TD>".userdate($a->time, "j M Y, h:i A")."</TD>";
|
||||
echo "<TD align=right>$a->numanswers</TD>";
|
||||
echo "</TR>";
|
||||
}
|
||||
echo "</TABLE>";
|
||||
}
|
||||
|
||||
|
||||
function get_survey_responses($survey) {
|
||||
return get_records_sql("SELECT a.time as time, count(*) as numanswers, u.*
|
||||
FROM survey_answers AS a, user AS u
|
||||
WHERE a.answer1 <> '0' AND a.answer2 <> '0'
|
||||
AND a.survey = $survey
|
||||
AND a.user = u.id
|
||||
GROUP BY a.user ORDER BY a.time ASC");
|
||||
}
|
||||
|
||||
function count_completed_surveys($survey) {
|
||||
if ($responses = get_survey_responses($survey)) {
|
||||
return count($responses);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_template_name($templateid) {
|
||||
global $db;
|
||||
|
@ -316,33 +316,4 @@
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/// FUNCTIONS //////////////////////////////////////////////////////////////
|
||||
|
||||
function print_all_responses($survey, $results) {
|
||||
|
||||
global $THEME;
|
||||
|
||||
echo "<TABLE CELLPADDING=5 CELLSPACING=2 ALIGN=CENTER>";
|
||||
echo "<TR><TD>Name<TD>Time<TD>Answered</TR>";
|
||||
|
||||
foreach ($results as $a) {
|
||||
|
||||
echo "<TR>";
|
||||
echo "<TD><A HREF=\"report.php?action=student&student=$a->id&id=$survey\">$a->firstname $a->lastname</A></TD>";
|
||||
echo "<TD>".userdate($a->time, "j M Y, h:i A")."</TD>";
|
||||
echo "<TD align=right>$a->numanswers</TD>";
|
||||
echo "</TR>";
|
||||
}
|
||||
echo "</TABLE>";
|
||||
}
|
||||
|
||||
|
||||
function get_survey_responses($survey) {
|
||||
return get_records_sql("SELECT a.time as time, count(*) as numanswers, u.*
|
||||
FROM survey_answers AS a, user AS u
|
||||
WHERE a.answer1 <> '0' AND a.answer2 <> '0'
|
||||
AND a.survey = $survey
|
||||
AND a.user = u.id
|
||||
GROUP BY a.user ORDER BY a.time ASC");
|
||||
}
|
||||
?>
|
||||
|
@ -35,6 +35,8 @@
|
||||
if (survey_already_done($survey->id, $USER->id)) {
|
||||
add_to_log($course->id, "survey", "view graph", "view.php?id=$cm->id", "$survey->id");
|
||||
print_heading("You've completed this survey. The graph below shows a summary of your results compared to the class averages.");
|
||||
$numusers = count_completed_surveys($survey->id);
|
||||
print_heading("$numusers people have completed the survey so far");
|
||||
echo "<CENTER>";
|
||||
echo "<IMG SRC=\"$CFG->wwwroot/mod/survey/graph.php?id=$cm->id&sid=$USER->id&type=student.png\">";
|
||||
echo "</CENTER>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user