From a6379acaf3095e5c23b335f70ca50a06679409ff Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 6 Jun 2017 15:50:52 +0800 Subject: [PATCH] MDL-59032 scorm: Don't show action events to teachers --- mod/scorm/lib.php | 5 +++++ mod/scorm/tests/lib_test.php | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index c4a7c0f041a..d4bfce3f514 100644 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -1633,6 +1633,11 @@ function mod_scorm_core_calendar_provide_event_action(calendar_event $event, $cm = get_fast_modinfo($event->courseid)->instances['scorm'][$event->instance]; + if (has_capability('mod/scorm:viewreport', $cm->context)) { + // Teachers do not need to be reminded to complete a scorm. + return null; + } + if (!empty($cm->customdata['timeclose']) && $cm->customdata['timeclose'] < time()) { // The scorm has closed so the user can no longer submit anything. return null; diff --git a/mod/scorm/tests/lib_test.php b/mod/scorm/tests/lib_test.php index cd3382236e7..0fcc38ec408 100644 --- a/mod/scorm/tests/lib_test.php +++ b/mod/scorm/tests/lib_test.php @@ -207,6 +207,9 @@ class mod_scorm_lib_testcase extends externallib_advanced_testcase { // Create a calendar event. $event = $this->create_action_event($course->id, $scorm->id, SCORM_EVENT_TYPE_OPEN); + // Only students see scorm events. + $this->setUser($this->student); + // Create an action factory. $factory = new \core_calendar\action_factory(); @@ -261,6 +264,9 @@ class mod_scorm_lib_testcase extends externallib_advanced_testcase { // Create a calendar event. $event = $this->create_action_event($course->id, $scorm->id, SCORM_EVENT_TYPE_OPEN); + // Only students see scorm events. + $this->setUser($this->student); + // Create an action factory. $factory = new \core_calendar\action_factory(); @@ -289,6 +295,9 @@ class mod_scorm_lib_testcase extends externallib_advanced_testcase { // Create a calendar event. $event = $this->create_action_event($course->id, $scorm->id, SCORM_EVENT_TYPE_OPEN); + // Only students see scorm events. + $this->setUser($this->student); + // Create an action factory. $factory = new \core_calendar\action_factory();