MDL-34795 completion: Add course_completed event
authorAaron Barnes <aaronb@catalyst.net.nz>
Fri, 10 Aug 2012 04:05:35 +0000 (16:05 +1200)
committerAaron Barnes <aaronb@catalyst.net.nz>
Fri, 10 Aug 2012 04:06:11 +0000 (16:06 +1200)
completion/completion_completion.php

index e8e8019..dab34d8 100644 (file)
@@ -158,7 +158,11 @@ class completion_completion extends data_object {
         $this->timecompleted = $timecomplete;
 
         // Save record
         $this->timecompleted = $timecomplete;
 
         // Save record
-        return $this->_save();
+        if ($result = $this->_save()) {
+            events_trigger('course_completed', $this->get_record_data());
+        }
+
+        return $result;
     }
 
     /**
     }
 
     /**