81 public function export($rootDir = CLIENT_WEB_DIR, $installationId = IL_INST_ID)
85 $type = $this->objectHelper->lookupType($this->objectId);
88 $exportPath = $this->certificatePath .
$time .
'__' . $installationId .
'__' .
$type .
'__' . $certificateId .
'__certificate/';
90 $this->filesystem->createDir($exportPath, \
ILIAS\
Filesystem\Visibility::PUBLIC_ACCESS);
92 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
94 $xslContent =
$template->getCertificateContent();
96 $this->filesystem->put($exportPath .
'certificate.xml', $xslContent);
98 $backgroundImagePath =
$template->getBackgroundImagePath();
99 if ($backgroundImagePath !==
'') {
100 if (
true === $this->filesystem->has($backgroundImagePath)) {
101 $this->filesystem->copy($backgroundImagePath, $exportPath .
'background.jpg');
105 $thumbnailImagePath =
$template->getThumbnailImagePath();
106 if ($thumbnailImagePath !==
'') {
107 if (
true === $this->filesystem->has($backgroundImagePath)) {
108 $this->filesystem->copy($thumbnailImagePath, $exportPath .
'thumbnail.svg');
112 $objectType = $this->objectHelper->lookupType($this->objectId);
114 $zipFileName =
$time .
'__' . $installationId .
'__' . $objectType .
'__' . $this->objectId .
'__certificate.zip';
117 $zipPath = $rootDir . $this->certificatePath . $zipFileName;
118 $this->utilHelper->zip($exportPath, $zipPath);
119 $this->filesystem->deleteDir($exportPath);
121 $this->utilHelper->deliverFile($zipPath, $zipFileName,
'application/zip');
export($rootDir=CLIENT_WEB_DIR, $installationId=IL_INST_ID)
Creates an downloadable file via the browser.
Just a wrapper class to create Unit Test for other classes.
__construct(int $objectId, string $certificatePath, ilCertificateTemplateRepository $templateRepository, Filesystem $filesystem, ilCertificateObjectHelper $objectHelper=null, ilCertificateUtilHelper $utilHelper=null)
Class FlySystemFileAccessTest.