_Course::is_completed

5.x _Course.php _Course::is_completed()
4.x _Course.php _Course::is_completed()

Returns TRUE if the student has completed the course (and did not make a failing grade on it).

Return value

bool

File

classes/_Course.php, line 429

Class

_Course

Code

function is_completed() {
  // returns true if the course has been completed.
  $grade = $this->grade;

  // Get these grade definitions from our system settings
  // Configure them in custom/settings.php
  $retake_grades = csv_to_array($GLOBALS["fp_system_settings"]["retake_grades"]);
  $enrolled_grades = csv_to_array($GLOBALS["fp_system_settings"]["enrolled_grades"]);

  if ($grade == "") {
    return false;
  }

  if (in_array($grade, $enrolled_grades)) {
    return false;
  }

  if (in_array($grade, $retake_grades)) {
    return false;
  }

  return true;

}