You are here

function opigno_learning_path_get_step_status in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x opigno_learning_path.module \opigno_learning_path_get_step_status()

Returns step status.

7 calls to opigno_learning_path_get_step_status()
LearningPathAchievementController::build_lp_steps in src/Controller/LearningPathAchievementController.php
Returns LP steps.
LearningPathAchievementController::build_step_state in src/Controller/LearningPathAchievementController.php
Returns step state renderable array.
LearningPathAchievementController::build_training_timeline in src/Controller/LearningPathAchievementController.php
Returns training timeline.
LearningPathAchievementController::course_steps_passed in src/Controller/LearningPathAchievementController.php
Returns course passed steps.
LearningPathController::build_step_state_cell in src/Controller/LearningPathController.php
Returns step state cell.

... See full list

File

./opigno_learning_path.module, line 3156
Contains opigno_learning_path.module.

Code

function opigno_learning_path_get_step_status($step, $uid, $step_state_counting = FALSE, $latest_cert_date = NULL) {
  $progress = opigno_learning_path_get_step_progress($step, $uid, $step_state_counting, $latest_cert_date);
  if (isset($step['passed']) && $step['passed'] == TRUE) {
    return 'passed';
  }
  elseif ($progress < 1) {
    return 'pending';
  }
  else {
    $score = $step['best score'];
    $min_score = $step['required score'];
    return $score < $min_score ? 'failed' : 'passed';
  }
}