From 938c92ff7be2d29de203b5aef7067b7b51951c7b Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Tue, 29 Dec 2015 00:53:32 +0200 Subject: [PATCH] Fix:Coding style --- classes/event/course_module_instance_list_viewed.php | 9 ++++++++- lib.php | 8 ++++++++ locallib.php | 8 -------- version.php | 4 ++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/classes/event/course_module_instance_list_viewed.php b/classes/event/course_module_instance_list_viewed.php index 57fb2b9..578c210 100644 --- a/classes/event/course_module_instance_list_viewed.php +++ b/classes/event/course_module_instance_list_viewed.php @@ -36,5 +36,12 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { - // No code required here as the parent class handles it all. + public static function create_from_course(\stdClass $course) { + $params = array( + 'context' => \context_course::instance($course->id) + ); + $event = self::create( $params); + $event->add_record_snapshot('course', $course); + return $event; + } } diff --git a/lib.php b/lib.php index c7a6054..22eefcd 100755 --- a/lib.php +++ b/lib.php @@ -1219,3 +1219,11 @@ function game_get_context_module_instance( $moduleid) { return get_context_instance( CONTEXT_MODULE, $moduleid); } + +function game_get_context_course_instance( $courseid) { + if (class_exists( 'context_course')) { + return context_course::instance( $courseid); + } + + return get_context_instance( CONTEXT_COURSE, $courseid); +} diff --git a/locallib.php b/locallib.php index b37fc8c..3aad1f8 100755 --- a/locallib.php +++ b/locallib.php @@ -2117,14 +2117,6 @@ function game_strpos( $haystack, $needle, $offset = 0) { return textlib_get_instance()->strpos( $haystack, $needle, $offset); } -function game_get_context_course_instance( $courseid) { - if (class_exists( 'context_course')) { - return context_course::instance( $courseid); - } - - return get_context_instance( 50, $courseid); -} - function game_show_query( $game, $query, $text) { if ($game->glossaryid) { $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); diff --git a/version.php b/version.php index 843e0f8..55c4b1c 100755 --- a/version.php +++ b/version.php @@ -36,10 +36,10 @@ if (!isset( $plugin)) { } $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). -$plugin->version = 2015122501; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2015122901; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->cron = 0; // Period for cron to check this module (secs). -$plugin->release = '3.36.25.1'; +$plugin->release = '3.36.29.1'; if ($useplugin != 2) { $module = $plugin;