19 declare(strict_types=1);
54 if (null === $logger) {
55 $logger = $DIC->logger()->cert();
64 if (null === $utilHelper) {
69 if (null === $mathJaxHelper) {
74 if (null === $userDefinedFieldsHelper) {
79 if (null === $rpcClientFactoryHelper) {
84 if (null === $pdfFileNameFactory) {
98 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
100 $xslfo = $template->getCertificateContent();
105 $xlsfo = $this->mathJaxHelper->fillXlsFoContent($xslfo);
107 $pdf_base64 = $this->rpcClientFactoryHelper
108 ->ilFO2PDF(
'RPCTransformationHandler', $xlsfo);
111 $template->getObjId(),
112 $template->getObjType(),
118 $this->utilHelper->deliverData(
120 $this->pdfFileNameFactory->create($pdfPresentation),
133 string $certificate_text,
137 $insert_tags = $this->placeholderValuesObject->getPlaceholderValuesForPreview($this->
user->getId(), $objectId);
140 $insert_tags[$value[
'ph']] = $this->utilHelper->prepareFormOutput($value[
'name']);
143 foreach ($insert_tags as $placeholderVariable => $value) {
144 $certificate_text = str_replace(
'[' . $placeholderVariable .
']', $value, $certificate_text);
147 $certificate_text = str_replace(
149 'file://' . $this->rootDirectory,
156 '[BACKGROUND_IMAGE]',
157 'file://' . $this->rootDirectory . $backgroundImagePath,
164 $user_field_definitions = $this->userDefinedFieldsHelper->createInstance();
165 $fds = $user_field_definitions->getDefinitions();
168 foreach ($fds as
$f) {
169 if ($f[
'certificate']) {
170 $fields[$f[
'field_id']] = [
171 'name' => $f[
'field_name'],
172 'ph' =>
'[#' . str_replace(
' ',
'_', strtoupper($f[
'field_name'])) .
']'
ilCertificatePlaceholderValues $placeholderValuesObject
getCustomCertificateFields()
__construct(ilCertificateTemplateRepository $templateRepository, ilCertificatePlaceholderValues $placeholderValuesObject, ?ilLogger $logger=null, ?ilObjUser $user=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateMathJaxHelper $mathJaxHelper=null, ?ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper=null, ?ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper=null, string $rootDirectory=CLIENT_WEB_DIR, ?ilCertificatePdfFileNameFactory $pdfFileNameFactory=null)
exchangeCertificateVariables(string $certificate_text, ilCertificateTemplate $template, int $objectId)
Exchanges the variables in the certificate text with given values.
createPreviewPdf(int $objectId)
ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper
ilCertificatePdfFileNameFactory $pdfFileNameFactory
ilCertificateUtilHelper $utilHelper
ilCertificateMathJaxHelper $mathJaxHelper
Just a wrapper class to create Unit Test for other classes.
ilCertificateTemplateRepository $templateRepository
ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper