MDL-40056 events: Replace old add_to_log calls with new events

This commit is contained in:
Ankit Agarwal 2014-01-07 14:10:20 +08:00
parent 25e8023d3d
commit 0a61619043
13 changed files with 80 additions and 18 deletions

View file

@ -43,7 +43,6 @@ class scorm_basic_report extends scorm_default_report {
if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
add_to_log($course->id, 'scorm', 'delete attempts', 'report.php?id=' . $cm->id, implode(",", $attemptids), $cm->id);
echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
}
}

View file

@ -44,7 +44,6 @@ class scorm_interactions_report extends scorm_default_report {
if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
if (scorm_delete_responses($attemptids, $scorm)) { //delete responses.
add_to_log($course->id, 'scorm', 'delete attempts', 'report.php?id=' . $cm->id, implode(",", $attemptids), $cm->id);
echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
}
}

View file

@ -50,7 +50,6 @@ class scorm_objectives_report extends scorm_default_report {
if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) {
if (scorm_delete_responses($attemptids, $scorm)) { // Delete responses.
add_to_log($course->id, 'scorm', 'delete attempts', 'report.php?id=' . $cm->id, implode(",", $attemptids), $cm->id);
echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess');
}
}

View file

@ -51,7 +51,15 @@ require_login($course, false, $cm);
$contextmodule = context_module::instance($cm->id);
require_capability('mod/scorm:viewreport', $contextmodule);
add_to_log($course->id, 'scorm', 'userreport', 'userreport.php?id='.$id, $scorm->id, $id);
// Trigger a user report viewed event.
$event = \mod_scorm\event\user_report_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
'other' => array('attemptid' => $attempt, 'instanceid' => $scorm->id)
));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('scorm', $scorm);
$event->trigger();
// Print the page header.
$strreport = get_string('report', 'scorm');

View file

@ -53,8 +53,15 @@ require_login($course, false, $cm);
$contextmodule = context_module::instance($cm->id);
require_capability('mod/scorm:viewreport', $contextmodule);
add_to_log($course->id, 'scorm', 'userreportinteractions', 'userreportinteractions.php?id='.$cm->id, $scorm->id, $cm->id);
// Trigger a user interactions viewed event.
$event = \mod_scorm\event\interactions_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
'other' => array('attemptid' => $attempt, 'instanceid' => $scorm->id)
));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('scorm', $scorm);
$event->trigger();
$trackdata = $DB->get_records('scorm_scoes_track', array('userid' => $user->id, 'scormid' => $scorm->id,
'attempt' => $attempt));

View file

@ -51,7 +51,15 @@ require_login($course, false, $cm);
$contextmodule = context_module::instance($cm->id);
require_capability('mod/scorm:viewreport', $contextmodule);
add_to_log($course->id, 'scorm', 'userreporttracks', 'userreporttracks.php?id='.$id, $scorm->id, $id);
// Trigger a tracks viewed event.
$event = \mod_scorm\event\tracks_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
'other' => array('attemptid' => $attempt, 'instanceid' => $scorm->id, 'scoid' => $scoid)
));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('scorm', $scorm);
$event->trigger();
// Print the page header.
$strreport = get_string('report', 'scorm');