19 declare(strict_types=1);
51 if (null === $utilHelper) {
56 if (null === $mathJaxHelper) {
61 if (null === $userDefinedFieldsHelper) {
66 if (null === $rpcClientFactoryHelper) {
71 if (null === $pdfFileNameFactory) {
82 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
84 $xslfo = $template->getCertificateContent();
89 $xlsfo = $this->mathJaxHelper->fillXlsFoContent($xslfo);
91 $pdf_base64 = $this->rpcClientFactoryHelper
92 ->ilFO2PDF(
'RPCTransformationHandler', $xlsfo);
95 $template->getObjId(),
96 $template->getObjType(),
102 $this->utilHelper->deliverData(
104 $this->pdfFileNameFactory->create($pdfPresentation),
115 string $certificate_text,
119 $insert_tags = $this->placeholderValuesObject->getPlaceholderValuesForPreview($this->
user->getId(), $objectId);
122 $insert_tags[$value[
'ph']] = $this->utilHelper->prepareFormOutput($value[
'name']);
125 foreach ($insert_tags as $placeholderVariable => $value) {
126 $certificate_text = str_replace(
'[' . $placeholderVariable .
']', $value, $certificate_text);
129 $certificate_text = str_replace(
131 'file://' . $this->rootDirectory,
138 '[BACKGROUND_IMAGE]',
139 'file://' . $this->rootDirectory . $backgroundImagePath,
149 $user_field_definitions = $this->userDefinedFieldsHelper->createInstance();
150 $fds = $user_field_definitions->getDefinitions();
153 foreach ($fds as
$f) {
154 if ($f[
'certificate']) {
155 $fields[$f[
'field_id']] = [
156 'name' => $f[
'field_name'],
157 'ph' =>
'[#' . str_replace(
' ',
'_', strtoupper($f[
'field_name'])) .
']' readonly ilCertificateUtilHelper $utilHelper
getCustomCertificateFields()
exchangeCertificateVariables(string $certificate_text, ilCertificateTemplate $template, int $objectId)
Exchanges the variables in the certificate text with given values.
readonly ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper
createPreviewPdf(int $objectId)
readonly ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper
readonly ilCertificatePdfFileNameFactory $pdfFileNameFactory
Just a wrapper class to create Unit Test for other classes.
__construct(private readonly ilCertificateTemplateRepository $templateRepository, private readonly ilCertificatePlaceholderValues $placeholderValuesObject, private readonly string $rootDirectory=CLIENT_WEB_DIR, ?ilObjUser $user=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateMathJaxHelper $mathJaxHelper=null, ?ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper=null, ?ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper=null, ?ilCertificatePdfFileNameFactory $pdfFileNameFactory=null)
readonly ilCertificateMathJaxHelper $mathJaxHelper