Skip to content
Browse files

Added assignments under "Recent Activity"

  • Loading branch information...
1 parent 88491ca commit 3446205d447e7ccbb184ea2895fd95e25e872480 martin committed
Showing with 31 additions and 0 deletions.
  1. +1 −0 lang/en/assignment.php
  2. +30 −0 mod/assignment/lib.php
View
1 lang/en/assignment.php
@@ -17,6 +17,7 @@
$string['late'] = "\$a late";
$string['maximumgrade'] = "Maximum grade";
$string['maximumsize'] = "Maximum size";
+$string['newsubmissions'] = "Assignments submitted";
$string['notsubmittedyet'] = "Not submitted yet";
$string['overwritewarning'] = "Warning: uploading again will REPLACE your current submission";
$string['submissionfeedback'] = "Submission feedback";
View
30 mod/assignment/lib.php
@@ -186,6 +186,36 @@ function assignment_cron () {
return true;
}
+function assignment_print_recent_activity(&$logs, $isteacher=false) {
+ global $CFG, $COURSE_TEACHER_COLOR;
+
+ $content = false;
+ $assignments = NULL;
+
+ foreach ($logs as $log) {
+ if ($log->module == "assignment" and $log->action == "upload") {
+ $assignments[$log->info] = get_record_sql("SELECT a.name, u.firstname, u.lastname
+ FROM assignment a, user u
+ WHERE a.id = '$log->info' AND u.id = '$log->user'");
+ $assignments[$log->info]->time = $log->time;
+ $assignments[$log->info]->url = $log->url;
+ }
+ }
+
+ if ($assignments) {
+ $content = true;
+ print_headline(get_string("newsubmissions", "assignment").":");
+ foreach ($assignments as $assignment) {
+ $date = userdate($assignment->time, "%e %b, %H:%M");
+ echo "<P><FONT SIZE=1>$date - $assignment->firstname $assignment->lastname<BR>";
+ echo "\"<A HREF=\"$CFG->wwwroot/mod/assignment/$assignment->url\">";
+ echo "$assignment->name";
+ echo "</A>\"</FONT></P>";
+ }
+ }
+
+ return $content;
+}
//////////////////////////////////////////////////////////////////////////////////////

0 comments on commit 3446205

Please sign in to comment.
Something went wrong with that request. Please try again.