ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWkhtmlToPdfConfigFormGUI Class Reference
+ Collaboration diagram for ilWkhtmlToPdfConfigFormGUI:

Public Member Functions

 __construct ()
 ilWkhtmlToPdfConfigFormGUI constructor. More...
 
 addConfigForm ($form)
 
 validateForm ()
 
 getConfigFromForm (ilPropertyFormGUI $form)
 
 populateForm ($form, $config)
 

Protected Member Functions

 setLanguage ($lng)
 
 translate ($txt)
 
 appendOutputOptionsForm (ilPropertyFormGUI $form)
 
 buildExternalLinksForm ()
 
 buildEnableFormsForm ()
 
 buildLowQualityForm ()
 
 buildGreyScaleForm ()
 
 buildPrintMediaTypeForm ()
 
 buildJavascriptDelayForm ()
 
 buildOverwriteDefaultFont ()
 
 appendPageSettingsForm (ilPropertyFormGUI $form)
 
 buildZoomForm ()
 
 buildOrientationsForm ()
 
 buildPageSizesForm ()
 
 buildMarginLeftForm ()
 
 buildMarginRightForm ()
 
 buildMarginTopForm ()
 
 buildMarginBottomForm ()
 
 buildHeaderForm ()
 
 buildHeaderTextForm ()
 
 buildHeaderHtmlForm ()
 
 buildFooterForm ()
 
 buildFooterTextForm ()
 
 buildFooterHtmlForm ()
 
 buildCheckboxSvgForm ()
 
 buildCheckedCheckboxSvgForm ()
 
 buildRadiobuttonSvgForm ()
 
 buildCheckedRadiobuttonSvgForm ()
 
 saveNewDefaultBinaryPath ($path)
 

Protected Attributes

 $lng
 

Private Member Functions

 isNotValidSize (array $sizes)
 
 isNotValidText (array $texts)
 

Detailed Description

Definition at line 3 of file class.ilWkhtmlToPdfConfigFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilWkhtmlToPdfConfigFormGUI::__construct ( )

ilWkhtmlToPdfConfigFormGUI constructor.

Definition at line 13 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References $DIC, and setLanguage().

14  {
15  global $DIC;
16  $this->setLanguage($DIC['lng']);
17  }
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ addConfigForm()

ilWkhtmlToPdfConfigFormGUI::addConfigForm (   $form)
Parameters
ilPropertyFormGUI$form

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

References appendOutputOptionsForm(), appendPageSettingsForm(), and translate().

31  {
32  $path = new ilTextInputGUI($this->translate('path'), 'path');
33  $form->addItem($path);
34 
35  $this->appendOutputOptionsForm($form);
36  $this->appendPageSettingsForm($form);
37  }
appendOutputOptionsForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ appendOutputOptionsForm()

ilWkhtmlToPdfConfigFormGUI::appendOutputOptionsForm ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form

Definition at line 51 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPropertyFormGUI\addItem(), buildCheckboxSvgForm(), buildCheckedCheckboxSvgForm(), buildCheckedRadiobuttonSvgForm(), buildEnableFormsForm(), buildExternalLinksForm(), buildGreyScaleForm(), buildJavascriptDelayForm(), buildLowQualityForm(), buildOverwriteDefaultFont(), buildPrintMediaTypeForm(), buildRadiobuttonSvgForm(), and translate().

Referenced by addConfigForm().

52  {
53  $section_header = new ilFormSectionHeaderGUI();
54  $section_header->setTitle($this->translate('output_options'));
55  $form->addItem($section_header);
56 
57  $form->addItem($this->buildExternalLinksForm());
58  $form->addItem($this->buildEnableFormsForm());
59  $form->addItem($this->buildLowQualityForm());
60  $form->addItem($this->buildGreyScaleForm());
61  $form->addItem($this->buildPrintMediaTypeForm());
62  $form->addItem($this->buildJavascriptDelayForm());
63  $form->addItem($this->buildCheckboxSvgForm());
64  $form->addItem($this->buildCheckedCheckboxSvgForm());
65  $form->addItem($this->buildRadiobuttonSvgForm());
66  $form->addItem($this->buildCheckedRadiobuttonSvgForm());
67  $form->addItem($this->buildOverwriteDefaultFont());
68  }
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendPageSettingsForm()

ilWkhtmlToPdfConfigFormGUI::appendPageSettingsForm ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form

Definition at line 144 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPropertyFormGUI\addItem(), buildFooterForm(), buildHeaderForm(), buildMarginBottomForm(), buildMarginLeftForm(), buildMarginRightForm(), buildMarginTopForm(), buildOrientationsForm(), buildPageSizesForm(), buildZoomForm(), and translate().

Referenced by addConfigForm().

145  {
146  $section_header = new ilFormSectionHeaderGUI();
147  $section_header->setTitle($this->translate('page_settings'));
148  $form->addItem($section_header);
149 
150  $form->addItem($this->buildZoomForm());
151  $form->addItem($this->buildOrientationsForm());
152  $form->addItem($this->buildPageSizesForm());
153  $form->addItem($this->buildMarginLeftForm());
154  $form->addItem($this->buildMarginRightForm());
155  $form->addItem($this->buildMarginTopForm());
156  $form->addItem($this->buildMarginBottomForm());
157  $form->addItem($this->buildHeaderForm());
158  $form->addItem($this->buildFooterForm());
159  }
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildCheckboxSvgForm()

ilWkhtmlToPdfConfigFormGUI::buildCheckboxSvgForm ( )
protected

Definition at line 345 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

346  {
347  return new ilTextInputGUI($this->translate('checkbox_svg'), 'checkbox_svg');
348  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildCheckedCheckboxSvgForm()

ilWkhtmlToPdfConfigFormGUI::buildCheckedCheckboxSvgForm ( )
protected

Definition at line 350 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

351  {
352  return new ilTextInputGUI($this->translate('checkbox_checked_svg'), 'checkbox_checked_svg');
353  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildCheckedRadiobuttonSvgForm()

ilWkhtmlToPdfConfigFormGUI::buildCheckedRadiobuttonSvgForm ( )
protected

Definition at line 360 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

361  {
362  return new ilTextInputGUI($this->translate('radio_button_checked_svg'), 'radio_button_checked_svg');
363  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEnableFormsForm()

ilWkhtmlToPdfConfigFormGUI::buildEnableFormsForm ( )
protected
Returns
ilCheckboxInputGUI

Definition at line 83 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

84  {
85  $enable_forms = new ilCheckboxInputGUI($this->translate('enable_forms'), 'enable_forms');
86  $enable_forms->setInfo($this->translate('enable_forms_info'));
87  return $enable_forms;
88  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildExternalLinksForm()

ilWkhtmlToPdfConfigFormGUI::buildExternalLinksForm ( )
protected
Returns
ilCheckboxInputGUI

Definition at line 73 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

74  {
75  $external_links = new ilCheckboxInputGUI($this->translate('external_links'), 'external_links');
76  $external_links->setInfo($this->translate('external_links_info'));
77  return $external_links;
78  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooterForm()

ilWkhtmlToPdfConfigFormGUI::buildFooterForm ( )
protected
Returns
ilRadioGroupInputGUI

Definition at line 292 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References buildFooterHtmlForm(), buildFooterTextForm(), ilPDFGenerationConstants\FOOTER_NONE, and translate().

Referenced by appendPageSettingsForm().

293  {
294  $footer_select = new ilRadioGroupInputGUI($this->translate('footer_type'), 'footer_select');
295  $footer_select->addOption(new ilRadioOption($this->translate("none"), ilPDFGenerationConstants::FOOTER_NONE, ''));
296  $footer_select->addOption($this->buildFooterTextForm());
297  $footer_select->addOption($this->buildFooterHtmlForm());
298 
299  return $footer_select;
300  }
This class represents an option in a radio group.
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooterHtmlForm()

ilWkhtmlToPdfConfigFormGUI::buildFooterHtmlForm ( )
protected
Returns
ilRadioOption

Definition at line 330 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\FOOTER_HTML, and translate().

Referenced by buildFooterForm().

331  {
332  $footer_html_option = new ilRadioOption($this->translate('html'), ilPDFGenerationConstants::FOOTER_HTML, '');
333 
334  $footer_html = new ilTextInputGUI($this->translate('footer_html'), 'footer_html');
335  $footer_html_option->addSubItem($footer_html);
336 
337  $footer_html_spacing = new ilTextInputGUI($this->translate('spacing'), 'footer_html_spacing');
338  $footer_html_option->addSubItem($footer_html_spacing);
339 
340  $footer_html_line = new ilCheckboxInputGUI($this->translate('footer_line'), 'footer_html_line');
341  $footer_html_option->addSubItem($footer_html_line);
342  return $footer_html_option;
343  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooterTextForm()

ilWkhtmlToPdfConfigFormGUI::buildFooterTextForm ( )
protected
Returns
ilRadioOption

Definition at line 305 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\FOOTER_TEXT, and translate().

Referenced by buildFooterForm().

306  {
307  $footer_text_option = new ilRadioOption($this->translate('text'), ilPDFGenerationConstants::FOOTER_TEXT, '');
308 
309  $footer_text_left = new ilTextInputGUI($this->translate('footer_text_left'), 'footer_text_left');
310  $footer_text_option->addSubItem($footer_text_left);
311 
312  $footer_text_center = new ilTextInputGUI($this->translate('footer_text_center'), 'footer_text_center');
313  $footer_text_option->addSubItem($footer_text_center);
314 
315  $footer_text_right = new ilTextInputGUI($this->translate('footer_text_right'), 'footer_text_right');
316  $footer_text_option->addSubItem($footer_text_right);
317 
318  $footer_text_spacing = new ilTextInputGUI($this->translate('spacing'), 'footer_text_spacing');
319  $footer_text_option->addSubItem($footer_text_spacing);
320 
321  $footer_text_line = new ilCheckboxInputGUI($this->translate('footer_line'), 'footer_text_line');
322 
323  $footer_text_option->addSubItem($footer_text_line);
324  return $footer_text_option;
325  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildGreyScaleForm()

ilWkhtmlToPdfConfigFormGUI::buildGreyScaleForm ( )
protected
Returns
ilCheckboxInputGUI

Definition at line 103 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

104  {
105  $grey_scale = new ilCheckboxInputGUI($this->translate('greyscale'), 'greyscale');
106  $grey_scale->setInfo($this->translate('greyscale_info'));
107  return $grey_scale;
108  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeaderForm()

ilWkhtmlToPdfConfigFormGUI::buildHeaderForm ( )
protected
Returns
ilRadioGroupInputGUI

Definition at line 236 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References buildHeaderHtmlForm(), buildHeaderTextForm(), ilPDFGenerationConstants\HEADER_NONE, and translate().

Referenced by appendPageSettingsForm().

237  {
238  $header_select = new ilRadioGroupInputGUI($this->translate('header_type'), 'header_select');
239  $header_select->addOption(new ilRadioOption($this->translate('none'), ilPDFGenerationConstants::HEADER_NONE, ''));
240  $header_select->addOption($this->buildHeaderTextForm());
241  $header_select->addOption($this->buildHeaderHtmlForm());
242 
243  return $header_select;
244  }
This class represents an option in a radio group.
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeaderHtmlForm()

ilWkhtmlToPdfConfigFormGUI::buildHeaderHtmlForm ( )
protected
Returns
ilRadioOption

Definition at line 274 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\HEADER_HTML, and translate().

Referenced by buildHeaderForm().

275  {
276  $header_html_option = new ilRadioOption($this->translate("html"), ilPDFGenerationConstants::HEADER_HTML, '');
277 
278  $header_html = new ilTextInputGUI($this->translate('html'), 'head_html');
279  $header_html_option->addSubItem($header_html);
280 
281  $head_html_spacing = new ilTextInputGUI($this->translate('spacing'), 'head_html_spacing');
282  $header_html_option->addSubItem($head_html_spacing);
283 
284  $head_html_line = new ilCheckboxInputGUI($this->translate('header_line'), 'head_html_line');
285  $header_html_option->addSubItem($head_html_line);
286  return $header_html_option;
287  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeaderTextForm()

ilWkhtmlToPdfConfigFormGUI::buildHeaderTextForm ( )
protected
Returns
ilRadioOption

Definition at line 249 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\HEADER_TEXT, and translate().

Referenced by buildHeaderForm().

250  {
251  $header_text_option = new ilRadioOption($this->translate('text'), ilPDFGenerationConstants::HEADER_TEXT, '');
252 
253  $header_text_left = new ilTextInputGUI($this->translate('header_text_left'), 'head_text_left');
254  $header_text_option->addSubItem($header_text_left);
255 
256  $header_text_center = new ilTextInputGUI($this->translate('header_text_center'), 'head_text_center');
257  $header_text_option->addSubItem($header_text_center);
258 
259  $header_text_right = new ilTextInputGUI($this->translate('header_text_right'), 'head_text_right');
260  $header_text_option->addSubItem($header_text_right);
261 
262  $head_text_spacing = new ilTextInputGUI($this->translate('spacing'), 'head_text_spacing');
263  $header_text_option->addSubItem($head_text_spacing);
264 
265  $head_text_line = new ilCheckboxInputGUI($this->translate('header_line'), 'head_text_line');
266 
267  $header_text_option->addSubItem($head_text_line);
268  return $header_text_option;
269  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildJavascriptDelayForm()

ilWkhtmlToPdfConfigFormGUI::buildJavascriptDelayForm ( )
protected
Returns
ilTextInputGUI

Definition at line 123 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

124  {
125  $javascript_delay = new ilNumberInputGUI($this->translate('javascript_delay'), 'javascript_delay');
126  $javascript_delay->setMinValue(0);
127  $javascript_delay->setInfo($this->translate('javascript_delay_info'));
128  return $javascript_delay;
129  }
This class represents a number property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLowQualityForm()

ilWkhtmlToPdfConfigFormGUI::buildLowQualityForm ( )
protected
Returns
ilCheckboxInputGUI

Definition at line 93 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

94  {
95  $low_quality = new ilCheckboxInputGUI($this->translate('low_quality'), 'low_quality');
96  $low_quality->setInfo($this->translate('low_quality_info'));
97  return $low_quality;
98  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildMarginBottomForm()

ilWkhtmlToPdfConfigFormGUI::buildMarginBottomForm ( )
protected
Returns
ilTextInputGUI

Definition at line 225 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendPageSettingsForm().

226  {
227  $margin_bottom = new ilTextInputGUI($this->translate('margin_bottom'), 'margin_bottom');
228  $margin_bottom->setValidationRegexp('/(\d)+?(\W)*(cm|mm)$/');
229  $margin_bottom->setInfo($this->translate('margin_info'));
230  return $margin_bottom;
231  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildMarginLeftForm()

ilWkhtmlToPdfConfigFormGUI::buildMarginLeftForm ( )
protected
Returns
ilTextInputGUI

Definition at line 192 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendPageSettingsForm().

193  {
194  $margin_left = new ilTextInputGUI($this->translate('margin_left'), 'margin_left');
195  $margin_left->setValidationRegexp('/(\d)+?(\W)*(cm|mm)$/');
196  $margin_left->setInfo($this->translate('margin_info'));
197  return $margin_left;
198  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildMarginRightForm()

ilWkhtmlToPdfConfigFormGUI::buildMarginRightForm ( )
protected
Returns
ilTextInputGUI

Definition at line 203 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendPageSettingsForm().

204  {
205  $margin_right = new ilTextInputGUI($this->translate('margin_right'), 'margin_right');
206  $margin_right->setValidationRegexp('/(\d)+?(\W)*(cm|mm)$/');
207  $margin_right->setInfo($this->translate('margin_info'));
208  return $margin_right;
209  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildMarginTopForm()

ilWkhtmlToPdfConfigFormGUI::buildMarginTopForm ( )
protected
Returns
ilTextInputGUI

Definition at line 214 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendPageSettingsForm().

215  {
216  $margin_top = new ilTextInputGUI($this->translate('margin_top'), 'margin_top');
217  $margin_top->setValidationRegexp('/(\d)+?(\W)*(cm|mm)$/');
218  $margin_top->setInfo($this->translate('margin_info'));
219  return $margin_top;
220  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildOrientationsForm()

ilWkhtmlToPdfConfigFormGUI::buildOrientationsForm ( )
protected
Returns
ilSelectInputGUI

Definition at line 172 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\getOrientations(), and translate().

Referenced by appendPageSettingsForm().

173  {
174  $orientation = new ilSelectInputGUI($this->translate('orientation'), 'orientation');
175  $orientation->setOptions(ilPDFGenerationConstants::getOrientations());
176  return $orientation;
177  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildOverwriteDefaultFont()

ilWkhtmlToPdfConfigFormGUI::buildOverwriteDefaultFont ( )
protected
Returns
ilTextInputGUI

Definition at line 134 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\getFontStyles(), and translate().

Referenced by appendOutputOptionsForm().

135  {
136  $overwrite_font = new ilSelectInputGUI($this->translate('overwrite_font'), 'overwrite_font');
137  $overwrite_font->setOptions(ilPDFGenerationConstants::getFontStyles());
138  return $overwrite_font;
139  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPageSizesForm()

ilWkhtmlToPdfConfigFormGUI::buildPageSizesForm ( )
protected
Returns
ilSelectInputGUI

Definition at line 182 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPDFGenerationConstants\getPageSizesNames(), and translate().

Referenced by appendPageSettingsForm().

183  {
184  $page_size = new ilSelectInputGUI($this->translate('page_size'), 'page_size');
185  $page_size->setOptions(ilPDFGenerationConstants::getPageSizesNames());
186  return $page_size;
187  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPrintMediaTypeForm()

ilWkhtmlToPdfConfigFormGUI::buildPrintMediaTypeForm ( )
protected
Returns
ilCheckboxInputGUI

Definition at line 113 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

114  {
115  $print_media = new ilCheckboxInputGUI($this->translate('print_media_type'), 'print_media_type');
116  $print_media->setInfo($this->translate('print_media_info'));
117  return $print_media;
118  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildRadiobuttonSvgForm()

ilWkhtmlToPdfConfigFormGUI::buildRadiobuttonSvgForm ( )
protected

Definition at line 355 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendOutputOptionsForm().

356  {
357  return new ilTextInputGUI($this->translate('radio_button_svg'), 'radio_button_svg');
358  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildZoomForm()

ilWkhtmlToPdfConfigFormGUI::buildZoomForm ( )
protected
Returns
ilNumberInputGUI

Definition at line 164 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References translate().

Referenced by appendPageSettingsForm().

165  {
166  return new ilNumberInputGUI($this->translate('zoom'), 'zoom');
167  }
This class represents a number property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getConfigFromForm()

ilWkhtmlToPdfConfigFormGUI::getConfigFromForm ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
array

Definition at line 486 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), ilPDFGenerationConstants\getOrientations(), and ilUtil\stripSlashes().

487  {
488  $orientation = ilUtil::stripSlashes($form->getItemByPostVar('orientation')->getValue());
489  if(!in_array($orientation, ilPDFGenerationConstants::getOrientations())){
490  $orientation = 'Portrait';
491  }
492  $purifier = new ilHtmlForumPostPurifier();
493  return array(
494  'path' => ilUtil::stripSlashes($form->getItemByPostVar('path')->getValue()),
495  'zoom' => (float) $form->getItemByPostVar('zoom')->getValue(),
496  'external_links' => (int) $form->getItemByPostVar('external_links')->getChecked(),
497  'enable_forms' => (int) $form->getItemByPostVar('enable_forms')->getChecked(),
498  'low_quality' => (int) $form->getItemByPostVar('low_quality')->getChecked(),
499  'greyscale' => (int) $form->getItemByPostVar('greyscale')->getChecked(),
500  'orientation' => $orientation,
501  'page_size' => ilUtil::stripSlashes($form->getItemByPostVar('page_size')->getValue()),
502  'margin_left' => ilUtil::stripSlashes($form->getItemByPostVar('margin_left')->getValue()),
503  'margin_right' => ilUtil::stripSlashes($form->getItemByPostVar('margin_right')->getValue()),
504  'margin_top' => ilUtil::stripSlashes($form->getItemByPostVar('margin_top')->getValue()),
505  'margin_bottom' => ilUtil::stripSlashes($form->getItemByPostVar('margin_bottom')->getValue()),
506  'print_media_type' => (int) $form->getItemByPostVar('print_media_type')->getChecked(),
507  'javascript_delay' => (int) $form->getItemByPostVar('javascript_delay')->getValue(),
508  'checkbox_svg' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('checkbox_svg')->getValue())),
509  'checkbox_checked_svg' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('checkbox_checked_svg')->getValue())),
510  'radio_button_svg' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('radio_button_svg')->getValue())),
511  'radio_button_checked_svg' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('radio_button_checked_svg')->getValue())),
512  'header_select' => (int) $form->getItemByPostVar('header_select')->getValue(),
513  'head_text_left' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('head_text_left')->getValue())),
514  'head_text_center' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('head_text_center')->getValue())),
515  'head_text_right' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('head_text_right')->getValue())),
516  'head_text_spacing' => ilUtil::stripSlashes($form->getItemByPostVar('head_text_spacing')->getValue()),
517  'head_text_line' => ilUtil::stripSlashes($form->getItemByPostVar('head_text_line')->getValue()),
518  'head_html_line' => (int) $form->getItemByPostVar('head_html_line')->getValue(),
519  'head_html_spacing' => (int) $form->getItemByPostVar('head_html_spacing')->getValue(),
520  'head_html' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('head_html')->getValue())),
521  'footer_select' => ilUtil::stripSlashes($form->getItemByPostVar('footer_select')->getValue()),
522  'footer_text_left' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('footer_text_left')->getValue())),
523  'footer_text_right' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('footer_text_right')->getValue())),
524  'footer_text_spacing' => ilUtil::stripSlashes($form->getItemByPostVar('footer_text_spacing')->getValue()),
525  'footer_text_center' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('footer_text_center')->getValue())),
526  'footer_text_line' => (int) $form->getItemByPostVar('footer_text_line')->getValue(),
527  'footer_html' => $purifier->purify(ilUtil::stripSlashes($form->getItemByPostVar('footer_html')->getValue())),
528  'footer_html_spacing' => (int) $form->getItemByPostVar('footer_html_spacing')->getValue(),
529  'overwrite_font' => strtolower(ilUtil::stripSlashes($form->getItemByPostVar('overwrite_font')->getValue()))
530  );
531  }
Concrete class for sanitizing html of forum posts.
getItemByPostVar($a_post_var)
Get Item by POST variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ isNotValidSize()

ilWkhtmlToPdfConfigFormGUI::isNotValidSize ( array  $sizes)
private

Definition at line 451 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References $size.

Referenced by validateForm().

451  {
452  foreach($sizes as $size) {
453  if(! preg_match('/(\d)+?(\W)*(cm|mm)$/', $size)){
454  if($size !== 0 && $size !== null && $size !== "") {
455  return true;
456  }
457  }
458  }
459 
460  return false;
461  }
$size
Definition: RandomTest.php:84
+ Here is the caller graph for this function:

◆ isNotValidText()

ilWkhtmlToPdfConfigFormGUI::isNotValidText ( array  $texts)
private

Definition at line 463 of file class.ilWkhtmlToPdfConfigFormGUI.php.

Referenced by validateForm().

463  {
464  foreach($texts as $text) {
465  if(! preg_match('/[a-zA-Z\d ]+$/', $text)){
466  if($text !== '' && $text !== null && $text !== "") {
467  return true;
468  }
469  }
470  }
471 
472  return false;
473  }
+ Here is the caller graph for this function:

◆ populateForm()

ilWkhtmlToPdfConfigFormGUI::populateForm (   $form,
  $config 
)
Parameters
ilPropertyFormGUI$form
ilWkhtmlToPdfConfig$config

Definition at line 537 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References $config, and ilPDFGeneratorUtils\setCheckedIfTrue().

538  {
539  $form->getItemByPostVar('path')->setValue($config->getWKHTMLToPdfDefaultPath());
540  $form->getItemByPostVar('zoom')->setValue($config->getZoom());
541  $form->getItemByPostVar('external_links')->setValue(1);
542  $form->getItemByPostVar('external_links')->setChecked($config->getExternalLinks());
543  $form->getItemByPostVar('enable_forms')->setValue(1);
544  $form->getItemByPostVar('enable_forms')->setChecked($config->getEnabledForms());
545  $form->getItemByPostVar('low_quality')->setValue(1);
546  $form->getItemByPostVar('low_quality')->setChecked($config->getLowQuality());
547  $form->getItemByPostVar('greyscale')->setValue(1);
548  $form->getItemByPostVar('greyscale')->setChecked($config->getGreyscale());
549  $form->getItemByPostVar('orientation')->setValue($config->getOrientation());
550  $form->getItemByPostVar('page_size')->setValue($config->getPageSize());
551  $form->getItemByPostVar('margin_left')->setValue($config->getMarginLeft());
552  $form->getItemByPostVar('margin_right')->setValue($config->getMarginRight());
553  $form->getItemByPostVar('margin_top')->setValue($config->getMarginTop());
554  $form->getItemByPostVar('margin_bottom')->setValue($config->getMarginBottom());
555  $form->getItemByPostVar('print_media_type')->setValue(1);
556  $form->getItemByPostVar('print_media_type')->setChecked($config->getPrintMediaType());
557  $form->getItemByPostVar('javascript_delay')->setValue($config->getJavascriptDelay());
558  $form->getItemByPostVar('checkbox_svg')->setValue($config->getCheckboxSvg());
559  $form->getItemByPostVar('checkbox_checked_svg')->setValue($config->getCheckboxCheckedSvg());
560  $form->getItemByPostVar('radio_button_svg')->setValue($config->getRadioButtonSvg());
561  $form->getItemByPostVar('radio_button_checked_svg')->setValue($config->getRadioButtonCheckedSvg());
562  $form->getItemByPostVar('header_select')->setValue($config->getHeaderType());
563  $form->getItemByPostVar('head_text_left')->setValue($config->getHeaderTextLeft());
564  $form->getItemByPostVar('head_text_center')->setValue($config->getHeaderTextCenter());
565  $form->getItemByPostVar('head_text_right')->setValue($config->getHeaderTextRight());
566  $form->getItemByPostVar('head_text_spacing')->setValue($config->getHeaderTextSpacing());
567  $form->getItemByPostVar('head_text_line')->setValue(1);
568  $form->getItemByPostVar('head_text_line')->setChecked($config->isHeaderTextLine());
569  $form->getItemByPostVar('head_html_line')->setValue(1);
570  $form->getItemByPostVar('head_html_line')->setChecked($config->isHeaderHtmlLine());
571  $form->getItemByPostVar('head_html_spacing')->setValue($config->getHeaderHtmlSpacing());
572  $form->getItemByPostVar('head_html')->setValue($config->getHeaderHtml());
573  $form->getItemByPostVar('footer_select')->setValue($config->getFooterType());
574  $form->getItemByPostVar('footer_text_left')->setValue($config->getFooterTextLeft());
575  $form->getItemByPostVar('footer_text_center')->setValue($config->getFooterTextCenter());
576  $form->getItemByPostVar('footer_text_right')->setValue($config->getFooterTextRight());
577  $form->getItemByPostVar('footer_text_spacing')->setValue($config->getFooterTextSpacing());
578  $form->getItemByPostVar('footer_text_line')->setValue(1);
579  $form->getItemByPostVar('footer_text_line')->setChecked($config->isFooterTextLine());
580  $form->getItemByPostVar('footer_html_line')->setValue(1);
581  $form->getItemByPostVar('footer_html_line')->setChecked($config->isFooterHtmlLine());
582  $form->getItemByPostVar('footer_html')->setValue($config->getFooterHtml());
583  $form->getItemByPostVar('footer_html_spacing')->setValue($config->getFooterHtmlSpacing());
584  $form->getItemByPostVar('overwrite_font')->setValue($config->getOverwriteDefaultFont(false));
585 
587  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
static setCheckedIfTrue(\ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ saveNewDefaultBinaryPath()

ilWkhtmlToPdfConfigFormGUI::saveNewDefaultBinaryPath (   $path)
protected
Parameters
$path

Definition at line 477 of file class.ilWkhtmlToPdfConfigFormGUI.php.

Referenced by validateForm().

477  {
478  $settings = new ilSetting('wkhtmltopdfrenderer');
479  $settings->set('path', $path);
480  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilWkhtmlToPdfConfigFormGUI::setLanguage (   $lng)
protected
Parameters
$lng

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

References $lng.

Referenced by __construct().

23  {
24  $this->lng = $lng;
25  }
+ Here is the caller graph for this function:

◆ translate()

◆ validateForm()

ilWkhtmlToPdfConfigFormGUI::validateForm ( )
Returns
bool

Definition at line 368 of file class.ilWkhtmlToPdfConfigFormGUI.php.

References $_POST, $config, ilUtil\escapeShellCmd(), ilPDFGenerationConstants\getOrientations(), isNotValidSize(), isNotValidText(), saveNewDefaultBinaryPath(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

369  {
370  $everything_ok = true;
372  $path = realpath(ilUtil::escapeShellCmd($_POST['path']));
373  $config->setPath($path);
374  $orientation = ilUtil::stripSlashes($_POST['orientation']);
375  $margin_left = ilUtil::stripSlashes($_POST['margin_left']);
376  $margin_right = ilUtil::stripSlashes($_POST['margin_right']);
377  $margin_top = ilUtil::stripSlashes($_POST['margin_top']);
378  $margin_bottom = ilUtil::stripSlashes($_POST['margin_bottom']);
379  $footer_text_spacing = (int) $_POST['footer_text_spacing'];
380  $footer_html_spacing = (int) $_POST['footer_html_spacing'];
381  $head_text_spacing = (int) $_POST['head_text_spacing'];
382  $head_html_spacing = (int) $_POST['head_html_spacing'];
383  $footer_text_left = ilUtil::stripSlashes($_POST['footer_text_left']);
384  $footer_text_center = ilUtil::stripSlashes($_POST['footer_text_center']);
385  $footer_text_right = ilUtil::stripSlashes($_POST['footer_text_right']);
386  $header_text_left = ilUtil::stripSlashes($_POST['head_text_left']);
387  $header_text_center = ilUtil::stripSlashes($_POST['head_text_center']);
388  $header_text_right = ilUtil::stripSlashes($_POST['head_text_right']);
389  $sizes = [
390  $margin_left, $margin_right, $margin_top, $margin_bottom, $footer_text_spacing, $footer_html_spacing, $head_text_spacing, $head_html_spacing
391  ];
392  $header_footer_texts = [
393  $footer_text_left, $footer_text_center, $footer_text_right, $header_text_left, $header_text_center, $header_text_right
394  ];
395  if (mb_stripos($config->getPath(), 'wkhtmlto') === false) {
396  ilUtil::sendFailure($this->lng->txt("file_not_found"), true);
397  $everything_ok = false;
398  } elseif(!in_array($orientation, ilPDFGenerationConstants::getOrientations()))
399  {
400  $everything_ok = false;
401  } elseif($this->isNotValidSize($sizes))
402  {
403  $everything_ok = false;
404  } elseif($this->isNotValidText($header_footer_texts))
405  {
406  $everything_ok = false;
407  }
408  else {
409  $config->setZoom((float) $_POST['zoom']);
410  $config->setExternalLinks((int) $_POST['external_links']);
411  $config->setEnabledForms((int) $_POST['enable_forms']);
412  $config->setLowQuality((int) $_POST['low_quality']);
413  $config->setGreyscale((int) $_POST['greyscale']);
414  $config->setOrientation($orientation);
415  $config->setPageSize(ilUtil::stripSlashes($_POST['page_size']));
416  $config->setMarginLeft(ilUtil::stripSlashes($_POST['margin_left']));
417  $config->setMarginRight(ilUtil::stripSlashes($_POST['margin_right']));
418  $config->setMarginTop(ilUtil::stripSlashes($_POST['margin_top']));
419  $config->setMarginBottom(ilUtil::stripSlashes($_POST['margin_bottom']));
420  $config->setPrintMediaType((int) $_POST['print_media_type']);
421  $config->setJavascriptDelay((int) $_POST['javascript_delay']);
422  $config->setCheckboxSvg(ilUtil::stripSlashes($_POST['checkbox_svg']));
423  $config->setCheckboxCheckedSvg(ilUtil::stripSlashes($_POST['checkbox_checked_svg']));
424  $config->setRadioButtonSvg(ilUtil::stripSlashes($_POST['radio_button_svg']));
425  $config->setRadioButtonCheckedSvg(ilUtil::stripSlashes($_POST['radio_button_checked_svg']));
426  $config->setHeaderType((int) $_POST['header_select']);
427  $config->setHeaderTextLeft(ilUtil::stripSlashes($header_text_left));
428  $config->setHeaderTextCenter(ilUtil::stripSlashes($header_text_center));
429  $config->setHeaderTextRight(ilUtil::stripSlashes($header_text_right));
430  $config->setHeaderTextSpacing((int) $head_text_spacing);
431  $config->setHeaderTextLine((int) $_POST['head_text_line']);
432  $config->setHeaderHtmlLine((int) $_POST['head_html_line']);
433  $config->setHeaderHtmlSpacing((int) $head_html_spacing);
434  $config->setHeaderHtml(ilUtil::stripSlashes($_POST['head_html']));
435  $config->setFooterType((int) $_POST['footer_select']);
436  $config->setFooterTextLeft($footer_text_left);
437  $config->setFooterTextCenter($footer_text_center);
438  $config->setFooterTextRight($footer_text_right);
439  $config->setFooterTextSpacing($footer_text_spacing);
440  $config->setFooterTextLine((int) $_POST['footer_text_line']);
441  $config->setFooterHtmlLine((int) $_POST['footer_html_line']);
442  $config->setFooterHtmlSpacing((int) $footer_html_spacing);
443  $config->setFooterHtml(ilUtil::stripSlashes($_POST['footer_html']));
444  $config->setOverwriteDefaultFont(strtolower(ilUtil::stripSlashes($_POST['overwrite_font'])));
445  $this->saveNewDefaultBinaryPath($config->getPath());
446  }
447 
448  return $everything_ok;
449  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
static escapeShellCmd($a_arg)
escape shell cmd
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilWkhtmlToPdfConfigFormGUI::$lng
protected

Definition at line 8 of file class.ilWkhtmlToPdfConfigFormGUI.php.

Referenced by setLanguage().


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