Merge branch 'master_MDL-34544' of git://github.com/danmarsden/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 11 Sep 2012 19:33:06 +0000 (21:33 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 11 Sep 2012 19:33:06 +0000 (21:33 +0200)
mod/assign/db/events.php
mod/assign/locallib.php

index 24446f8..edd84cb 100644 (file)
 
 $handlers = array();
 
-/* List of events thrown from assignment module
+/* List of events generated by the assign module, with the fields on the event object.
 
-assignment_finalize_sent - object course, object user, object cm, object assignment, fileareaname
-assignment_file_sent     - object course, object user, object cm, object assignment, object file
+assessable_content_uploaded
+    ->modulename     = 'assign';
+    ->cmid           = // The cmid of the assign.
+    ->itemid         = // The submission id of the user submission.
+    ->courseid       = // The course id of the course the assign belongs to.
+    ->userid         = // The user id that the attempt belongs to.
+    ->content        = // The text content entered by the user (empty if no content submitted)
+    ->pathnamehashes = // An array of pathnamehashes of the files submitted by the user (var not passed if not set).
 
+assessable_file_uploaded
+    ->modulename     = 'assign';
+    ->cmid           = // The cmid of the assign.
+    ->itemid         = // The submission id of the user submission.
+    ->courseid       = // The course id of the course the assign belongs to.
+    ->userid         = // The user id that the attempt belongs to.
+    ->pathnamehashes = // An array of pathnamehashes of the files submitted by the user (var not passed if not set).
+
+assessable_content_done
+    ->modulename     = 'assign';
+    ->cmid           = // The cmid of the assign.
+    ->itemid         = // The submission id of the user submission.
+    ->courseid       = // The course id of the course the assign belongs to.
+    ->userid         = // The user id that the attempt belongs to.
 */
index 7aa5446..2d59aa1 100644 (file)
@@ -3323,6 +3323,14 @@ class assign {
                 $this->add_to_log('submit for grading', $this->format_submission_for_log($submission));
                 $this->notify_graders($submission);
                 $this->notify_student_submission_receipt($submission);
+                // Trigger assessable_content_done event to show completion
+                $eventdata = new stdClass();
+                $eventdata->modulename   = 'assign';
+                $eventdata->cmid         = $this->get_course_module()->id;
+                $eventdata->itemid       = $submission->id;
+                $eventdata->courseid     = $this->get_course()->id;
+                $eventdata->userid       = $USER->id;
+                events_trigger('assessable_content_done', $eventdata);
             }
         }
         return true;