Merge branch 'wip-mdl-40919' of https://github.com/rajeshtaneja/moodle
[moodle.git] / mod / survey / report.php
index cda5f20..5ff293e 100644 (file)
@@ -92,8 +92,6 @@
     $strseemoredetail = get_string("seemoredetail", "survey");
     $strnotes = get_string("notes", "survey");
 
-    add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id", $cm->id);
-
     switch ($action) {
         case 'download':
             $PAGE->navbar->add(get_string('downloadresults', 'survey'));
         $currentgroup = 0;
     }
 
+    $params = array(
+        'objectid' => $survey->id,
+        'context' => $context,
+        'courseid' => $course->id,
+        'relateduserid' => $student,
+        'other' => array('action' => $action, 'groupid' => $currentgroup)
+    );
+    $event = \mod_survey\event\report_viewed::create($params);
+    $event->trigger();
+
     if ($currentgroup) {
         $users = get_users_by_capability($context, 'mod/survey:participate', '', '', '', '', $currentgroup, null, false);
     } else if (!empty($cm->groupingid)) {