ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWOPISettingsForm Class Reference
+ Collaboration diagram for ilWOPISettingsForm:

Public Member Functions

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

Private Member Functions

 initForm ()
 
 getSection ()
 
 renderLink (string $translation, string $url, bool $new_tab=true)
 

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)

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

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

44  {
45  global $DIC;
46  $this->ui_factory = $DIC->ui()->factory();
47  $this->ui_renderer = $DIC->ui()->renderer();
48  $this->ctrl = $DIC->ctrl();
49  $this->lng = $DIC->language();
50  $this->refinery = $DIC->refinery();
51 
52  $this->form = $this->initForm();
53  }
global $DIC
Definition: shib_login.php:22
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilWOPISettingsForm::getHTML ( )

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

References ILIAS\Repository\form().

168  : string
169  {
170  return $this->ui_renderer->render($this->form);
171  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ getSection()

ilWOPISettingsForm::getSection ( )
private

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

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

Referenced by initForm().

63  : Section
64  {
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;
69 
70  $wopi_url = $this->ui_factory->input()->field()->text(
71  $this->lng->txt("wopi_url"),
72  $this->lng->txt("wopi_url_byline")
73  /*. $this->renderLink(
74  " ➜︎ Wikipedia",
75  "https://en.wikipedia.org/wiki/Web_Application_Open_Platform_Interface",
76  true
77  )*/
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'))
87  )->withAdditionalTransformation(
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  )
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");
112  return true;
113  }
114 
115  $this->settings->set("saving_interval", (string) $v);
116 
117  return true;
118  })
119  )->withValue(
120  $saving_interval_value
121  )
122  ],
123  $this->lng->txt("activate_saving_interval")
124  )->withValue(
125  $saving_interval_value === null ? null : [$saving_interval_value]
126  )->withAdditionalTransformation(
127  $this->refinery->custom()->transformation(function ($v) {
128  if ($v === null || $v === [null]) {
129  $this->settings->delete("saving_interval");
130  }
131  return $v;
132  })
133  );
134 
135  return $this->ui_factory->input()->field()->section(
136  [
137  $this->ui_factory->input()->field()->optionalGroup(
138  [$wopi_url, $saving_interval],
139  $this->lng->txt("activate_wopi")
140  )->withValue(
141  $wopi_discovery_url === null ? null : [
142  $wopi_discovery_url,
143  $saving_interval_value === null ? null : [$saving_interval_value]
144  ]
145  )->withAdditionalTransformation(
146  $this->refinery->custom()->transformation(function ($v) {
147  if ($v === null || $v === [null]) {
148  $this->settings->set("wopi_activated", '0');
149  $this->settings->delete("wopi_discovery_url");
150  } else {
151  $this->settings->set("wopi_activated", "1");
152  }
153  return $v;
154  })
155  )
156  ],
157  $this->lng->txt("wopi_settings"),
158  );
159  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilWOPISettingsForm::initForm ( )
private

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

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

Referenced by __construct().

55  : Standard
56  {
57  return $this->ui_factory->input()->container()->form()->standard(
58  $this->ctrl->getFormActionByClass(ilWOPIAdministrationGUI::class, ilWOPIAdministrationGUI::CMD_STORE),
59  $this->getSection()->getInputs()
60  );
61  }
This describes a standard form.
Definition: Standard.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ proceed()

ilWOPISettingsForm::proceed ( RequestInterface  $request)

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

References ILIAS\Repository\form(), and null.

161  : bool
162  {
163  $this->form = $this->form->withRequest($request);
164 
165  return $this->form->getData() !== null;
166  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ renderLink()

ilWOPISettingsForm::renderLink ( string  $translation,
string  $url,
bool  $new_tab = true 
)
private

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

173  : string
174  {
175  $link = $this->ui_factory->link()->standard(
176  $translation,
177  $url
178  )->withOpenInNewViewport($new_tab);
179  return $this->ui_renderer->render($link);
180  }
$url
Definition: shib_logout.php:66

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: