ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCachedCertificateTemplateRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
29 protected static array $crs_certificates_without_lp = [];
30
31 public function __construct(private readonly ilCertificateTemplateRepository $wrapped)
32 {
33 }
34
35 public function save(ilCertificateTemplate $certificateTemplate): void
36 {
37 $this->wrapped->save($certificateTemplate);
38 }
39
40 public function updateActivity(ilCertificateTemplate $certificateTemplate, bool $currentlyActive): int
41 {
42 return $this->wrapped->updateActivity($certificateTemplate, $currentlyActive);
43 }
44
45 public function fetchTemplate(int $templateId): ilCertificateTemplate
46 {
47 return $this->wrapped->fetchTemplate($templateId);
48 }
49
50 public function fetchCertificateTemplatesByObjId(int $objId): array
51 {
52 return $this->wrapped->fetchCertificateTemplatesByObjId($objId);
53 }
54
56 {
57 return $this->wrapped->fetchCurrentlyUsedCertificate($objId);
58 }
59
61 {
62 return $this->wrapped->fetchCurrentlyActiveCertificate($objId);
63 }
64
66 {
67 return $this->wrapped->fetchPreviousCertificate($objId);
68 }
69
70 public function deleteTemplate(int $templateId, int $objectId): void
71 {
72 $this->wrapped->deleteTemplate($templateId, $objectId);
73 }
74
76 {
77 return $this->wrapped->activatePreviousCertificate($objId);
78 }
79
81 bool $isGlobalLpEnabled,
82 ?int $forRefId = null
83 ): array {
84 $cache_key = (int) $isGlobalLpEnabled . '_' . (int) $forRefId;
85
86 if (!array_key_exists($cache_key, self::$crs_certificates_without_lp)) {
87 self::$crs_certificates_without_lp[$cache_key] =
88 $this->wrapped->fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(
89 $isGlobalLpEnabled,
90 $forRefId
91 );
92 }
93
94 return self::$crs_certificates_without_lp[$cache_key];
95 }
96
98 {
99 return $this->wrapped->fetchFirstCreatedTemplate($objId);
100 }
101}
A certicate template repository which caches results of query commands List of cached results (other ...
__construct(private readonly ilCertificateTemplateRepository $wrapped)
fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(bool $isGlobalLpEnabled, ?int $forRefId=null)
updateActivity(ilCertificateTemplate $certificateTemplate, bool $currentlyActive)
$objId
Definition: xapitoken.php:57