mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
New function to show new surveys in recent activity box
This commit is contained in:
parent
a2b71b6d71
commit
54634efcba
2 changed files with 31 additions and 0 deletions
|
@ -21,6 +21,7 @@ $string['editingasurvey'] = "Editing a survey";
|
|||
$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";
|
||||
|
|
|
@ -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'");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue