You are here

protected function LearningPathController::build_step_state_cell in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/Controller/LearningPathController.php \Drupal\opigno_learning_path\Controller\LearningPathController::build_step_state_cell()

Returns step state cell.

2 calls to LearningPathController::build_step_state_cell()
LearningPathController::build_course_row in src/Controller/LearningPathController.php
Returns course row.
LearningPathController::trainingContent in src/Controller/LearningPathController.php
Returns training content.

File

src/Controller/LearningPathController.php, line 60

Class

LearningPathController
Class LearningPathController.

Namespace

Drupal\opigno_learning_path\Controller

Code

protected function build_step_state_cell($step) {
  $user = $this
    ->currentUser();
  $uid = $user
    ->id();
  $status = opigno_learning_path_get_step_status($step, $uid, TRUE);
  switch ($status) {
    case 'pending':
      $markup = '<span class="lp_step_state_pending"></span>' . $this
        ->t('Pending');
      break;
    case 'failed':
      $markup = '<span class="lp_step_state_failed"></span>' . $this
        ->t('Failed');
      break;
    case 'passed':
      $markup = '<span class="lp_step_state_passed"></span>' . $this
        ->t('Passed');
      break;
    default:
      $markup = '&dash;';
      break;
  }
  return [
    '#markup' => $markup,
  ];
}