ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCertificateDownloadValidator.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
31 
32  public function __construct(
33  ?ilCertificateUserCertificateAccessValidator $userCertificateAccessValidator = null,
34  ?ilCertificateActiveValidator $activeValidator = null
35  ) {
36  if (null === $userCertificateAccessValidator) {
37  $userCertificateAccessValidator = new ilCertificateUserCertificateAccessValidator();
38  }
39  $this->userCertificateAccessValidator = $userCertificateAccessValidator;
40 
41  if (null === $activeValidator) {
42  $activeValidator = new ilCertificateActiveValidator();
43  }
44  $this->activeValidator = $activeValidator;
45  }
46 
47  public function isCertificateDownloadable(int $userId, int $objId): bool
48  {
49  if (!$this->activeValidator->validate()) {
50  return false;
51  }
52 
53  return $this->userCertificateAccessValidator->validate($userId, $objId);
54  }
55 }
$objId
Definition: xapitoken.php:57
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(?ilCertificateUserCertificateAccessValidator $userCertificateAccessValidator=null, ?ilCertificateActiveValidator $activeValidator=null)
Validates if an active certificate is stored in the database and can be downloaded by the user...
readonly ilCertificateUserCertificateAccessValidator $userCertificateAccessValidator
readonly ilCertificateActiveValidator $activeValidator