36 include_once
"./classes/class.ilObjectGUI.php";
48 global $rbacsystem,
$lng;
51 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
52 $this->lng->loadLanguageModule(
'spdf');
53 $this->lng->loadLanguageModule(
'meta');
55 if (!$rbacsystem->checkAccess(
'read',$this->object->getRefId()))
57 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read_spdf"),$this->ilias->error_obj->WARNING);
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
70 case 'ilpermissiongui':
71 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
73 $ret =& $this->ctrl->forwardCommand($perm_gui);
106 $this->ctrl->redirect($this);
115 if (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
'ref_id']))
117 $ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
122 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
124 $form->setFormAction($this->ctrl->getFormAction($this));
125 $form->setTableWidth(
"100%");
126 $form->setId(
"settings");
130 $header->setTitle($this->lng->txt(
"pdf_html_to_pdf_settings"));
131 $form->addItem($header);
133 $method =
new ilSelectInputGUI($this->lng->txt(
"pdf_html_to_pdf_method"),
"html_to_pdf_method");
135 $options[
'none'] = $this->lng->txt(
'pdf_html_to_pdf_method_not_available');
136 include_once
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
139 $options[
'fop'] = $this->lng->txt(
'pdf_html_to_pdf_method_fop');
141 if (strlen($pdfSetting->get(
"path_to_wkhtml")))
143 $options[
'webkit'] = $this->lng->txt(
'pdf_html_to_pdf_method_webkit');
146 $method->setValue((strlen($pdfSetting->get(
'html_to_pdf_method'))) ? $pdfSetting->get(
'html_to_pdf_method') :
'none');
147 $method->setRequired(
true);
148 $form->addItem($method);
150 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
152 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
154 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
161 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) $ilCtrl->redirect($this,
"settings");
163 $pdfSetting->set(
"html_to_pdf_method",
$_POST[
"html_to_pdf_method"]);
165 $ilCtrl->redirect($this,
"settings");
174 if (!$ilAccess->checkAccess(
"visible",
"",
$_GET[
'ref_id']))
176 $ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
180 $wkhtmltopdf = array_key_exists(
"path_to_wkhtml",
$_GET) ?
$_GET[
"path_to_wkhtml"] : $pdfSetting->get(
"path_to_wkhtml");
182 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
184 $form->setFormAction($this->ctrl->getFormAction($this));
185 $form->setTableWidth(
"100%");
186 $form->setId(
"settings");
190 $header->setTitle($this->lng->txt(
"pdf_wkhtml_settings"));
191 $form->addItem($header);
193 $path_to_wkhtml =
new ilTextInputGUI($this->lng->txt(
"pdf_path_to_wkhtml"),
"path_to_wkhtml");
195 $path_to_wkhtml->setValue($wkhtmltopdf);
196 if (!@file_exists($wkhtmltopdf) && strlen($wkhtmltopdf)) $path_to_wkhtml->setAlert($this->lng->txt(
'pdf_file_path_not_found'));
197 $form->addItem($path_to_wkhtml);
200 $wkhtml_info->setInfo($this->lng->txt(
'pdf_wkhtml_info'));
201 $form->addItem($wkhtml_info);
204 $headers_footer->setTitle($this->lng->txt(
"pdf_headers_footer_options"));
205 $form->addItem($headers_footer);
207 $header_font_size =
new ilNumberInputGUI($this->lng->txt(
"pdf_header_font_size"),
"args_header_font_size");
209 $header_font_size->setSize(3);
210 $header_font_size->setValue(strlen($pdfSetting->get(
"args_header_font_size")) ? $pdfSetting->get(
"args_header_font_size") :
"9");
211 $form->addItem($header_font_size);
213 $header_left =
new ilTextInputGUI($this->lng->txt(
"pdf_header_left"),
"args_header_left");
215 $header_left->setValue(strlen($pdfSetting->get(
"args_header_left")) ? $pdfSetting->get(
"args_header_left") :
"[date]");
216 $form->addItem($header_left);
218 $header_center =
new ilTextInputGUI($this->lng->txt(
"pdf_header_center"),
"args_header_center");
220 $header_center->setValue(strlen($pdfSetting->get(
"args_header_center")) ? $pdfSetting->get(
"args_header_center") :
"ILIAS Open Source");
221 $form->addItem($header_center);
223 $header_right =
new ilTextInputGUI($this->lng->txt(
"pdf_header_right"),
"args_header_right");
225 $header_right->setValue(strlen($pdfSetting->get(
"args_header_right")) ? $pdfSetting->get(
"args_header_right") :
"[time]");
226 $form->addItem($header_right);
228 $header_line =
new ilCheckboxInputGUI($this->lng->txt(
"pdf_header_line"),
"args_header_line");
230 $header_line->setChecked((strcmp($pdfSetting->get(
"args_header_line"),
'--header-line') == 0) ?
true :
false);
231 $header_line->setOptionTitle($this->lng->txt(
"pdf_header_line_desc"));
232 $form->addItem($header_line);
234 $footer_font_size =
new ilNumberInputGUI($this->lng->txt(
"pdf_footer_font_size"),
"args_footer_font_size");
236 $footer_font_size->setSuffix(
'pt');
237 $footer_font_size->setValue(strlen($pdfSetting->get(
"args_footer_font_size")) ? $pdfSetting->get(
"args_footer_font_size") :
"9");
238 $form->addItem($footer_font_size);
240 $footer_left =
new ilTextInputGUI($this->lng->txt(
"pdf_footer_left"),
"args_footer_left");
242 $footer_left->setValue(strlen($pdfSetting->get(
"args_footer_left")) ? $pdfSetting->get(
"args_footer_left") :
"");
243 $form->addItem($footer_left);
245 $footer_center =
new ilTextInputGUI($this->lng->txt(
"pdf_footer_center"),
"args_footer_center");
247 $footer_center->setValue(strlen($pdfSetting->get(
"args_footer_center")) ? $pdfSetting->get(
"args_footer_center") :
"");
248 $form->addItem($footer_center);
250 $footer_right =
new ilTextInputGUI($this->lng->txt(
"pdf_footer_right"),
"args_footer_right");
252 $footer_right->setValue(strlen($pdfSetting->get(
"args_footer_right")) ? $pdfSetting->get(
"args_footer_right") :
"[page]/[toPage]");
253 $form->addItem($footer_right);
255 $footer_line =
new ilCheckboxInputGUI($this->lng->txt(
"pdf_footer_line"),
"args_footer_line");
257 $footer_line->setChecked((strcmp($pdfSetting->get(
"args_footer_line"),
'--footer-line') == 0) ?
true :
false);
258 $footer_line->setOptionTitle($this->lng->txt(
"pdf_footer_line_desc"));
259 $form->addItem($footer_line);
262 $headers_info->setInfo($this->lng->txt(
'pdf_header_footer_parm_desc'));
263 $form->addItem($headers_info);
266 $page_options->setTitle($this->lng->txt(
"pdf_page_options"));
267 $form->addItem($page_options);
270 $zoom->
setSuffix($this->lng->txt(
"pdf_zoom_suffix"));
272 $zoom->setValue(strlen($pdfSetting->get(
"args_zoom")) ? $pdfSetting->get(
"args_zoom") : 0.75);
273 $form->addItem($zoom);
275 $external_links =
new ilCheckboxInputGUI($this->lng->txt(
"pdf_external_links"),
"args_external_links");
277 $external_links->setChecked((strlen($pdfSetting->get(
"args_footer_line")) == 0 || strcmp($pdfSetting->get(
"args_footer_line"),
'--enable-external-links') == 1) ?
true :
false);
278 $external_links->setOptionTitle($this->lng->txt(
"pdf_external_links_desc"));
279 $form->addItem($external_links);
281 $enable_forms =
new ilCheckboxInputGUI($this->lng->txt(
"pdf_enable_forms"),
"args_enable_forms");
283 $enable_forms->setChecked((strcmp($pdfSetting->get(
"args_enable_forms"),
'--enable-forms') == 1) ?
true :
false);
284 $enable_forms->setOptionTitle($this->lng->txt(
"pdf_enable_forms_desc"));
285 $form->addItem($enable_forms);
287 $user_style_sheet =
new ilTextInputGUI($this->lng->txt(
"pdf_user_style_sheet"),
"args_user_style_sheet");
288 $user_style_sheet->
setInfo($this->lng->txt(
"pdf_user_style_sheet_desc"));
289 $user_style_sheet->setSuffix($this->lng->txt(
"url"));
290 $user_style_sheet->setSize(50);
291 $user_style_sheet->setValue(strlen($pdfSetting->get(
"args_user_style_sheet")) ? $pdfSetting->get(
"args_user_style_sheet") :
"");
292 $form->addItem($user_style_sheet);
294 $page_size =
new ilSelectInputGUI($this->lng->txt(
"pdf_page_size"),
"args_page_size");
295 $pagesizes = array(
'A0',
'A1',
'A2',
'A3',
'A4',
'A5',
'A6',
'A7',
'A8',
'A9',
'B0',
'B1',
'B2',
'B3',
'B4',
'B5',
'B6',
'B7',
'B8',
'B9',
'B10',
'CSE',
'Comm10E',
'DLE',
'Executive',
'Folio',
'Ledger',
'Legal',
'Letter',
'Tabloid');
297 foreach ($pagesizes as $size)
299 $options[$size] = $size;
301 $page_size->setOptions($options);
302 $page_size->setValue((strlen($pdfSetting->get(
'args_page_size')) == 0) ?
'A4' : $pdfSetting->get(
'args_page_size'));
303 $page_size->setRequired(
true);
304 $form->addItem($page_size);
306 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
308 $form->addCommandButton(
"saveWebkit", $this->lng->txt(
"save"));
310 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
320 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) $ilCtrl->redirect($this,
"settings");
322 $pdfSetting->set(
"path_to_wkhtml",
$_POST[
"path_to_wkhtml"]);
323 $pdfSetting->set(
"args_header_font_size",
$_POST[
"args_header_font_size"]);
324 $pdfSetting->set(
"args_header_left",
$_POST[
"args_header_left"]);
325 $pdfSetting->set(
"args_header_center",
$_POST[
"args_header_center"]);
326 $pdfSetting->set(
"args_header_right",
$_POST[
"args_header_right"]);
327 $pdfSetting->set(
"args_header_line", (
$_POST[
"args_header_line"] == 1) ?
'--header-line' :
'--no-header-line');
328 $pdfSetting->set(
"args_footer_font_size",
$_POST[
"args_footer_font_size"]);
329 $pdfSetting->set(
"args_footer_left",
$_POST[
"args_footer_left"]);
330 $pdfSetting->set(
"args_footer_center",
$_POST[
"args_footer_center"]);
331 $pdfSetting->set(
"args_footer_right",
$_POST[
"args_footer_right"]);
332 $pdfSetting->set(
"args_footer_line", (
$_POST[
"args_footer_line"] == 1) ?
'--footer-line' :
'--no-footer-line');
333 $pdfSetting->set(
"args_zoom",
$_POST[
"args_zoom"]);
334 $pdfSetting->set(
"args_external_links", (
$_POST[
"args_external_links"] == 1) ?
'--enable-external-links' :
'--disable-external-links');
335 $pdfSetting->set(
"args_enable_forms", (
$_POST[
"args_enable_forms"] == 1) ?
'--enable-forms' :
'--disable-forms');
336 $pdfSetting->set(
"args_user_style_sheet",
$_POST[
"args_user_style_sheet"]);
337 $pdfSetting->set(
"args_page_size",
$_POST[
"args_page_size"]);
339 $ilCtrl->redirect($this,
"webkit");
356 if ($ilAccess->checkAccess(
"read",
'',$this->object->getRefId()))
358 $tabs_gui->addTarget(
"spdf_settings", $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"saveSettings",
"",
"view"),
"",
"");
359 $tabs_gui->addTarget(
"webkit", $this->ctrl->getLinkTarget($this,
"webkit"), array(
"webkit",
"saveWebkit"),
"",
"");
361 if ($ilAccess->checkAccess(
"edit_permission",
'',$this->object->getRefId()))
363 $tabs_gui->addTarget(
"perm_settings",
364 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');