You are here

function CourseObjectAccessGrade::take in Course 6

Same name and namespace in other branches
  1. 7.2 plugins/course_object_access/grade.inc \CourseObjectAccessGrade::take()
  2. 7 plugins/course_object_access/grade.inc \CourseObjectAccessGrade::take()

Overrides CourseObjectAccess::take

2 calls to CourseObjectAccessGrade::take()
CourseObjectAccessGrade::see in plugins/course/access/grade.inc
CourseObjectAccessGrade::view in plugins/course/access/grade.inc

File

plugins/course/access/grade.inc, line 24

Class

CourseObjectAccessGrade

Code

function take() {
  $config = $this
    ->getOptions();
  if ($this
    ->getCourseObject()
    ->getCourse()
    ->getTracker()
    ->getOption('grade_result') >= $config['course_grade']) {
    return TRUE;
  }
  else {
    $this
      ->getCourseObject()
      ->setAccessMessage('grade', t('You must have a grade of at least @grade% to take this activity.', array(
      '@grade' => $this
        ->getOption('course_grade'),
    )));
    return FALSE;
  }
}