* Is the event visible?
*
* This is used to determine global visibility of an event in all places throughout Moodle. For example,
- * the ASSIGN_EVENT_TYPE_GRADINGDUE event will not be shown to students on their calendar, and
- * ASSIGN_EVENT_TYPE_DUE events will not be shown to teachers.
+ * the ASSIGN_EVENT_TYPE_GRADINGDUE event will not be shown to students on their calendar.
*
* @param calendar_event $event
* @return bool Returns true if the event is visible to the current user, false otherwise.
if ($event->eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE) {
return $assign->can_grade();
} else {
- return !$assign->can_grade() && $assign->can_view_submission($USER->id);
+ return true;
}
}
$this->setAdminUser();
$courses = $DB->get_records('course', array('id' => $this->course->id));
// Past assignments should not show up.
- $pastassign = $this->create_instance(array('duedate' => time(),
+ $pastassign = $this->create_instance(array('duedate' => time() - 370001,
'cutoffdate' => time() - 370000,
'nosubmissions' => 0,
'assignsubmission_onlinetext_enabled' => 1));
// Set the user to a teacher.
$this->setUser($this->editingteachers[0]);
- // The teacher should not care about the due date event.
- $this->assertFalse(mod_assign_core_calendar_is_event_visible($event));
+ // The teacher should see the due date event.
+ $this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
}
public function test_assign_core_calendar_is_event_visible_duedate_event_as_student() {