class LearningPathProgress in Opigno Learning path 3.x
Same name and namespace in other branches
- 8 src/Controller/LearningPathProgress.php \Drupal\opigno_learning_path\Controller\LearningPathProgress
Returns responses for ajax progress bar routes.
Hierarchy
- class \Drupal\opigno_learning_path\Controller\LearningPathProgress implements ContainerInjectionInterface
Expanded class hierarchy of LearningPathProgress
File
- src/
Controller/ LearningPathProgress.php, line 16
Namespace
Drupal\opigno_learning_path\ControllerView source
class LearningPathProgress implements ContainerInjectionInterface {
/**
* The progress bar generator service.
*
* @var \Drupal\opigno_learning_path\Progress
*/
protected $progressService;
/**
* Constructs a new LearningPathProgress object.
*
* @param Drupal\opigno_learning_path\Progres $progress_service
* The progress bar service.
*/
public function __construct(Progress $progress_service) {
$this->progressService = $progress_service;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('opigno_learning_path.progress'));
}
/**
* Returns a html of progress bar.
*
* @param object $group
* Group entity.
* @param object $account
* User entity.
* @param int $latest_cert_date
* Latest certification date.
* @param string $class
* identifier for progress bar.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response object.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LearningPathProgress:: |
protected | property | The progress bar generator service. | |
LearningPathProgress:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
LearningPathProgress:: |
public | function | Returns a html of progress bar. | |
LearningPathProgress:: |
public | function | Constructs a new LearningPathProgress object. |