ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
JavaServerGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Administration;
22
23use ilCtrl;
25use ilLanguage;
29
35readonly class JavaServerGUI
36{
37 public function __construct(
38 private ilCtrl $ctrl,
39 private ilGlobalTemplateInterface $tpl,
40 private ilLanguage $lng,
41 private Setting $settings,
42 private bool $has_write_access
43 ) {
44 }
45
46 public function executeCommand()
47 {
48 $cmd = $this->ctrl->getCmd("view");
49 switch ($cmd) {
50 case 'view':
51 $this->view();
52 break;
53
54 case 'update':
55 if ($this->has_write_access) {
56 $this->update();
57 }
58 break;
59 }
60 }
61
62 public function view(): void
63 {
64 $this->tpl->setContent($this->buildForm()->getHTML());
65 }
66
67 public function update(): void
68 {
69 $form = $this->buildForm();
70 if ($form->checkInput()) {
71 $this->settings->set('rpc_pdf_font', $form->getInput('rpc_pdf_font'));
72 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
73 $this->ctrl->redirect($this);
74 }
75 $form->setValuesByPost();
76 $this->tpl->setContent($form->getHtml());
77 }
78
79 public function buildForm(): ilPropertyFormGUI
80 {
81 $form = new ilPropertyFormGUI();
82 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
83
84 // pdf fonts
85 $pdf = new ilFormSectionHeaderGUI();
86 $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
87 $form->addItem($pdf);
88
89 $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
90 $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
91 $pdf_font->setSize(64);
92 $pdf_font->setMaxLength(1024);
93 $pdf_font->setRequired(true);
94 $pdf_font->setValue($this->settings->get('rpc_pdf_font', 'Helvetica, unifont'));
95 $form->addItem($pdf_font);
96
97 if ($this->has_write_access) {
98 $form->addCommandButton("update", $this->lng->txt("save"));
99 }
100 return $form;
101 }
102}
GUI for Java Server Settings.
__construct(private ilCtrl $ctrl, private ilGlobalTemplateInterface $tpl, private ilLanguage $lng, private Setting $settings, private bool $has_write_access)
Class ilCtrl provides processing control methods.
This class represents a section header in a property form.
language handling
This class represents a property form user interface.
This class represents a text property in a property form.
global $lng
Definition: privfeed.php:31