ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCertificatePdfAction Class Reference
+ Collaboration diagram for ilCertificatePdfAction:

Public Member Functions

 __construct (private readonly ilPdfGenerator $pdfGenerator, ?ilCertificateUtilHelper $ilUtilHelper=null, private readonly string $translatedErrorText='', ?ilErrorHandling $errorHandler=null)
 
 createPDF (int $userId, int $objectId)
 
 downloadPdf (int $userId, int $objectId)
 

Private Attributes

readonly ilCertificateUtilHelper $ilUtilHelper
 
readonly ilErrorHandling $errorHandler
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificatePdfAction::__construct ( private readonly ilPdfGenerator  $pdfGenerator,
?ilCertificateUtilHelper  $ilUtilHelper = null,
private readonly string  $translatedErrorText = '',
?ilErrorHandling  $errorHandler = null 
)

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

34 {
35 if (null === $ilUtilHelper) {
37 }
38 $this->ilUtilHelper = $ilUtilHelper;
39
40 if (null === $errorHandler) {
41 global $DIC;
42 $errorHandler = $DIC['ilErr'];
43 }
44 $this->errorHandler = $errorHandler;
45 }
readonly ilCertificateUtilHelper $ilUtilHelper
readonly ilErrorHandling $errorHandler
Just a wrapper class to create Unit Test for other classes.
global $DIC
Definition: shib_login.php:26

References $DIC, $errorHandler, and $ilUtilHelper.

Member Function Documentation

◆ createPDF()

ilCertificatePdfAction::createPDF ( int  $userId,
int  $objectId 
)

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

47 : string
48 {
49 return $this->pdfGenerator->generateCurrentActiveCertificate($userId, $objectId);
50 }

Referenced by downloadPdf().

+ Here is the caller graph for this function:

◆ downloadPdf()

ilCertificatePdfAction::downloadPdf ( int  $userId,
int  $objectId 
)

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

52 : string
53 {
54 try {
55 $pdfScalar = $this->createPDF($userId, $objectId);
56
57 $fileName = $this->pdfGenerator->generateFileName($userId, $objectId);
58
59 $this->ilUtilHelper->deliverData(
60 $pdfScalar,
61 $fileName,
62 'application/pdf'
63 );
64 } catch (ilException) {
65 $this->errorHandler->raiseError($this->translatedErrorText, $this->errorHandler->MESSAGE);
66 return '';
67 }
68
69 return $pdfScalar;
70 }
createPDF(int $userId, int $objectId)
Base class for ILIAS Exception handling.

References createPDF().

+ Here is the call graph for this function:

Field Documentation

◆ $errorHandler

readonly ilErrorHandling ilCertificatePdfAction::$errorHandler
private

Definition at line 27 of file class.ilCertificatePdfAction.php.

Referenced by __construct().

◆ $ilUtilHelper

readonly ilCertificateUtilHelper ilCertificatePdfAction::$ilUtilHelper
private

Definition at line 26 of file class.ilCertificatePdfAction.php.

Referenced by __construct().


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