function Course::is_completed

6.x Course.php Course::is_completed()
7.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 981

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(variable_get_for_school("retake_grades", 'F,W,I', $this->school_id));
  $enrolled_grades = csv_to_array(variable_get_for_school("enrolled_grades", 'E', $this->school_id));

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

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

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

  return true;

}