ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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
 
ILIAS UI Factory $ui_factory
 
ILIAS UI 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: feed.php:28
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 127 of file class.ilWOPISettingsForm.php.

References ILIAS\Repository\form().

127  : string
128  {
129  return $this->ui_renderer->render($this->form);
130  }
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\lng(), 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 
68  $wopi_url = $this->ui_factory->input()->field()->text(
69  $this->lng->txt("wopi_url"),
70  $this->lng->txt("wopi_url_byline")
71  /*. $this->renderLink(
72  " ➜︎ Wikipedia",
73  "https://en.wikipedia.org/wiki/Web_Application_Open_Platform_Interface",
74  true
75  )*/
77  $this->refinery->custom()->transformation(function ($v) {
78  return $v === '' ? null : $v;
79  })
80  )->withAdditionalTransformation(
81  $this->refinery->custom()->constraint(function ($v) {
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) {
89  $this->settings->set("wopi_discovery_url", $v);
90 
91  return true;
92  })
93  )->withValue(
94  $wopi_discovery_url ?? ''
95  );
96 
97  return $this->ui_factory->input()->field()->section(
98  [
99  $this->ui_factory->input()->field()->optionalGroup(
100  [$wopi_url],
101  $this->lng->txt("activate_wopi")
102  )->withValue(
103  $wopi_discovery_url === null ? null : [$wopi_discovery_url]
104  )->withAdditionalTransformation(
105  $this->refinery->custom()->transformation(function ($v) {
106  if ($v === null || $v === [null]) {
107  $this->settings->set("wopi_activated", '0');
108  $this->settings->delete("wopi_discovery_url");
109  } else {
110  $this->settings->set("wopi_activated", "1");
111  }
112  return $v;
113  })
114  )
115  ],
116  $this->lng->txt("wopi_settings"),
117  );
118  }
This describes section inputs.
Definition: Section.php:28
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:18
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Crawler.php:21
+ 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:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ proceed()

ilWOPISettingsForm::proceed ( RequestInterface  $request)

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

References ILIAS\Repository\form().

120  : bool
121  {
122  $this->form = $this->form->withRequest($request);
123 
124  return $this->form->getData() !== null;
125  }
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 132 of file class.ilWOPISettingsForm.php.

132  : string
133  {
134  $link = $this->ui_factory->link()->standard(
135  $translation,
136  $url
137  )->withOpenInNewViewport($new_tab);
138  return $this->ui_renderer->render($link);
139  }
$url
Definition: ltiregstart.php:35

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

ILIAS UI Factory ilWOPISettingsForm::$ui_factory
private

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

◆ $ui_renderer

ILIAS UI 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: