50 $objectType = $userCertificate->getObjType();
52 $this->
language->loadLanguageModule(
'cert');
54 $verificationObjectType = $this->classMap->getVerificationTypeByType($objectType);
57 $verificationObject->setTitle($userCertificatePresentation->
getObjectTitle());
60 $objectId = $userCertificate->getObjId();
61 $userId = $userCertificate->getUserId();
65 $verificationObject->setProperty(
'issued_on', $issueDate);
68 $pdfGenerator =
new ilPdfGenerator($ilUserCertificateRepository, $this->logger);
74 $this->
language->txt(
'error_creating_certificate_pdf')
77 $certificateScalar = $pdfAction->
createPDF($userId, $objectId);
79 if ($certificateScalar) {
81 $verificationObject->create();
85 $fileName = $objectType .
'_' . $objectId .
'_' . $userId .
'.pdf';
87 if (file_put_contents(
$path . $fileName, $certificateScalar)) {
88 $verificationObject->setProperty(
'file', $fileName);
89 $verificationObject->update();
91 return $verificationObject;
94 $this->logger->info(
'File could not be created');
95 $verificationObject->delete();
104 public function initStorage(
int $objectId,
string $subDirectory =
'')
109 $path = $storage->getAbsolutePath() .
"/";
111 if ($subDirectory !==
'') {
112 $path .= $subDirectory .
"/";
114 if (!is_dir(
$path)) {
Class ilPdfGeneratorConstantsTest.
__construct(ilLanguage $language, ilDBInterface $database, ilLogger $logger, ilCertificateVerificationClassMap $classMap)
initStorage(int $objectId, string $subDirectory='')
createFile(ilUserCertificatePresentation $userCertificatePresentation)
Just a wrapper class to create Unit Test for other classes.
createPDF(int $userId, int $objectId)
Component logger with individual log levels by component id.