ILIAS  release_8 Revision v8.24
ilCertificateGUI Class Reference

GUI class to create PDF certificates. More...

+ Collaboration diagram for ilCertificateGUI:

Public Member Functions

 __construct (ilCertificatePlaceholderDescription $placeholderDescriptionObject, ilCertificatePlaceholderValues $placeholderValuesObject, int $objectId, string $certificatePath, ?ilCertificateFormRepository $settingsFormFactory=null, ?ilCertificateDeleteAction $deleteAction=null, ?ilCertificateTemplateRepository $templateRepository=null, ?ilPageFormats $pageFormats=null, ?ilXlsFoParser $xlsFoParser=null, ?ilCertificateTemplateExportAction $exportAction=null, ?ilCertificateBackgroundImageUpload $upload=null, ?ilCertificateTemplatePreviewAction $previewAction=null, ?FileUpload $fileUpload=null, ?ilSetting $settings=null, ?ilCertificateBackgroundImageDelete $backgroundImageDelete=null, ?Filesystem $fileSystem=null, ?ilCertificateBackgroundImageFileService $imageFileService=null, ?Filesystem $tmp_file_system=null)
 
 executeCommand ()
 
 getCommand ($cmd)
 
 certificateImport ()
 
 certificatePreview ()
 
 certificateExportFO ()
 Exports the certificate. More...
 
 certificateRemoveBackground ()
 
 certificateDelete ()
 
 certificateDeleteConfirm ()
 Deletes the certificate and all its data. More...
 
 certificateSave ()
 Saves the certificate. More...
 
 certificateUpload ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ilTree $tree
 
ILIAS $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
int $ref_id
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 

Private Member Functions

 getEditorForm ()
 
 setTemplateContent (ilCertificateTemplate $certificate, ilPropertyFormGUI $form)
 
 createFormatArray (ilCertificateTemplate $certificateTemplate)
 

Private Attributes

ilCertificateBackgroundImageDelete $backgroundImageDelete
 
Filesystem $fileSystem
 
WrapperFactory $httpWrapper
 
Factory $refinery
 
ilCertificateTemplateRepository $templateRepository
 
ilCertificatePlaceholderDescription $placeholderDescriptionObject
 
int $objectId
 
ilCertificateFormRepository $settingsFormFactory
 
ilXlsFoParser $xlsFoParser
 
ilCertificateDeleteAction $deleteAction
 
ilCertificateTemplateExportAction $exportAction
 
ilCertificateBackgroundImageUpload $backgroundImageUpload
 
ilCertificateTemplatePreviewAction $previewAction
 
FileUpload $fileUpload
 
string $certificatePath
 
ilSetting $settings
 
ilPageFormats $pageFormats
 
Filesystem $tmp_file_system
 
ilLogger $logger
 
ilObjCertificateSettings $global_certificate_settings
 

Detailed Description

GUI class to create PDF certificates.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

@ilCtrl_Calls ilCertificateGUI: ilPropertyFormGUI

Definition at line 38 of file class.ilCertificateGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCertificateGUI::__construct ( ilCertificatePlaceholderDescription  $placeholderDescriptionObject,
ilCertificatePlaceholderValues  $placeholderValuesObject,
int  $objectId,
string  $certificatePath,
?ilCertificateFormRepository  $settingsFormFactory = null,
?ilCertificateDeleteAction  $deleteAction = null,
?ilCertificateTemplateRepository  $templateRepository = null,
?ilPageFormats  $pageFormats = null,
?ilXlsFoParser  $xlsFoParser = null,
?ilCertificateTemplateExportAction  $exportAction = null,
?ilCertificateBackgroundImageUpload  $upload = null,
?ilCertificateTemplatePreviewAction  $previewAction = null,
?FileUpload  $fileUpload = null,
?ilSetting  $settings = null,
?ilCertificateBackgroundImageDelete  $backgroundImageDelete = null,
?Filesystem  $fileSystem = null,
?ilCertificateBackgroundImageFileService  $imageFileService = null,
?Filesystem  $tmp_file_system = null 
)

Definition at line 69 of file class.ilCertificateGUI.php.

88 {
89 global $DIC;
90 $this->httpWrapper = $DIC->http()->wrapper();
91 $this->refinery = $DIC->refinery();
92 $this->lng = $DIC['lng'];
93 $this->tpl = $DIC['tpl'];
94 $this->ctrl = $DIC['ilCtrl'];
95 $this->ilias = $DIC['ilias'];
96
97 $this->tree = $DIC['tree'];
98 $this->access = $DIC['ilAccess'];
99 $this->toolbar = $DIC['ilToolbar'];
100
101 $this->global_certificate_settings = new ilObjCertificateSettings();
102
103 $this->lng->loadLanguageModule('certificate');
104 $this->lng->loadLanguageModule('cert');
105 $this->lng->loadLanguageModule("trac");
106
107 $this->ref_id = (int) $DIC->http()->wrapper()->query()->retrieve("ref_id", $DIC->refinery()->kindlyTo()->int());
108
109 $this->placeholderDescriptionObject = $placeholderDescriptionObject;
110
111 $this->objectId = $objectId;
112
113 $this->logger = $DIC->logger()->cert();
114
115 if (null === $settingsFormFactory) {
117 $this->objectId,
119 $this->lng,
120 $this->tpl,
121 $this->ctrl,
122 $this->access,
123 $this->toolbar,
124 $placeholderDescriptionObject
125 );
126 }
127 $this->settingsFormFactory = $settingsFormFactory;
128
129 if (null === $templateRepository) {
130 $templateRepository = new ilCertificateTemplateDatabaseRepository($DIC->database(), $this->logger);
131 }
132 $this->templateRepository = $templateRepository;
133
134 if (null === $deleteAction) {
136 }
137 $this->deleteAction = $deleteAction;
138
139 if (null === $pageFormats) {
140 $pageFormats = new ilPageFormats($DIC->language());
141 }
142 $this->pageFormats = $pageFormats;
143
144 if (null === $xlsFoParser) {
145 $xlsFoParser = new ilXlsFoParser($DIC->settings(), $pageFormats);
146 }
147 $this->xlsFoParser = $xlsFoParser;
148
149 if (null === $upload) {
151 $DIC->upload(),
153 $DIC->language(),
154 $this->logger
155 );
156 }
157 $this->backgroundImageUpload = $upload;
158
159 if (null === $exportAction) {
161 $this->objectId,
163 $this->templateRepository,
164 $DIC->filesystem()->web()
165 );
166 }
167 $this->exportAction = $exportAction;
168
169 if (null === $previewAction) {
171 }
172 $this->previewAction = $previewAction;
173
174 if (null === $fileUpload) {
175 global $DIC;
176 $fileUpload = $DIC->upload();
177 }
178 $this->fileUpload = $fileUpload;
179
180 $this->certificatePath = $certificatePath;
181
182 if (null === $settings) {
183 $settings = new ilSetting('certificate');
184 }
185 $this->settings = $settings;
186
187 if (null === $fileSystem) {
188 $fileSystem = $DIC->filesystem()->web();
189 }
190 $this->fileSystem = $fileSystem;
191
192 if (null === $imageFileService) {
193 $imageFileService = new ilCertificateBackgroundImageFileService(
194 $this->certificatePath,
195 $this->fileSystem
196 );
197 }
198
199 if (null === $backgroundImageDelete) {
201 $this->certificatePath,
202 $imageFileService
203 );
204 }
205 $this->backgroundImageDelete = $backgroundImageDelete;
206
207 if (null === $tmp_file_system) {
208 $tmp_file_system = $DIC->filesystem()->temp();
209 }
210 $this->tmp_file_system = $tmp_file_system;
211 }
ilCertificatePlaceholderDescription $placeholderDescriptionObject
ilCertificateDeleteAction $deleteAction
ilCertificateTemplateRepository $templateRepository
ilCertificateTemplateExportAction $exportAction
ilCertificateFormRepository $settingsFormFactory
ilCertificateBackgroundImageDelete $backgroundImageDelete
ilCertificateTemplatePreviewAction $previewAction
Class ilObjCertificateSettings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
header include for all ilias files.

References $backgroundImageDelete, $certificatePath, $deleteAction, $DIC, $exportAction, $fileSystem, $fileUpload, $objectId, $pageFormats, $placeholderDescriptionObject, $previewAction, $settings, $settingsFormFactory, $templateRepository, $tmp_file_system, $xlsFoParser, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ certificateDelete()

ilCertificateGUI::certificateDelete ( )

Definition at line 290 of file class.ilCertificateGUI.php.

290 : void
291 {
292 // display confirmation message
293 $cgui = new ilConfirmationGUI();
294 $cgui->setFormAction($this->ctrl->getFormAction($this, "certificateEditor"));
295 $cgui->setHeaderText($this->lng->txt("certificate_confirm_deletion_text"));
296 $cgui->setCancel($this->lng->txt("no"), "certificateEditor");
297 $cgui->setConfirm($this->lng->txt("yes"), "certificateDeleteConfirm");
298
299 $this->tpl->setContent($cgui->getHTML());
300 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ certificateDeleteConfirm()

ilCertificateGUI::certificateDeleteConfirm ( )

Deletes the certificate and all its data.

Definition at line 305 of file class.ilCertificateGUI.php.

305 : void
306 {
307 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
308 $templateId = $template->getId();
309
310 $this->deleteAction->delete($templateId, $this->objectId);
311 $this->ctrl->redirect($this, "certificateEditor");
312 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ certificateExportFO()

ilCertificateGUI::certificateExportFO ( )

Exports the certificate.

Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException

Definition at line 270 of file class.ilCertificateGUI.php.

270 : void
271 {
272 $this->exportAction->export();
273 }

◆ certificateImport()

ilCertificateGUI::certificateImport ( )

Definition at line 249 of file class.ilCertificateGUI.php.

249 : void
250 {
251 $this->certificateEditor();
252 }

◆ certificatePreview()

ilCertificateGUI::certificatePreview ( )

Definition at line 254 of file class.ilCertificateGUI.php.

254 : void
255 {
256 try {
257 $this->previewAction->createPreviewPdf($this->objectId);
258 } catch (Exception $exception) {
259 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('error_creating_certificate_pdf'));
260 $this->certificateEditor();
261 }
262 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ certificateRemoveBackground()

ilCertificateGUI::certificateRemoveBackground ( )
Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilDatabaseException
ilException
ilObjectNotFoundException
ilWACException

Definition at line 284 of file class.ilCertificateGUI.php.

284 : void
285 {
286 $this->backgroundImageDelete->deleteBackgroundImage(null);
287 $this->certificateEditor();
288 }

◆ certificateSave()

ilCertificateGUI::certificateSave ( )

Saves the certificate.

Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilDatabaseException
ilException
ilWACException

Definition at line 323 of file class.ilCertificateGUI.php.

323 : void
324 {
325 global $DIC;
326
327 $form = $this->settingsFormFactory->createForm(
328 $this
329 );
330
331 $form->setValuesByPost();
332
333 $request = $DIC->http()->request();
334
335 $formFields = $request->getParsedBody();
336
337 $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
338
339 $this->saveCertificate($form, $formFields, $this->objectId);
340 }

References $DIC.

◆ certificateUpload()

ilCertificateGUI::certificateUpload ( )
Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilDatabaseException
ilException
ilObjectNotFoundException
ilWACException

Definition at line 351 of file class.ilCertificateGUI.php.

351 : void
352 {
353 $this->certificateEditor();
354 }

◆ createFormatArray()

ilCertificateGUI::createFormatArray ( ilCertificateTemplate  $certificateTemplate)
private

Definition at line 591 of file class.ilCertificateGUI.php.

591 : array
592 {
593 if ('' === $certificateTemplate->getCertificateHash()) {
594 $format = $this->settings->get('pageformat', '');
595 $formats = $this->pageFormats->fetchPageFormats();
596
597 return [
598 'pageformat' => $format,
599 'pagewidth' => $formats['width'] ?? '',
600 'pageheight' => $formats['height'] ?? '',
601 'margin_body_top' => ilPageFormats::DEFAULT_MARGIN_BODY_TOP,
602 'margin_body_right' => ilPageFormats::DEFAULT_MARGIN_BODY_RIGHT,
603 'margin_body_bottom' => ilPageFormats::DEFAULT_MARGIN_BODY_BOTTOM,
604 'margin_body_left' => ilPageFormats::DEFAULT_MARGIN_BODY_LEFT,
605 'certificate_text' => $certificateTemplate->getCertificateContent()
606 ];
607 }
608 return $this->settingsFormFactory->fetchFormFieldData($certificateTemplate->getCertificateContent());
609 }
const DEFAULT_MARGIN_BODY_BOTTOM
$formats
Definition: date.php:77
$format
Definition: metadata.php:235

References $format, $formats, ilPageFormats\DEFAULT_MARGIN_BODY_BOTTOM, ilPageFormats\DEFAULT_MARGIN_BODY_LEFT, ilPageFormats\DEFAULT_MARGIN_BODY_RIGHT, ilPageFormats\DEFAULT_MARGIN_BODY_TOP, ilCertificateTemplate\getCertificateContent(), ilCertificateTemplate\getCertificateHash(), and ILIAS\Repository\settings().

Referenced by getEditorForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCertificateGUI::executeCommand ( )
Returns
mixed|null
Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilCtrlException
ilDatabaseException
ilException
ilWACException

Definition at line 223 of file class.ilCertificateGUI.php.

224 {
225 $cmd = $this->ctrl->getCmd();
226 $next_class = $this->ctrl->getNextClass($this);
227
228 $ret = null;
229
230 $cmd = $this->getCommand($cmd);
231 switch ($next_class) {
232 case 'ilpropertyformgui':
233 $form = $this->getEditorForm();
234 $this->ctrl->forwardCommand($form);
235 break;
236
237 default:
238 $ret = $this->$cmd();
239 break;
240 }
241 return $ret;
242 }

References ILIAS\Repository\ctrl(), getCommand(), and getEditorForm().

+ Here is the call graph for this function:

◆ getCommand()

ilCertificateGUI::getCommand (   $cmd)

Definition at line 244 of file class.ilCertificateGUI.php.

245 {
246 return $cmd;
247 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getEditorForm()

ilCertificateGUI::getEditorForm ( )
private
Returns
ilPropertyFormGUI
Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilDatabaseException
ilException
ilWACException

Definition at line 365 of file class.ilCertificateGUI.php.

366 {
367 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
368
369 $form = $this->settingsFormFactory->createForm(
370 $this
371 );
372
373 $formFields = $this->createFormatArray($certificateTemplate);
374
375 $formFields['active'] = $certificateTemplate->isCurrentlyActive();
376
377 $form->setValuesByArray($formFields);
378
379 return $form;
380 }
createFormatArray(ilCertificateTemplate $certificateTemplate)
This class represents a property form user interface.

References createFormatArray().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTemplateContent()

ilCertificateGUI::setTemplateContent ( ilCertificateTemplate  $certificate,
ilPropertyFormGUI  $form 
)
private

Definition at line 581 of file class.ilCertificateGUI.php.

581 : void
582 {
583 $form_fields = $this->settingsFormFactory->fetchFormFieldData($certificate->getCertificateContent());
584 $form_fields['active'] = $certificate->isCurrentlyActive();
585
586 $form->setValuesByArray($form_fields);
587
588 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
589 }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)

References ilCertificateTemplate\getCertificateContent(), ilPropertyFormGUI\getHTML(), ilCertificateTemplate\isCurrentlyActive(), and ilPropertyFormGUI\setValuesByArray().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCertificateGUI::$access
protected

Definition at line 50 of file class.ilCertificateGUI.php.

◆ $backgroundImageDelete

ilCertificateBackgroundImageDelete ilCertificateGUI::$backgroundImageDelete
private

Definition at line 40 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $backgroundImageUpload

ilCertificateBackgroundImageUpload ilCertificateGUI::$backgroundImageUpload
private

Definition at line 59 of file class.ilCertificateGUI.php.

◆ $certificatePath

string ilCertificateGUI::$certificatePath
private

Definition at line 62 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilCertificateGUI::$ctrl
protected

Definition at line 44 of file class.ilCertificateGUI.php.

◆ $deleteAction

ilCertificateDeleteAction ilCertificateGUI::$deleteAction
private

Definition at line 57 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $exportAction

ilCertificateTemplateExportAction ilCertificateGUI::$exportAction
private

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

Referenced by __construct().

◆ $fileSystem

Filesystem ilCertificateGUI::$fileSystem
private

Definition at line 41 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $fileUpload

FileUpload ilCertificateGUI::$fileUpload
private

Definition at line 61 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $global_certificate_settings

ilObjCertificateSettings ilCertificateGUI::$global_certificate_settings
private

Definition at line 67 of file class.ilCertificateGUI.php.

◆ $httpWrapper

WrapperFactory ilCertificateGUI::$httpWrapper
private

Definition at line 42 of file class.ilCertificateGUI.php.

◆ $ilias

ILIAS ilCertificateGUI::$ilias
protected

Definition at line 46 of file class.ilCertificateGUI.php.

◆ $lng

ilLanguage ilCertificateGUI::$lng
protected

Definition at line 48 of file class.ilCertificateGUI.php.

◆ $logger

ilLogger ilCertificateGUI::$logger
private

Definition at line 66 of file class.ilCertificateGUI.php.

◆ $objectId

int ilCertificateGUI::$objectId
private

Definition at line 54 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $pageFormats

ilPageFormats ilCertificateGUI::$pageFormats
private

Definition at line 64 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $placeholderDescriptionObject

ilCertificatePlaceholderDescription ilCertificateGUI::$placeholderDescriptionObject
private

Definition at line 53 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $previewAction

ilCertificateTemplatePreviewAction ilCertificateGUI::$previewAction
private

Definition at line 60 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $ref_id

int ilCertificateGUI::$ref_id
protected

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

◆ $refinery

Factory ilCertificateGUI::$refinery
private

Definition at line 43 of file class.ilCertificateGUI.php.

◆ $settings

ilSetting ilCertificateGUI::$settings
private

Definition at line 63 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $settingsFormFactory

ilCertificateFormRepository ilCertificateGUI::$settingsFormFactory
private

Definition at line 55 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $templateRepository

ilCertificateTemplateRepository ilCertificateGUI::$templateRepository
private

Definition at line 52 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $tmp_file_system

Filesystem ilCertificateGUI::$tmp_file_system
private

Definition at line 65 of file class.ilCertificateGUI.php.

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilCertificateGUI::$toolbar
protected

Definition at line 51 of file class.ilCertificateGUI.php.

◆ $tpl

ilGlobalPageTemplate ilCertificateGUI::$tpl
protected

Definition at line 47 of file class.ilCertificateGUI.php.

◆ $tree

ilTree ilCertificateGUI::$tree
protected

Definition at line 45 of file class.ilCertificateGUI.php.

◆ $xlsFoParser

ilXlsFoParser ilCertificateGUI::$xlsFoParser
private

Definition at line 56 of file class.ilCertificateGUI.php.

Referenced by __construct().


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