98 public function parse(array $formData) : string
100 $content =
"<html><body>" . $formData[
'certificate_text'] .
"</body></html>";
101 $content = preg_replace(
"/<p>( ){1,}<\\/p>/",
"<p></p>", $content);
102 $content = preg_replace(
"/<p>(\\s)*?<\\/p>/",
"<p></p>", $content);
103 $content = str_replace(
"<p></p>",
"<p class=\"emptyrow\"></p>", $content);
104 $content = str_replace(
" ",
" ", $content);
105 $content = preg_replace(
"//",
"", $content);
107 $this->xmlChecker->setXMLContent($content);
108 $this->xmlChecker->startParsing();
110 if ($this->xmlChecker->hasError()) {
114 $xsl = $this->certificateXlsFileLoader->getXlsCertificateContent();
118 'font-family="Helvetica, unifont"',
119 'font-family="' . $this->
settings->get(
'rpc_pdf_font',
'Helvetica, unifont') .
'"',
128 if (strcmp($formData[
'pageformat'],
'custom') == 0) {
129 $pageheight = $formData[
'pageheight'];
130 $pagewidth = $formData[
'pagewidth'];
132 $pageformats = $this->pageFormats->fetchPageFormats();
133 $pageheight = $pageformats[$formData[
'pageformat']][
'height'];
134 $pagewidth = $pageformats[$formData[
'pageformat']][
'width'];
138 'pageheight' => $this->
formatNumberString($this->utilHelper->stripSlashes($pageheight)),
139 'pagewidth' => $this->
formatNumberString($this->utilHelper->stripSlashes($pagewidth)),
140 'backgroundimage' =>
'[BACKGROUND_IMAGE]',
141 'marginbody' => implode(
144 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'top'])),
145 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'right'])),
146 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'bottom'])),
147 $this->
formatNumberString($this->utilHelper->stripSlashes($formData[
'margin_body'][
'left']))
163 return str_replace(
',',
'.', $a_number);
__construct(ilSetting $settings, ilPageFormats $pageFormats, ilXMLChecker $xmlChecker=null, ilCertificateUtilHelper $utilHelper=null, ilCertificateXlstProcess $xlstProcess=null, ilLanguage $language=null, ilCertificateXlsFileLoader $certificateXlsFileLoader=null)
$certificateXlsFileLoader
Just a wrapper class to create Unit Test for other classes.
formatNumberString($a_number)