ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ($a_number)
 

Private Attributes

 $settings
 
 $pageFormats
 
 $xmlChecker
 
 $utilHelper
 
 $xlstProcess
 
 $language
 
 $certificateXlsFileLoader
 

Detailed Description

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

Definition at line 7 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 
)
Parameters
ilSetting$settings
ilPageFormats$pageFormats
ilXMLChecker$xmlChecker
ilCertificateUtilHelper | null$utilHelper
ilCertificateXlstProcess | null$xlstProcess
ilLanguage | null$language
ilCertificateXlsFileLoader | null$certificateXlsFileLoader

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

References $certificateXlsFileLoader, $DIC, $language, $pageFormats, $settings, $utilHelper, $xlstProcess, $xmlChecker, and settings().

61  {
62  $this->settings = $settings;
63  $this->pageFormats = $pageFormats;
64 
65  if (null === $xmlChecker) {
66  $xmlChecker = new ilXMLChecker();
67  }
68  $this->xmlChecker = $xmlChecker;
69 
70  if (null === $utilHelper) {
71  $utilHelper = new ilCertificateUtilHelper();
72  }
73  $this->utilHelper = $utilHelper;
74 
75  if (null === $xlstProcess) {
76  $xlstProcess = new ilCertificateXlstProcess();
77  }
78  $this->xlstProcess = $xlstProcess;
79 
80  if (null === $language) {
81  global $DIC;
82  $language = $DIC->language();
83  }
84  $this->language = $language;
85 
86  if (null === $certificateXlsFileLoader) {
87  $certificateXlsFileLoader = new ilCertificateXlsFileLoader();
88  }
89  $this->certificateXlsFileLoader = $certificateXlsFileLoader;
90  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
XML checker.
Just a wrapper class to create Unit Test for other classes.
+ Here is the call graph for this function:

Member Function Documentation

◆ formatNumberString()

ilXlsFoParser::formatNumberString (   $a_number)
private
Parameters
string$a_number
Returns
string

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

Referenced by parse().

161  : string
162  {
163  return str_replace(',', '.', $a_number);
164  }
+ Here is the caller graph for this function:

◆ parse()

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

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

References Sabre\VObject\$output, PHPMailer\PHPMailer\$params, formatNumberString(), and settings().

98  : string
99  {
100  $content = "<html><body>" . $formData['certificate_text'] . "</body></html>";
101  $content = preg_replace("/<p>(&nbsp;){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("&nbsp;", "&#160;", $content);
105  $content = preg_replace("//", "", $content);
106 
107  $this->xmlChecker->setXMLContent($content);
108  $this->xmlChecker->startParsing();
109 
110  if ($this->xmlChecker->hasError()) {
111  throw new Exception($this->language->txt("certificate_not_well_formed"));
112  }
113 
114  $xsl = $this->certificateXlsFileLoader->getXlsCertificateContent();
115 
116  // additional font support
117  $xsl = str_replace(
118  'font-family="Helvetica, unifont"',
119  'font-family="' . $this->settings->get('rpc_pdf_font', 'Helvetica, unifont') . '"',
120  $xsl
121  );
122 
123  $args = array(
124  '/_xml' => $content,
125  '/_xsl' => $xsl
126  );
127 
128  if (strcmp($formData['pageformat'], 'custom') == 0) {
129  $pageheight = $formData['pageheight'];
130  $pagewidth = $formData['pagewidth'];
131  } else {
132  $pageformats = $this->pageFormats->fetchPageFormats();
133  $pageheight = $pageformats[$formData['pageformat']]['height'];
134  $pagewidth = $pageformats[$formData['pageformat']]['width'];
135  }
136 
137  $params = array(
138  'pageheight' => $this->formatNumberString($this->utilHelper->stripSlashes($pageheight)),
139  'pagewidth' => $this->formatNumberString($this->utilHelper->stripSlashes($pagewidth)),
140  'backgroundimage' => '[BACKGROUND_IMAGE]',
141  'marginbody' => implode(
142  ' ',
143  array(
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']))
148  )
149  )
150  );
151 
152  $output = $this->xlstProcess->process($args, $params);
153 
154  return $output;
155  }
settings()
Definition: settings.php:2
formatNumberString($a_number)
+ Here is the call graph for this function:

Field Documentation

◆ $certificateXlsFileLoader

ilXlsFoParser::$certificateXlsFileLoader
private

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

Referenced by __construct().

◆ $language

ilXlsFoParser::$language
private

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

Referenced by __construct().

◆ $pageFormats

ilXlsFoParser::$pageFormats
private

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

Referenced by __construct().

◆ $settings

ilXlsFoParser::$settings
private

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

Referenced by __construct().

◆ $utilHelper

ilXlsFoParser::$utilHelper
private

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

Referenced by __construct().

◆ $xlstProcess

ilXlsFoParser::$xlstProcess
private

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

Referenced by __construct().

◆ $xmlChecker

ilXlsFoParser::$xmlChecker
private

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

Referenced by __construct().


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