From 6d5c6a378bee35b7a2245665e7e164ea726c829f Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Tue, 10 Jun 2014 10:15:50 +0300 Subject: [PATCH] New: Events in Moodle 2.7 --- version.php | 4 ++-- view.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/version.php b/version.php index b761ab0..88c30b1 100755 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ defined('MOODLE_INTERNAL') || die(); $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$module->version = 2014061002; // The current module version (Date: YYYYMMDDXX) +$module->version = 2014061003; // The current module version (Date: YYYYMMDDXX) $module->requires = 2010112400; // Requires Moodle 2.0 $module->cron = 0; // Period for cron to check this module (secs) -$module->release = '3.18.10.2'; +$module->release = '3.18.10.3'; diff --git a/view.php b/view.php index 4fd0bd5..f2785a3 100755 --- a/view.php +++ b/view.php @@ -46,9 +46,13 @@ $canattempt = true; } - /// Log this request. - add_to_log($course->id, 'game', 'view', "view.php?id=$cm->id", $game->id, $cm->id); + if( game_use_events()) + { + require( 'classes/event/course_module_viewed.php'); + \mod_game\event\course_module_viewed::viewed($game, $context)->trigger(); + }else + add_to_log($course->id, 'game', 'view', "view.php?id=$cm->id", $game->id, $cm->id); // Mark as viewed $completion=new completion_info($course);