ILIAS  release_8 Revision v8.24
ilXlsFoParser Class Reference
+ Collaboration diagram for ilXlsFoParser:

Public Member Functions

 __construct (ilSetting $settings, ilPageFormats $pageFormats, ?ilXMLChecker $xmlChecker=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateXlstProcess $xlstProcess=null, ?ilLanguage $language=null, ?ilCertificateXlsFileLoader $certificateXlsFileLoader=null)
 
 parse (array $formData)
 

Private Member Functions

 formatNumberString (string $a_number)
 

Private Attributes

ilSetting $settings
 
ilPageFormats $pageFormats
 
ilXMLChecker $xmlChecker
 
ilCertificateUtilHelper $utilHelper
 
ilCertificateXlstProcess $xlstProcess
 
ilLanguage $language
 
ilCertificateXlsFileLoader $certificateXlsFileLoader
 

Detailed Description

Author
Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de

Definition at line 24 of file class.ilXlsFoParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilXlsFoParser::__construct ( ilSetting  $settings,
ilPageFormats  $pageFormats,
?ilXMLChecker  $xmlChecker = null,
?ilCertificateUtilHelper  $utilHelper = null,
?ilCertificateXlstProcess  $xlstProcess = null,
?ilLanguage  $language = null,
?ilCertificateXlsFileLoader  $certificateXlsFileLoader = null 
)

Definition at line 34 of file class.ilXlsFoParser.php.

42 {
43 $this->settings = $settings;
44 $this->pageFormats = $pageFormats;
45
46 if (null === $xmlChecker) {
47 $xmlChecker = new ilXMLChecker(new ILIAS\Data\Factory());
48 }
49 $this->xmlChecker = $xmlChecker;
50
51 if (null === $utilHelper) {
53 }
54 $this->utilHelper = $utilHelper;
55
56 if (null === $xlstProcess) {
58 }
59 $this->xlstProcess = $xlstProcess;
60
61 if (null === $language) {
62 global $DIC;
63 $language = $DIC->language();
64 }
65 $this->language = $language;
66
67 if (null === $certificateXlsFileLoader) {
69 }
70 $this->certificateXlsFileLoader = $certificateXlsFileLoader;
71 }
Just a wrapper class to create Unit Test for other classes.
ilPageFormats $pageFormats
ilCertificateXlstProcess $xlstProcess
ilCertificateXlsFileLoader $certificateXlsFileLoader
ilXMLChecker $xmlChecker
ilCertificateUtilHelper $utilHelper
global $DIC
Definition: feed.php:28
Class ChatMainBarProvider \MainMenu\Provider.

References $certificateXlsFileLoader, $DIC, $language, $pageFormats, $settings, $utilHelper, $xlstProcess, $xmlChecker, ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ formatNumberString()

ilXlsFoParser::formatNumberString ( string  $a_number)
private

Definition at line 132 of file class.ilXlsFoParser.php.

132 : string
133 {
134 return str_replace(',', '.', $a_number);
135 }

Referenced by parse().

+ Here is the caller graph for this function:

◆ parse()

ilXlsFoParser::parse ( array  $formData)
Parameters
array$formData
Returns
string
Exceptions
Exception

Definition at line 78 of file class.ilXlsFoParser.php.

78 : string
79 {
80 $content = "<html><body>" . $formData['certificate_text'] . "</body></html>";
81 $content = preg_replace("/<p>(&nbsp;){1,}<\\/p>/", "<p></p>", $content);
82 $content = preg_replace("/<p>(\\s)*?<\\/p>/", "<p></p>", $content);
83 $content = str_replace(["<p></p>", "&nbsp;"], ["<p class=\"emptyrow\"></p>", "&#160;"], $content);
84 $content = preg_replace("//", "", $content);
85
86 $this->xmlChecker->parse($content);
87 if ($this->xmlChecker->result()->isError()) {
88 throw new Exception($this->language->txt("certificate_not_well_formed"));
89 }
90
91 $xsl = $this->certificateXlsFileLoader->getXlsCertificateContent();
92
93 // additional font support
94 $xsl = str_replace(
95 'font-family="Helvetica, unifont"',
96 'font-family="' . $this->settings->get('rpc_pdf_font', 'Helvetica, unifont') . '"',
97 $xsl
98 );
99
100 $args = [
101 '/_xml' => $content,
102 '/_xsl' => $xsl
103 ];
104
105 if (strcmp($formData['pageformat'], 'custom') === 0) {
106 $pageheight = $formData['pageheight'] ?? '';
107 $pagewidth = $formData['pagewidth'] ?? '';
108 } else {
109 $pageformats = $this->pageFormats->fetchPageFormats();
110 $pageheight = $pageformats[$formData['pageformat']]['height'];
111 $pagewidth = $pageformats[$formData['pageformat']]['width'];
112 }
113
114 $params = [
115 'pageheight' => $this->formatNumberString($this->utilHelper->stripSlashes($pageheight)),
116 'pagewidth' => $this->formatNumberString($this->utilHelper->stripSlashes($pagewidth)),
117 'backgroundimage' => '[BACKGROUND_IMAGE]',
118 'marginbody' => implode(
119 ' ',
120 [
121 $this->formatNumberString($this->utilHelper->stripSlashes($formData['margin_body']['top'])),
122 $this->formatNumberString($this->utilHelper->stripSlashes($formData['margin_body']['right'])),
123 $this->formatNumberString($this->utilHelper->stripSlashes($formData['margin_body']['bottom'])),
124 $this->formatNumberString($this->utilHelper->stripSlashes($formData['margin_body']['left']))
125 ]
126 )
127 ];
128
129 return $this->xlstProcess->process($args, $params);
130 }
formatNumberString(string $a_number)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33

References $params, formatNumberString(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Field Documentation

◆ $certificateXlsFileLoader

ilCertificateXlsFileLoader ilXlsFoParser::$certificateXlsFileLoader
private

Definition at line 32 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $language

ilLanguage ilXlsFoParser::$language
private

Definition at line 31 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $pageFormats

ilPageFormats ilXlsFoParser::$pageFormats
private

Definition at line 27 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $settings

ilSetting ilXlsFoParser::$settings
private

Definition at line 26 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $utilHelper

ilCertificateUtilHelper ilXlsFoParser::$utilHelper
private

Definition at line 29 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $xlstProcess

ilCertificateXlstProcess ilXlsFoParser::$xlstProcess
private

Definition at line 30 of file class.ilXlsFoParser.php.

Referenced by __construct().

◆ $xmlChecker

ilXMLChecker ilXlsFoParser::$xmlChecker
private

Definition at line 28 of file class.ilXlsFoParser.php.

Referenced by __construct().


The documentation for this class was generated from the following file: