function CourseObjectAccessTiming::take in Course 7
Same name and namespace in other branches
- 6 plugins/course/access/timing.inc \CourseObjectAccessTiming::take()
- 7.2 plugins/course_object_access/timing.inc \CourseObjectAccessTiming::take()
Overrides CourseObjectAccess::take
1 call to CourseObjectAccessTiming::take()
- CourseObjectAccessTiming::view in plugins/
course_object_access/ timing.inc
File
- plugins/
course_object_access/ timing.inc, line 27
Class
Code
function take() {
$time = REQUEST_TIME;
if ($this
->getOption('duration')) {
if ($this
->getCourseObject()
->getFulfillment()
->getOption('date_started')) {
$duration_end = $this
->getCourseObject()
->getFulfillment()
->getOption('date_started') + $this
->getOption('duration');
if ($time > $duration_end) {
$duration_end_h = format_date($duration_end, 'long');
$this
->getCourseObject()
->setAccessMessage('duration-expired', t('Your enrollment in this activity expired on %date.', array(
'%date' => $duration_end_h,
)));
return FALSE;
}
}
}
$released = $this
->isReleased();
$expired = $this
->isExpired();
return $released && !$expired;
}