19declare(strict_types=1);
40 private readonly IRSS $irss,
60 if (
null === $utilHelper) {
86 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
88 $xslfo = $template->getCertificateContent();
92 $pdf_base64 = $this->rpcClientFactoryHelper
93 ->ilFO2PDF(
'RPCTransformationHandler', $xslfo)
97 $template->getObjId(),
98 $template->getObjType(),
104 $this->utilHelper->deliverData(
106 $this->pdfFileNameFactory->create($pdfPresentation),
117 string $certificate_text,
121 $insert_tags = $this->placeholderValuesObject->getPlaceholderValuesForPreview($this->
user->
getId(), $objectId);
124 $insert_tags[$value[
'ph']] = $this->utilHelper->prepareFormOutput($value[
'name']);
127 foreach ($insert_tags as $placeholderVariable => $value) {
128 $certificate_text = str_replace(
'[' . $placeholderVariable .
']', $value, $certificate_text);
131 $certificate_text = str_replace(
133 'file://' . $this->rootDirectory,
139 $backgroundImagePath = $this->irss->consume()->src($identification)->getSrc(
true);
143 '[BACKGROUND_IMAGE]',
144 $backgroundImagePath ??
'',
154 $fds = $this->userDefinedFieldsHelper->getFields();
157 foreach ($fds as
$f) {
158 $fields[
$f->getIdentifier()] = [
159 'name' =>
$f->getLabel($this->
lng),
160 'ph' =>
'[#' . str_replace(
' ',
'_', strtoupper(
$f->getLabel($this->lng))) .
']'
Class ResourceIdentification.
readonly ilCertificatePdfFileNameFactory $pdfFileNameFactory
exchangeCertificateVariables(string $certificate_text, ilCertificateTemplate $template, int $objectId)
Exchanges the variables in the certificate text with given values.
readonly ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper
readonly ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper
readonly ilCertificateUtilHelper $utilHelper
__construct(private readonly ilCertificateTemplateRepository $templateRepository, private readonly ilCertificatePlaceholderValues $placeholderValuesObject, private readonly IRSS $irss, private readonly string $rootDirectory=CLIENT_WEB_DIR, ?ilObjUser $user=null, ?Language $lng=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateUserDefinedFieldsHelper $userDefinedFieldsHelper=null, ?ilCertificateRpcClientFactoryHelper $rpcClientFactoryHelper=null, ?ilCertificatePdfFileNameFactory $pdfFileNameFactory=null)
getCustomCertificateFields()
createPreviewPdf(int $objectId)
getBackgroundImageIdentification()
Just a wrapper class to create Unit Test for other classes.