ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateGUI Class Reference

GUI class to create PDF certificates. More...

+ Collaboration diagram for ilCertificateGUI:

Public Member Functions

 __construct (ilCertificateAdapter $adapter, ilCertificatePlaceholderDescription $placeholderDescriptionObject, ilCertificatePlaceholderValues $placeholderValuesObject, $objectId, $certificatePath, ilCertificateFormRepository $settingsFormFactory=null, ilCertificateDeleteAction $deleteAction=null, ilCertificateTemplateRepository $templateRepository=null, ilPageFormats $pageFormats=null, ilXlsFoParser $xlsFoParser=null, ilFormFieldParser $formFieldParser=null, ilCertificateTemplateExportAction $exportAction=null, ilCertificateBackgroundImageUpload $upload=null, ilCertificateTemplatePreviewAction $previewAction=null, \ILIAS\FileUpload\FileUpload $fileUpload=null, ilSetting $settings=null, \ILIAS\Filesystem\Filesystem $fileSystem=null)
 ilCertificateGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 certificateImport ()
 Import a certificate from a ZIP archive. More...
 
 certificatePreview ()
 Creates a certificate preview. More...
 
 certificateExportFO ()
 Exports the certificate. More...
 
 certificateRemoveBackground ()
 Removes the background image of a certificate. More...
 
 certificateDelete ()
 Deletes the certificate and all its data. More...
 
 certificateDeleteConfirm ()
 Deletes the certificate and all its data. More...
 
 certificateSave ()
 Saves the certificate. More...
 
 certificateUpload ()
 Uploads the certificate. More...
 

Protected Attributes

 $certifcateObject
 
 $ctrl
 
 $tree
 
 $ilias
 
 $tpl
 
 $lng
 
 $ref_id
 
 $access
 
 $toolbar
 

Private Member Functions

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

Private Attributes

 $fileSystem
 
 $templateRepository
 
 $formFieldParser
 
 $placeholderDescriptionObject
 
 $objectId
 
 $settingsFormFactory
 
 $placeholderValuesObject
 
 $xlsFoParser
 
 $deleteAction
 
 $exportAction
 
 $backgroundImageUpload
 
 $previewAction
 
 $thumbnailImageUpload
 
 $fileUpload
 
 $certificatePath
 
 $settings
 
 $pageFormats
 

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 34 of file class.ilCertificateGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCertificateGUI::__construct ( ilCertificateAdapter  $adapter,
ilCertificatePlaceholderDescription  $placeholderDescriptionObject,
ilCertificatePlaceholderValues  $placeholderValuesObject,
  $objectId,
  $certificatePath,
ilCertificateFormRepository  $settingsFormFactory = null,
ilCertificateDeleteAction  $deleteAction = null,
ilCertificateTemplateRepository  $templateRepository = null,
ilPageFormats  $pageFormats = null,
ilXlsFoParser  $xlsFoParser = null,
ilFormFieldParser  $formFieldParser = null,
ilCertificateTemplateExportAction  $exportAction = null,
ilCertificateBackgroundImageUpload  $upload = null,
ilCertificateTemplatePreviewAction  $previewAction = null,
\ILIAS\FileUpload\FileUpload  $fileUpload = null,
ilSetting  $settings = null,
\ILIAS\Filesystem\Filesystem  $fileSystem = null 
)

ilCertificateGUI constructor

Parameters
ilCertificateAdapter$adapterA reference to the test container object
ilCertificatePlaceholderDescription$placeholderDescriptionObject
ilCertificatePlaceholderValues$placeholderValuesObject
$objectId
$certificatePath
ilCertificateFormRepository$settingsFormFactory
ilCertificateDeleteAction$deleteAction
ilCertificateTemplateRepository | null$templateRepository
ilPageFormats | null$pageFormats
ilXlsFoParser | null$xlsFoParser
ilFormFieldParser$formFieldParser
ilCertificateTemplateExportAction | null$exportAction
ilCertificateBackgroundImageUpload | null$upload
ilCertificateTemplatePreviewAction | null$previewAction
\ILIAS\FileUpload\FileUpload | null$fileUpload
ilSetting | null$setting@access public

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

217 {
218 global $DIC;
219
220
221 $this->certifcateObject = new ilCertificate(
222 $adapter,
225 $objectId,
227 );
228
229 $this->lng = $DIC['lng'];
230 $this->tpl = $DIC['tpl'];
231 $this->ctrl = $DIC['ilCtrl'];
232 $this->ilias = $DIC['ilias'];
233 $this->tree = $DIC['tree'];
234 $this->tree = $DIC['tree'];
235 $this->access = $DIC['ilAccess'];
236 $this->toolbar = $DIC['ilToolbar'];
237
238 $this->lng->loadLanguageModule('certificate');
239 $this->lng->loadLanguageModule('cert');
240 $this->lng->loadLanguageModule("trac");
241
242 $this->ref_id = (int) $_GET['ref_id'];
243
244 $this->placeholderDescriptionObject = $placeholderDescriptionObject;
245
246 $this->placeholderValuesObject = $placeholderValuesObject;
247
248 $this->objectId = $objectId;
249
250 $logger = $DIC->logger()->cert();
251
252 if (null === $settingsFormFactory) {
254 $this->objectId,
256 $this->lng,
257 $this->tpl,
258 $this->ctrl,
259 $this->access,
260 $this->toolbar,
262 );
263 }
264 $this->settingsFormFactory = $settingsFormFactory;
265
266 if (null === $templateRepository) {
267 $templateRepository = new ilCertificateTemplateRepository($DIC->database(), $logger);
268 }
269 $this->templateRepository = $templateRepository;
270
271 if (null === $deleteAction) {
273 }
274 $this->deleteAction = $deleteAction;
275
276 if (null === $formFieldParser) {
278 }
279 $this->formFieldParser = $formFieldParser;
280
281 if (null === $pageFormats) {
282 $pageFormats = new ilPageFormats($DIC->language());
283 }
284 $this->pageFormats = $pageFormats;
285
286 if (null === $xlsFoParser) {
287 $xlsFoParser = new ilXlsFoParser($DIC->settings(), $pageFormats);
288 }
289 $this->xlsFoParser = $xlsFoParser;
290
291 if (null === $upload) {
293 $DIC->upload(),
295 $DIC->language(),
296 $logger
297 );
298 }
299 $this->backgroundImageUpload = $upload;
300
301 if (null === $exportAction) {
303 $this->objectId,
305 $this->templateRepository,
306 $DIC->filesystem()->web()
307 );
308 }
309 $this->exportAction = $exportAction;
310
311 if (null === $previewAction) {
313 }
314 $this->previewAction = $previewAction;
315
316 if (null === $fileUpload) {
317 global $DIC;
318 $fileUpload = $DIC->upload();
319 }
320 $this->fileUpload = $fileUpload;
321
322 $this->certificatePath = $certificatePath;
323
324 if (null === $settings) {
325 $settings = new ilSetting('certificate');
326 }
327 $this->settings = $settings;
328
329 if (null === $fileSystem) {
330 $fileSystem = $DIC->filesystem()->web();
331 }
332 $this->fileSystem = $fileSystem;
333 }
$_GET["client_id"]
Create PDF certificates.
ILIAS Setting Class.
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $_GET, $certificatePath, $deleteAction, $DIC, $exportAction, $fileSystem, $fileUpload, $formFieldParser, $objectId, $pageFormats, $placeholderDescriptionObject, $placeholderValuesObject, $previewAction, $settings, $settingsFormFactory, $templateRepository, $xlsFoParser, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ certificateDelete()

ilCertificateGUI::certificateDelete ( )

Deletes the certificate and all its data.

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

407 {
408 // display confirmation message
409 $cgui = new ilConfirmationGUI();
410 $cgui->setFormAction($this->ctrl->getFormAction($this, "certificateEditor"));
411 $cgui->setHeaderText($this->lng->txt("certificate_confirm_deletion_text"));
412 $cgui->setCancel($this->lng->txt("no"), "certificateEditor");
413 $cgui->setConfirm($this->lng->txt("yes"), "certificateDeleteConfirm");
414
415 $this->tpl->setContent($cgui->getHTML());
416 }
Confirmation screen class.

◆ certificateDeleteConfirm()

ilCertificateGUI::certificateDeleteConfirm ( )

Deletes the certificate and all its data.

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

422 {
423 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
424 $templateId = $template->getId();
425
426 $this->deleteAction->delete($templateId, $this->objectId);
427 $this->ctrl->redirect($this, "certificateEditor");
428 }
$template

References $template.

◆ certificateExportFO()

ilCertificateGUI::certificateExportFO ( )

Exports the certificate.

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

390 {
391 $this->exportAction->export();
392 }

◆ certificateImport()

ilCertificateGUI::certificateImport ( )

Import a certificate from a ZIP archive.

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

369 {
370 $this->certificateEditor();
371 }

◆ certificatePreview()

ilCertificateGUI::certificatePreview ( )

Creates a certificate preview.

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

377 {
378 try {
379 $this->previewAction->createPreviewPdf($this->objectId);
380 } catch (Exception $exception) {
381 ilUtil::sendFailure($this->lng->txt('error_creating_certificate_pdf', true));
382 $this->certificateEditor();
383 }
384 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ certificateRemoveBackground()

ilCertificateGUI::certificateRemoveBackground ( )

Removes the background image of a certificate.

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

398 {
399 $this->certifcateObject->deleteBackgroundImage();
400 $this->certificateEditor();
401 }

◆ certificateSave()

ilCertificateGUI::certificateSave ( )

Saves the certificate.

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

434 {
435 global $DIC;
436
437 $form = $this->settingsFormFactory->createForm(
438 $this,
439 $this->certifcateObject
440 );
441
442 $form->setValuesByPost();
443
444 $request = $DIC->http()->request();
445
446 $formFields = $request->getParsedBody();
447
448 $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
449
450 $this->saveCertificate($form, $formFields, $this->objectId);
451 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
if(isset($_POST['submit'])) $form

References $DIC, $form, and $request.

◆ certificateUpload()

ilCertificateGUI::certificateUpload ( )

Uploads the certificate.

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

457 {
458 $this->certificateEditor();
459 }

◆ createFormatArray()

ilCertificateGUI::createFormatArray ( ilCertificateTemplate  $certificateTemplate)
private
Parameters
ilCertificateTemplate$certificateTemplate
Returns
array|mixed

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

677 {
678 if ('' === $certificateTemplate->getCertificateHash()) {
679 $format = $this->settings->get('pageformat');
680 $formats = $this->pageFormats->fetchPageFormats();
681
682 $formFieldArray = array(
683 'pageformat' => $format,
684 'pagewidth' => $formats['width'],
685 'pageheight' => $formats['height'],
686 'margin_body_top' => ilPageFormats::DEFAULT_MARGIN_BODY_TOP,
687 'margin_body_right' => ilPageFormats::DEFAULT_MARGIN_BODY_RIGHT,
688 'margin_body_bottom' => ilPageFormats::DEFAULT_MARGIN_BODY_BOTTOM,
689 'margin_body_left' => ilPageFormats::DEFAULT_MARGIN_BODY_LEFT,
690 'certificate_text' => $certificateTemplate->getCertificateContent()
691 );
692
693 return $formFieldArray;
694 }
695 return $this->settingsFormFactory->fetchFormFieldData($certificateTemplate->getCertificateContent());
696 }
const DEFAULT_MARGIN_BODY_BOTTOM
$formats
Definition: date.php:77
$format
Definition: metadata.php:141

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 settings().

Referenced by getEditorForm().

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

◆ executeCommand()

ilCertificateGUI::executeCommand ( )

execute command

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

339 {
340 $cmd = $this->ctrl->getCmd();
341 $next_class = $this->ctrl->getNextClass($this);
342
343 $cmd = $this->getCommand($cmd);
344 switch ($next_class) {
345 case 'ilpropertyformgui':
346 $form = $this->getEditorForm();
347 $this->ctrl->forwardCommand($form);
348 break;
349
350 default:
351 $ret = $this->$cmd();
352 break;
353 }
354 return $ret;
355 }
getCommand($cmd)
Retrieves the ilCtrl command.
$ret
Definition: parser.php:6

References $form, $ret, getCommand(), and getEditorForm().

+ Here is the call graph for this function:

◆ getCommand()

ilCertificateGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

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

361 {
362 return $cmd;
363 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getEditorForm()

ilCertificateGUI::getEditorForm ( )
private
Returns
ilPropertyFormGUI
Exceptions

ILIAS\Filesystem\Exception\FileAlreadyExistsException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

Exceptions
ilDatabaseException
ilException
ilWACException

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

471 {
472 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
473
474 $form = $this->settingsFormFactory->createForm(
475 $this,
476 $this->certifcateObject
477 );
478
479 $formFields = $this->createFormatArray($certificateTemplate);
480
481 $formFields['active'] = $certificateTemplate->isCurrentlyActive();
482
483 $form->setValuesByArray($formFields);
484
485 return $form;
486 }
createFormatArray(ilCertificateTemplate $certificateTemplate)
This class represents a property form user interface.

References $form, and 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
Parameters
$content
$certificate
$form

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

663 {
664 $form_fields = $this->settingsFormFactory->fetchFormFieldData($certificate->getCertificateContent());
665 $form_fields['active'] = $certificate->isCurrentlyActive();
666
667 $form->setValuesByArray($form_fields);
668
669 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
670 }
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77

References $certificate, and $form.

Field Documentation

◆ $access

ilCertificateGUI::$access
protected

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

◆ $backgroundImageUpload

ilCertificateGUI::$backgroundImageUpload
private

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

◆ $certifcateObject

ilCertificateGUI::$certifcateObject
protected

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

◆ $certificatePath

ilCertificateGUI::$certificatePath
private

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

Referenced by __construct().

◆ $ctrl

ilCertificateGUI::$ctrl
protected

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

◆ $deleteAction

ilCertificateGUI::$deleteAction
private

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

Referenced by __construct().

◆ $exportAction

ilCertificateGUI::$exportAction
private

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

Referenced by __construct().

◆ $fileSystem

ilCertificateGUI::$fileSystem
private

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

Referenced by __construct().

◆ $fileUpload

ilCertificateGUI::$fileUpload
private

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

Referenced by __construct().

◆ $formFieldParser

ilCertificateGUI::$formFieldParser
private

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

Referenced by __construct().

◆ $ilias

ilCertificateGUI::$ilias
protected

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

◆ $lng

ilCertificateGUI::$lng
protected

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

◆ $objectId

ilCertificateGUI::$objectId
private

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

Referenced by __construct().

◆ $pageFormats

ilCertificateGUI::$pageFormats
private

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

Referenced by __construct().

◆ $placeholderDescriptionObject

ilCertificateGUI::$placeholderDescriptionObject
private

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

Referenced by __construct().

◆ $placeholderValuesObject

ilCertificateGUI::$placeholderValuesObject
private

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

Referenced by __construct().

◆ $previewAction

ilCertificateGUI::$previewAction
private

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

Referenced by __construct().

◆ $ref_id

ilCertificateGUI::$ref_id
protected

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

◆ $settings

ilCertificateGUI::$settings
private

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

Referenced by __construct().

◆ $settingsFormFactory

ilCertificateGUI::$settingsFormFactory
private

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

Referenced by __construct().

◆ $templateRepository

ilCertificateGUI::$templateRepository
private

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

Referenced by __construct().

◆ $thumbnailImageUpload

ilCertificateGUI::$thumbnailImageUpload
private

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

◆ $toolbar

ilCertificateGUI::$toolbar
protected

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

◆ $tpl

ilCertificateGUI::$tpl
protected

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

◆ $tree

ilCertificateGUI::$tree
protected

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

◆ $xlsFoParser

ilCertificateGUI::$xlsFoParser
private

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

Referenced by __construct().


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