diff --git a/mod/lti/classes/event/course_module_instance_list_viewed.php b/mod/lti/classes/event/course_module_instance_list_viewed.php new file mode 100644 index 00000000000..4f843eba5b1 --- /dev/null +++ b/mod/lti/classes/event/course_module_instance_list_viewed.php @@ -0,0 +1,31 @@ +. + +/** + * The mod_lti instance list viewed event. + * + * @package mod_lti + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_lti\event; + +defined('MOODLE_INTERNAL') || die(); + +class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { + // No need for any code here as everything is handled by the parent class. +} diff --git a/mod/lti/classes/event/course_module_viewed.php b/mod/lti/classes/event/course_module_viewed.php new file mode 100644 index 00000000000..8d8ed19ee95 --- /dev/null +++ b/mod/lti/classes/event/course_module_viewed.php @@ -0,0 +1,39 @@ +. + +/** + * The mod_lti course module viewed event. + * + * @package mod_lti + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_lti\event; + +defined('MOODLE_INTERNAL') || die(); + +class course_module_viewed extends \core\event\course_module_viewed { + + /** + * Init method. + */ + protected function init() { + $this->data['objecttable'] = 'lti'; + $this->data['crud'] = 'r'; + $this->data['level'] = self::LEVEL_PARTICIPATING; + } +} diff --git a/mod/lti/index.php b/mod/lti/index.php index dc564468483..65b9ad7e9f0 100644 --- a/mod/lti/index.php +++ b/mod/lti/index.php @@ -56,7 +56,11 @@ $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); require_login($course); $PAGE->set_pagelayout('incourse'); -add_to_log($course->id, "lti", "view all", "index.php?id=$course->id", ""); +$params = array( + 'context' => context_course::instance($course->id) +); +$event = \mod_lti\event\course_module_instance_list_viewed::create($params); +$event->trigger(); $PAGE->set_url('/mod/lti/index.php', array('id' => $course->id)); $pagetitle = strip_tags($course->shortname.': '.get_string("modulenamepluralformatted", "lti")); diff --git a/mod/lti/launch.php b/mod/lti/launch.php index fced3b41170..de31c7a098b 100644 --- a/mod/lti/launch.php +++ b/mod/lti/launch.php @@ -59,8 +59,6 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST) require_login($course); -add_to_log($course->id, "lti", "launch", "launch.php?id=$cm->id", "$lti->id"); - $lti->cmid = $cm->id; lti_view($lti); diff --git a/mod/lti/view.php b/mod/lti/view.php index 6735bcd0dc1..b4a80d9c507 100644 --- a/mod/lti/view.php +++ b/mod/lti/view.php @@ -96,7 +96,13 @@ require_login($course); $completion = new completion_info($course); $completion->set_module_viewed($cm); -add_to_log($course->id, "lti", "view", "view.php?id=$cm->id", "$lti->id"); +$params = array( + 'context' => $context, + 'objectid' => $lti->id +); +$event = \mod_lti\event\course_module_viewed::create($params); +$event->add_record_snapshot('lti', $lti); +$event->trigger(); $pagetitle = strip_tags($course->shortname.': '.format_string($lti->name)); $PAGE->set_title($pagetitle);