You are here

private function LearningPathAchievementController::trainingStepMeetingBuild in Opigno Learning path 3.x

Prepare render array for Meeting step.

1 call to LearningPathAchievementController::trainingStepMeetingBuild()
LearningPathAchievementController::trainingStepContentBuild in src/Controller/LearningPathAchievementController.php
Prepares a render array of content.

File

src/Controller/LearningPathAchievementController.php, line 1291

Class

LearningPathAchievementController
Class LearningPathAchievementController.

Namespace

Drupal\opigno_learning_path\Controller

Code

private function trainingStepMeetingBuild($step, $group, $user, $latest_cert_date) {

  // If the user is not a member of the meeting.

  /** @var \Drupal\opigno_moxtra\Entity\Meeting $meeting */
  $meeting = \Drupal::entityTypeManager()
    ->getStorage('opigno_moxtra_meeting')
    ->load($step['id']);
  if (!$meeting instanceof Meeting) {
    return [];
  }
  if (!($valid_unix = strtotime($meeting
    ->getStartDate()))) {
    return [];
  }
  $date = $valid_unix ? $this->dateFormatter
    ->format($valid_unix, 'custom', 'm/d/Y') : '';
  return [
    '#theme' => 'opigno_learning_path_training_meeting',
    '#date' => $date,
    '#status' => $this
      ->mapStatusToTemplateClasses($step['status']),
    '#attended' => $step["attempted"] ? $this
      ->t('Yes') : $this
      ->t('No'),
    '#step' => $step,
    '#place' => $meeting
      ->toLink()
      ->toRenderable(),
    '#approved' => [
      'value' => $step["presence"],
      'percent' => $step["progress"],
    ],
  ];
}