ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCertificateTemplateExportAction Class Reference
+ Collaboration diagram for ilCertificateTemplateExportAction:

Public Member Functions

 __construct (private readonly int $objectId, private readonly string $certificatePath, private readonly ilCertificateTemplateRepository $templateRepository, private readonly IRSS $irss, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateUtilHelper $utilHelper=null)
 
 export (string $rootDir=CLIENT_WEB_DIR, string $installationId=IL_INST_ID)
 Creates a downloadable file via the browser. More...
 

Private Attributes

readonly ilCertificateObjectHelper $objectHelper
 
readonly ilCertificateUtilHelper $utilHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateTemplateExportAction::__construct ( private readonly int  $objectId,
private readonly string  $certificatePath,
private readonly ilCertificateTemplateRepository  $templateRepository,
private readonly IRSS  $irss,
?ilCertificateObjectHelper  $objectHelper = null,
?ilCertificateUtilHelper  $utilHelper = null 
)

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

References $objectHelper, $utilHelper, and null.

43  {
44  if (null === $objectHelper) {
46  }
47  $this->objectHelper = $objectHelper;
48 
49  if (null === $utilHelper) {
51  }
52  $this->utilHelper = $utilHelper;
53  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Member Function Documentation

◆ export()

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

Creates a downloadable file via the browser.

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

58  : void
59  {
60  $time = time();
61 
62  $type = $this->objectHelper->lookupType($this->objectId);
63  $certificateId = $this->objectId;
64 
65  $exportPath = $this->certificatePath . $time . '__' . $installationId . '__' . $type . '__' . $certificateId . '__certificate/';
66 
67  $streams = [];
68 
69  $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
70 
71  $streams['certificate.xml'] = Streams::ofString(
72  $template->getCertificateContent()
73  );
74 
75  $background_rid = $this->irss->manage()->find($template->getBackgroundImageIdentification());
76  if ($background_rid instanceof ResourceIdentification) {
77  $streams['background.jpg'] = $this->irss->consume()->stream($background_rid)->getStream();
78  }
79 
80  $tile_image_rid = $this->irss->manage()->find($template->getTileImageIdentification());
81  if ($tile_image_rid instanceof ResourceIdentification) {
82  $streams['tile_image.svg'] = $this->irss->consume()->stream($tile_image_rid)->getStream();
83  }
84 
85  $objectType = $this->objectHelper->lookupType($this->objectId);
86 
87  $zipFileName = $time . '__' . $installationId . '__' . $objectType . '__' . $this->objectId . '__certificate.zip';
88 
89  $this->utilHelper->zipAndDeliver($streams, $zipFileName);
90  }

Field Documentation

◆ $objectHelper

readonly ilCertificateObjectHelper ilCertificateTemplateExportAction::$objectHelper
private

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

Referenced by __construct().

◆ $utilHelper

readonly ilCertificateUtilHelper ilCertificateTemplateExportAction::$utilHelper
private

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

Referenced by __construct().


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