19 declare(strict_types=1);
46 $this->ui_factory = $DIC->ui()->factory();
47 $this->ui_renderer = $DIC->ui()->renderer();
48 $this->
ctrl = $DIC->ctrl();
49 $this->
lng = $DIC->language();
57 return $this->ui_factory->input()->container()->form()->standard(
65 $wopi_activated = (bool) $this->
settings->get(
"wopi_activated",
'0');
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;
70 $wopi_url = $this->ui_factory->input()->field()->text(
71 $this->
lng->txt(
"wopi_url"),
72 $this->
lng->txt(
"wopi_url_byline")
79 $this->
refinery->custom()->transformation(fn($v) => $v ===
'' ?
null : $v)
81 $this->
refinery->custom()->constraint(
function ($v):
bool {
86 }, $this->
lng->txt(
'msg_error_wopi_invalid_discorvery_url'))
87 )->withAdditionalTransformation(
88 $this->
refinery->custom()->transformation(
function ($v):
true {
89 $this->
settings->set(
"wopi_discovery_url", $v);
94 $wopi_discovery_url ??
'' 97 $saving_interval = $this->ui_factory->input()->field()->optionalGroup(
103 $this->
lng->txt(
"saving_interval"),
104 $this->
lng->txt(
"saving_interval_byline")
107 $this->
refinery->custom()->transformation(fn($v) => $v ===
'' ?
null : $v)
109 $this->
refinery->custom()->transformation(
function ($v):
true {
110 if ($v ===
null || $v === 0) {
111 $this->
settings->delete(
"saving_interval");
115 $this->
settings->set(
"saving_interval", (
string) $v);
120 $saving_interval_value
123 $this->
lng->txt(
"activate_saving_interval")
125 $saving_interval_value ===
null ?
null : [$saving_interval_value]
126 )->withAdditionalTransformation(
127 $this->
refinery->custom()->transformation(
function ($v) {
129 $this->
settings->delete(
"saving_interval");
135 return $this->ui_factory->input()->field()->section(
137 $this->ui_factory->input()->field()->optionalGroup(
138 [$wopi_url, $saving_interval],
139 $this->
lng->txt(
"activate_wopi")
141 $wopi_discovery_url ===
null ?
null : [
143 $saving_interval_value ===
null ?
null : [$saving_interval_value]
145 )->withAdditionalTransformation(
146 $this->
refinery->custom()->transformation(
function ($v) {
148 $this->
settings->set(
"wopi_activated",
'0');
149 $this->
settings->delete(
"wopi_discovery_url");
151 $this->
settings->set(
"wopi_activated",
"1");
157 $this->
lng->txt(
"wopi_settings"),
163 $this->
form = $this->
form->withRequest($request);
165 return $this->
form->getData() !==
null;
170 return $this->ui_renderer->render($this->
form);
173 private function renderLink(
string $translation,
string $url,
bool $new_tab =
true): string
175 $link = $this->ui_factory->link()->standard(
178 )->withOpenInNewViewport($new_tab);
179 return $this->ui_renderer->render($link);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This is how the factory for UI elements looks.
form( $class_path, string $cmd, string $submit_caption="")