ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWOPISettingsForm Class Reference
+ Collaboration diagram for ilWOPISettingsForm:

Public Member Functions

 __construct (private Setting $settings, private bool $write_access)
 
 proceed (RequestInterface $request)
 
 getHTML ()
 

Private Member Functions

 initForm ()
 
 getSection ()
 

Private Attributes

Standard $form
 
Factory $ui_factory
 
Renderer $ui_renderer
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ILIAS Refinery Factory $refinery
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWOPISettingsForm::__construct ( private Setting  $settings,
private bool  $write_access 
)

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

45 {
46 global $DIC;
47 $this->ui_factory = $DIC->ui()->factory();
48 $this->ui_renderer = $DIC->ui()->renderer();
49 $this->ctrl = $DIC->ctrl();
50 $this->lng = $DIC->language();
51 $this->refinery = $DIC->refinery();
52
53 $this->form = $this->initForm();
54 }
form( $class_path, string $cmd, string $submit_caption="")
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initForm(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilWOPISettingsForm::getHTML ( )

Definition at line 177 of file class.ilWOPISettingsForm.php.

177 : string
178 {
179 return $this->ui_renderer->render($this->form);
180 }

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ getSection()

ilWOPISettingsForm::getSection ( )
private

Definition at line 64 of file class.ilWOPISettingsForm.php.

64 : Section
65 {
66 $wopi_discovery_url = $this->settings->get("wopi_discovery_url");
67 $saving_interval_value = (int) $this->settings->get("saving_interval", '0');
68 $saving_interval_value = $saving_interval_value === 0 ? null : $saving_interval_value;
69
70 $wopi_url = $this->ui_factory
71 ->input()
72 ->field()
73 ->text(
74 $this->lng->txt("wopi_url"),
75 $this->lng->txt("wopi_url_byline")
76 )
77 ->withDisabled(!$this->write_access)
78 ->withAdditionalTransformation(
79 $this->refinery->custom()->transformation(fn($v) => $v === '' ? null : $v)
81 $this->refinery->custom()->constraint(function ($v): bool {
82 if ($v === null) {
83 return false;
84 }
85 return (new Crawler())->validate(new URI($v));
86 }, $this->lng->txt('msg_error_wopi_invalid_discorvery_url'))
88 $this->refinery->custom()->transformation(function ($v): true {
89 $this->settings->set("wopi_discovery_url", $v);
90
91 return true;
92 })
93 )->withValue(
94 $wopi_discovery_url ?? ''
95 );
96
97 $saving_interval = $this->ui_factory->input()->field()->optionalGroup(
98 [
99 $this->ui_factory
100 ->input()
101 ->field()
102 ->numeric(
103 $this->lng->txt("saving_interval"),
104 $this->lng->txt("saving_interval_byline")
105 )
106 ->withDisabled(!$this->write_access)
107 ->withAdditionalTransformation(
108 $this->refinery->custom()->transformation(fn($v) => $v === '' ? null : $v)
109 )->withAdditionalTransformation(
110 $this->refinery->custom()->transformation(function ($v): true {
111 if ($v === null || $v === 0) {
112 $this->settings->delete("saving_interval");
113 return true;
114 }
115
116 $this->settings->set("saving_interval", (string) $v);
117
118 return true;
119 })
120 )->withValue(
121 $saving_interval_value
122 )
123 ],
124 $this->lng->txt("activate_saving_interval")
125 )->withValue(
126 $saving_interval_value === null ? null : [$saving_interval_value]
127 )->withAdditionalTransformation(
128 $this->refinery->custom()->transformation(function ($v) {
129 if ($v === null || $v === [null]) {
130 $this->settings->delete("saving_interval");
131 }
132 return $v;
133 })
134 );
135
136 return $this->ui_factory
137 ->input()
138 ->field()
139 ->section(
140 [
141 $this->ui_factory
142 ->input()
143 ->field()
144 ->optionalGroup(
145 [$wopi_url, $saving_interval],
146 $this->lng->txt("activate_wopi")
147 )
148 ->withDisabled(!$this->write_access)
149 ->withValue(
150 $wopi_discovery_url === null ? null : [
151 $wopi_discovery_url,
152 $saving_interval_value === null ? null : [$saving_interval_value]
153 ]
154 )->withAdditionalTransformation(
155 $this->refinery->custom()->transformation(function ($v) {
156 if ($v === null || $v === [null]) {
157 $this->settings->set("wopi_activated", '0');
158 $this->settings->delete("wopi_discovery_url");
159 } else {
160 $this->settings->set("wopi_activated", "1");
161 }
162 return $v;
163 })
164 )
165 ],
166 $this->lng->txt("wopi_settings"),
167 );
168 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
This describes section inputs.
Definition: Section.php:29
withAdditionalTransformation(Transformation $trafo)
@inheritDoc
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61

References ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

+ Here is the call graph for this function:

◆ initForm()

ilWOPISettingsForm::initForm ( )
private

Definition at line 56 of file class.ilWOPISettingsForm.php.

56 : Standard
57 {
58 return $this->ui_factory->input()->container()->form()->standard(
59 $this->ctrl->getFormActionByClass(ilWOPIAdministrationGUI::class, ilWOPIAdministrationGUI::CMD_STORE),
60 $this->getSection()->getInputs()
61 );
62 }
This describes a standard form.
Definition: Standard.php:29

References ilWOPIAdministrationGUI\CMD_STORE, and ILIAS\Repository\ctrl().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ proceed()

ilWOPISettingsForm::proceed ( RequestInterface  $request)

Definition at line 170 of file class.ilWOPISettingsForm.php.

170 : bool
171 {
172 $this->form = $this->form->withRequest($request);
173
174 return $this->form->getData() !== null;
175 }

References ILIAS\Repository\form().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilWOPISettingsForm::$ctrl
private

Definition at line 38 of file class.ilWOPISettingsForm.php.

◆ $form

Standard ilWOPISettingsForm::$form
private

Definition at line 35 of file class.ilWOPISettingsForm.php.

◆ $lng

ilLanguage ilWOPISettingsForm::$lng
private

Definition at line 39 of file class.ilWOPISettingsForm.php.

◆ $refinery

ILIAS Refinery Factory ilWOPISettingsForm::$refinery
private

Definition at line 40 of file class.ilWOPISettingsForm.php.

◆ $ui_factory

Factory ilWOPISettingsForm::$ui_factory
private

Definition at line 36 of file class.ilWOPISettingsForm.php.

◆ $ui_renderer

Renderer ilWOPISettingsForm::$ui_renderer
private

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


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