You are here

public function LearningPathProgress::getHTML in Opigno Learning path 8

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

Returns a html of progress bar.

Parameters

object $group: Group entity.

object $account: User entity.

int $latest_cert_date: Latest certification date.

string $class: identifier for progress bar.

Return value

\Symfony\Component\HttpFoundation\Response The response object.

1 string reference to 'LearningPathProgress::getHTML'
opigno_learning_path.routing.yml in ./opigno_learning_path.routing.yml
opigno_learning_path.routing.yml

File

src/Controller/LearningPathProgress.php, line 59

Class

LearningPathProgress
Returns responses for ajax progress bar routes.

Namespace

Drupal\opigno_learning_path\Controller

Code

public function getHTML(Group $group, User $account, int $latest_cert_date, string $class) {
  $selector = '#progress-ajax-container-' . $group
    ->id() . '-' . $account
    ->id() . '-' . $latest_cert_date . '-' . $class;
  $content = $this->progressService
    ->getProgressBuild($group
    ->id(), $account
    ->id(), $latest_cert_date, $class);
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand($selector, $content));
  return $response;
}