19 declare(strict_types=1);
36 private readonly
int $objectId,
37 private readonly
string $certificatePath,
43 if (null === $objectHelper) {
48 if (null === $utilHelper) {
64 $type = $this->objectHelper->lookupType($this->objectId);
65 $certificateId = $this->objectId;
67 $exportPath = $this->certificatePath . $time .
'__' . $installationId .
'__' . $type .
'__' . $certificateId .
'__certificate/';
71 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
73 $streams[
'certificate.xml'] = Streams::ofString(
74 $template->getCertificateContent()
77 $backgroundImagePath = $template->getBackgroundImagePath();
78 if ($backgroundImagePath !==
'' && $this->
filesystem->has($backgroundImagePath)) {
79 $streams[
'background.jpg'] = $this->
filesystem->readStream($backgroundImagePath);
82 $thumbnailImagePath = $template->getThumbnailImagePath();
83 if ($thumbnailImagePath !==
'' && $this->
filesystem->has($backgroundImagePath)) {
84 $streams[
'thumbnail.svg'] = $this->
filesystem->readStream($thumbnailImagePath);
87 $objectType = $this->objectHelper->lookupType($this->objectId);
89 $zipFileName = $time .
'__' . $installationId .
'__' . $objectType .
'__' . $this->objectId .
'__certificate.zip';
91 $this->utilHelper->zipAndDeliver($streams, $zipFileName);
readonly ilCertificateObjectHelper $objectHelper
export(string $rootDir=CLIENT_WEB_DIR, string $installationId=IL_INST_ID)
Creates a downloadable file via the browser.
Just a wrapper class to create Unit Test for other classes.
readonly ilCertificateUtilHelper $utilHelper
__construct(private readonly int $objectId, private readonly string $certificatePath, private readonly ilCertificateTemplateRepository $templateRepository, private readonly Filesystem $filesystem, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateUtilHelper $utilHelper=null)