ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCertificateUserForObjectPreloader Class Reference
+ Collaboration diagram for ilCertificateUserForObjectPreloader:

Public Member Functions

 __construct (private readonly ilUserCertificateRepository $userCertificateRepository, private readonly ilCertificateActiveValidator $activeValidator)
 
 preLoadDownloadableCertificates (int $objectId)
 
 isPreloaded (int $objId, int $userId)
 

Static Private Attributes

static array $certificates = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateUserForObjectPreloader::__construct ( private readonly ilUserCertificateRepository  $userCertificateRepository,
private readonly ilCertificateActiveValidator  $activeValidator 
)

Definition at line 29 of file class.ilCertificateUserForObjectPreloader.php.

30  {
31  }

Member Function Documentation

◆ isPreloaded()

ilCertificateUserForObjectPreloader::isPreloaded ( int  $objId,
int  $userId 
)

Definition at line 41 of file class.ilCertificateUserForObjectPreloader.php.

41  : bool
42  {
43  if (!array_key_exists($objId, self::$certificates)) {
44  return false;
45  }
46 
47  return in_array($userId, self::$certificates[$objId], true);
48  }
$objId
Definition: xapitoken.php:57

◆ preLoadDownloadableCertificates()

ilCertificateUserForObjectPreloader::preLoadDownloadableCertificates ( int  $objectId)

Definition at line 33 of file class.ilCertificateUserForObjectPreloader.php.

33  : void
34  {
35  if ($this->activeValidator->validate()) {
36  $objectIdsWithUserCertificate = $this->userCertificateRepository->fetchUserIdsWithCertificateForObject($objectId);
37  self::$certificates[$objectId] = $objectIdsWithUserCertificate;
38  }
39  }

Field Documentation

◆ $certificates

array ilCertificateUserForObjectPreloader::$certificates = []
staticprivate

The documentation for this class was generated from the following file: