19 declare(strict_types=1);
38 if (
null === $xmlChecker) {
43 if (
null === $utilHelper) {
48 if (
null === $xlstProcess) {
53 if (
null === $language) {
55 $language = $DIC->language();
59 if (
null === $certificateXlsFileLoader) {
68 public function parse(array $formData): string
70 $content =
"<html><body>" . $formData[
'certificate_text'] .
"</body></html>";
71 $content = preg_replace(
"/<p>( ){1,}<\\/p>/",
"<p></p>", $content);
72 $content = preg_replace(
"/<p>(\\s)*?<\\/p>/",
"<p></p>", $content);
73 $content = str_replace(
"<p></p>",
"<p class=\"emptyrow\"></p>", $content);
74 $content = str_replace(
" ",
" ", $content);
75 $content = str_replace(
'<br>',
'<br/>', $content);
76 $content = preg_replace(
"//",
"", $content);
78 $this->xmlChecker->parse($content);
79 if ($this->xmlChecker->result()->isError()) {
83 $xsl = $this->certificateXlsFileLoader->getXlsCertificateContent();
87 'font-family="Helvetica, unifont"',
88 'font-family="' . $this->
settings->get(
'rpc_pdf_font',
'Helvetica, unifont') .
'"',
97 if (strcmp($formData[
'pageformat'],
'custom') === 0) {
98 $pageheight = $formData[
'pageheight'] ??
'';
99 $pagewidth = $formData[
'pagewidth'] ??
'';
101 $pageformats = $this->pageFormats->fetchPageFormats();
102 $pageheight = $pageformats[$formData[
'pageformat']][
'height'];
103 $pagewidth = $pageformats[$formData[
'pageformat']][
'width'];
107 'pageheight' => $this->
formatNumberString($this->utilHelper->stripSlashes($pageheight)),
108 'pagewidth' => $this->
formatNumberString($this->utilHelper->stripSlashes($pagewidth)),
109 'backgroundimage' =>
'[BACKGROUND_IMAGE]',
110 'marginbody' => implode(
113 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'top'])),
114 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'right'])),
115 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'bottom'])),
116 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'left']))
121 return $this->xlstProcess->process($args,
$params);
126 return str_replace(
',',
'.', $a_number);
readonly ilCertificateXlsFileLoader $certificateXlsFileLoader
formatNumberString(string $a_number)
readonly ilCertificateUtilHelper $utilHelper
__construct(private readonly ilSetting $settings, private readonly ilPageFormats $pageFormats, ?ilXMLChecker $xmlChecker=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateXlstProcess $xlstProcess=null, ?ilLanguage $language=null, ?ilCertificateXlsFileLoader $certificateXlsFileLoader=null)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly ilCertificateXlstProcess $xlstProcess
readonly ilXMLChecker $xmlChecker
readonly ilLanguage $language
language()
description: > Example for rendring a language glyph.