ILIAS  release_8 Revision v8.24
ilCertificateUserForObjectPreloader Class Reference
+ Collaboration diagram for ilCertificateUserForObjectPreloader:

Public Member Functions

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

Private Attributes

ilUserCertificateRepository $userCertificateRepository
 
ilCertificateActiveValidator $activeValidator
 

Static Private Attributes

static array $certificates = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

34 {
35 $this->userCertificateRepository = $userCertificateRepository;
36 $this->activeValidator = $activeValidator;
37 }

References $activeValidator, and $userCertificateRepository.

Member Function Documentation

◆ isPreloaded()

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

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

47 : bool
48 {
49 if (false === array_key_exists($objId, self::$certificates)) {
50 return false;
51 }
52
53 if (true === in_array($userId, self::$certificates[$objId], true)) {
54 return true;
55 }
56
57 return false;
58 }
$objId
Definition: xapitoken.php:57

References $objId.

◆ preLoadDownloadableCertificates()

ilCertificateUserForObjectPreloader::preLoadDownloadableCertificates ( int  $objectId)

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

39 : void
40 {
41 if (true === $this->activeValidator->validate()) {
42 $objectIdsWithUserCertificate = $this->userCertificateRepository->fetchUserIdsWithCertificateForObject($objectId);
43 self::$certificates[$objectId] = $objectIdsWithUserCertificate;
44 }
45 }

Field Documentation

◆ $activeValidator

ilCertificateActiveValidator ilCertificateUserForObjectPreloader::$activeValidator
private

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

Referenced by __construct().

◆ $certificates

array ilCertificateUserForObjectPreloader::$certificates = []
staticprivate

◆ $userCertificateRepository

ilUserCertificateRepository ilCertificateUserForObjectPreloader::$userCertificateRepository
private

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

Referenced by __construct().


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