ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateTemplateExportAction Class Reference
+ Collaboration diagram for ilCertificateTemplateExportAction:

Public Member Functions

 __construct (int $objectId, string $certificatePath, ilCertificateTemplateRepository $templateRepository, Filesystem $filesystem, ilCertificateObjectHelper $objectHelper=null, ilCertificateUtilHelper $utilHelper=null)
 
 export ($rootDir=CLIENT_WEB_DIR, $installationId=IL_INST_ID)
 Creates an downloadable file via the browser. More...
 

Private Attributes

 $objectId
 
 $certificatePath
 
 $templateRepository
 
 $filesystem
 
 $objectHelper
 
 $utilHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateTemplateExportAction::__construct ( int  $objectId,
string  $certificatePath,
ilCertificateTemplateRepository  $templateRepository,
Filesystem  $filesystem,
ilCertificateObjectHelper  $objectHelper = null,
ilCertificateUtilHelper  $utilHelper = null 
)
Parameters
integer$objectId
string$certificatePath
ilCertificateTemplateRepository$templateRepository
Filesystem$filesystem
ilCertificateObjectHelper | null$objectHelper
ilCertificateUtilHelper | null$utilHelper

Definition at line 49 of file class.ilCertificateTemplateExportAction.php.

References $certificatePath, $filesystem, $objectHelper, $objectId, $templateRepository, and $utilHelper.

Member Function Documentation

◆ export()

ilCertificateTemplateExportAction::export (   $rootDir = CLIENT_WEB_DIR,
  $installationId = IL_INST_ID 
)

Creates an downloadable file via the browser.

Parameters
string$rootDir
string$installationId
Exceptions

ILIAS\Filesystem\Exception\FileAlreadyExistsException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

Definition at line 81 of file class.ilCertificateTemplateExportAction.php.

82 {
83 $time = time();
84
85 $type = $this->objectHelper->lookupType($this->objectId);
86 $certificateId = $this->objectId;
87
88 $exportPath = $this->certificatePath . $time . '__' . $installationId . '__' . $type . '__' . $certificateId . '__certificate/';
89
90 $this->filesystem->createDir($exportPath, \ILIAS\Filesystem\Visibility::PUBLIC_ACCESS);
91
92 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
93
94 $xslContent = $template->getCertificateContent();
95
96 $this->filesystem->put($exportPath . 'certificate.xml', $xslContent);
97
98 $backgroundImagePath = $template->getBackgroundImagePath();
99 if ($backgroundImagePath !== '') {
100 if (true === $this->filesystem->has($backgroundImagePath)) {
101 $this->filesystem->copy($backgroundImagePath, $exportPath . 'background.jpg');
102 }
103 }
104
105 $thumbnailImagePath = $template->getThumbnailImagePath();
106 if ($thumbnailImagePath !== '') {
107 if (true === $this->filesystem->has($backgroundImagePath)) {
108 $this->filesystem->copy($thumbnailImagePath, $exportPath . 'thumbnail.svg');
109 }
110 }
111
112 $objectType = $this->objectHelper->lookupType($this->objectId);
113
114 $zipFileName = $time . '__' . $installationId . '__' . $objectType . '__' . $this->objectId . '__certificate.zip';
115
116
117 $zipPath = $rootDir . $this->certificatePath . $zipFileName;
118 $this->utilHelper->zip($exportPath, $zipPath);
119 $this->filesystem->deleteDir($exportPath);
120
121 $this->utilHelper->deliverFile($zipPath, $zipFileName, 'application/zip');
122 }
$template
$time
Definition: cron.php:21
Class FlySystemFileAccessTest.
Class BaseForm.
$type

References $objectId, $template, $time, and $type.

Field Documentation

◆ $certificatePath

ilCertificateTemplateExportAction::$certificatePath
private

Definition at line 19 of file class.ilCertificateTemplateExportAction.php.

Referenced by __construct().

◆ $filesystem

ilCertificateTemplateExportAction::$filesystem
private

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

Referenced by __construct().

◆ $objectHelper

ilCertificateTemplateExportAction::$objectHelper
private

Definition at line 34 of file class.ilCertificateTemplateExportAction.php.

Referenced by __construct().

◆ $objectId

ilCertificateTemplateExportAction::$objectId
private

Definition at line 14 of file class.ilCertificateTemplateExportAction.php.

Referenced by __construct(), and export().

◆ $templateRepository

ilCertificateTemplateExportAction::$templateRepository
private

Definition at line 24 of file class.ilCertificateTemplateExportAction.php.

Referenced by __construct().

◆ $utilHelper

ilCertificateTemplateExportAction::$utilHelper
private

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

Referenced by __construct().


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