Skip to content

Commit

Permalink
MDL-59032 scorm: Don't show action events to teachers
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Jun 6, 2017
1 parent 78ab4f7 commit 4c8deb9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mod/scorm/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions mod/scorm/tests/lib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public function test_scorm_core_calendar_provide_event_action_open() {
// 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();

Expand Down Expand Up @@ -261,6 +264,9 @@ public function test_scorm_core_calendar_provide_event_action_open_in_future() {
// 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();

Expand Down Expand Up @@ -289,6 +295,9 @@ public function test_scorm_core_calendar_provide_event_action_no_time_specified(
// 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();

Expand Down

0 comments on commit 4c8deb9

Please sign in to comment.