Permalink
Browse files

New function to show new surveys in recent activity box

  • Loading branch information...
1 parent a2b71b6 commit 54634efcbaebf4ade486224f2c6c6676056f5212 martin committed Sep 22, 2002
Showing with 31 additions and 0 deletions.
  1. +1 −0 lang/en/survey.php
  2. +30 −0 mod/survey/lib.php
View
@@ -21,6 +21,7 @@
$string['helpsurveys'] = "Help on the different types of surveys";
$string['introtext'] = "Introduction text";
$string['name'] = "Name";
+$string['newsurveyresponses'] = "New survey responses";
$string['nobodyyet'] = "Nobody has yet completed this survey";
$string['notdone'] = "Not done yet";
$string['notes'] = "Your private analysis and notes";
View
@@ -77,6 +77,36 @@ function survey_delete_instance($id) {
return $result;
}
+function survey_print_recent_activity(&$logs, $isteacher=false) {
+ global $CFG, $COURSE_TEACHER_COLOR;
+
+ $content = false;
+ $surveys = NULL;
+
+ foreach ($logs as $log) {
+ if ($log->module == "survey" and $log->action == "submit") {
+ $surveys[$log->id] = get_record_sql("SELECT s.name, u.firstname, u.lastname
+ FROM survey s, user u
+ WHERE s.id = '$log->info' AND e.user = u.id");
+ $surveys[$log->info]->time = $log->time;
+ $surveys[$log->info]->url = $log->url;
+ }
+ }
+
+ if ($surveys) {
+ $content = true;
+ print_headline(get_string("newsurveyresponses", "survey").":");
+ foreach ($surveys as $survey) {
+ $date = userdate($survey->time, "%e %b, %H:%M");
+ echo "<P><FONT SIZE=1>$date - $survey->firstname $survey->lastname<BR>";
+ echo "\"<A HREF=\"$CFG->wwwroot/mod/survey/$survey->url\">";
+ echo "$survey->name";
+ echo "</A>\"</FONT></P>";
+ }
+ }
+
+ return $content;
+}
function survey_already_done($survey, $user) {
return record_exists_sql("SELECT * FROM survey_answers WHERE survey='$survey' AND user='$user'");

0 comments on commit 54634ef

Please sign in to comment.