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

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Data Fields

const CMD_DEFAULT = "index"
 
const CMD_STORE = "store"
 
const CMD_SHOW = 'show'
 

Private Member Functions

 index ()
 
 getSupportedSuffixes ()
 
 show ()
 
 store ()
 

Private Attributes

ilCtrlInterface $ctrl
 
ilAccessHandler $access
 
Services $http
 
ilLanguage $lng
 
ilGlobalTemplateInterface $maint_tpl
 
ilSetting $settings
 
Crawler $crawler
 
int $ref_id = null
 
ActionRepository $action_repo
 
AppRepository $app_repo
 
Factory $ui_factory
 
Renderer $ui_renderer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWOPIAdministrationGUI::__construct ( )

Definition at line 57 of file class.ilWOPIAdministrationGUI.php.

58 {
59 global $DIC;
60 $this->ctrl = $DIC->ctrl();
61 $this->access = $DIC->access();
62 $this->http = $DIC->http();
63 $this->settings = $DIC->settings();
64 $this->lng = $DIC->language();
65 $this->lng->loadLanguageModule("wopi");
66 $this->maint_tpl = $DIC->ui()->mainTemplate();
67 $this->ref_id = $this->http->wrapper()->query()->has("ref_id")
68 ? (int) $this->http->wrapper()->query()->retrieve(
69 "ref_id",
70 $DIC->refinery()->to()->string()
71 )
72 : null;
73 $this->crawler = new Crawler();
74 $this->action_repo = new ActionDBRepository($DIC->database());
75 $this->app_repo = new AppDBRepository($DIC->database());
76
77 $this->ui_factory = $DIC->ui()->factory();
78 $this->ui_renderer = $DIC->ui()->renderer();
79 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilWOPIAdministrationGUI::executeCommand ( )

Definition at line 81 of file class.ilWOPIAdministrationGUI.php.

81 : void
82 {
83 if (!$this->access->checkAccess("read", "", $this->ref_id)) {
84 $this->maint_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
85 $this->ctrl->redirectByClass(ilObjExternalToolsSettingsGUI::class);
86 }
87
88 $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
89 match ($cmd) {
90 self::CMD_DEFAULT => $this->index(),
91 self::CMD_SHOW => $this->show(),
92 self::CMD_STORE => $this->store(),
93 default => throw new ilException("command not found: " . $cmd),
94 };
95 }
Base class for ILIAS Exception handling.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), index(), ILIAS\Repository\lng(), show(), and store().

+ Here is the call graph for this function:

◆ getSupportedSuffixes()

ilWOPIAdministrationGUI::getSupportedSuffixes ( )
private

Definition at line 128 of file class.ilWOPIAdministrationGUI.php.

128 : array
129 {
130 $wopi_activated = (bool) $this->settings->get("wopi_activated", '0');
131 if (!$wopi_activated) {
132 return [];
133 }
134 return [
135 ActionTarget::EDIT->value => $this->action_repo->getSupportedSuffixes(ActionTarget::EDIT),
136 ActionTarget::VIEW->value => $this->action_repo->getSupportedSuffixes(ActionTarget::VIEW),
137 ];
138 }

References ILIAS\Repository\settings().

Referenced by index().

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

◆ index()

ilWOPIAdministrationGUI::index ( )
private

Definition at line 97 of file class.ilWOPIAdministrationGUI.php.

97 : void
98 {
99 $supported_suffixes = $this->getSupportedSuffixes();
100 $info = '';
101 if (!empty($supported_suffixes)) {
102 $listing = $this->ui_factory->panel()->secondary()->legacy(
103 $this->lng->txt("currently_supported"),
104 $this->ui_factory->legacy()->content(
105 $this->ui_renderer->render(
106 $this->ui_factory->listing()->descriptive([
107 $this->lng->txt('action_edit') => implode(", ", $supported_suffixes[ActionTarget::EDIT->value]),
108 $this->lng->txt('action_view') => implode(", ", $supported_suffixes[ActionTarget::VIEW->value]),
109 ])
110 )
111 )
112 );
113 $info = $this->ui_renderer->render($listing);
114 }
115
116 $form = new ilWOPISettingsForm(
117 $this->settings,
118 $this->access->checkAccess("write", "", $this->ref_id)
119 );
120
121 $this->maint_tpl->setContent(
122 $form->getHTML()
123 );
124
125 $this->maint_tpl->setRightContent($info);
126 }
$info
Definition: entry_point.php:21

References $info, ILIAS\Repository\access(), getSupportedSuffixes(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by executeCommand().

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

◆ show()

ilWOPIAdministrationGUI::show ( )
private

Definition at line 140 of file class.ilWOPIAdministrationGUI.php.

140 : void
141 {
142 $actions = array_map(
143 fn(Action $action): Item => $this->ui_factory->item()->standard($action->getExtension())->withProperties([
144 $this->lng->txt('launcher_url') => (string) $action->getLauncherUrl(),
145 $this->lng->txt('action') => $action->getName()
146 ]),
147 $this->action_repo->getActionsForTargets(ActionTarget::EDIT, ActionTarget::EMBED_EDIT)
148 );
149
150 $this->maint_tpl->setContent(
151 $this->ui_renderer->render(
152 $this->ui_factory->item()->group(
153 $this->lng->txt('actions'),
154 $actions
155 )
156 )
157 );
158 }
Common interface to all items.
Definition: Item.php:32
withProperties(array $properties)
Get a new item with the given properties as key-value pairs.

References ILIAS\WOPI\Discovery\Action\getExtension(), ILIAS\WOPI\Discovery\Action\getLauncherUrl(), ILIAS\WOPI\Discovery\Action\getName(), and ILIAS\UI\Component\Item\Item\withProperties().

Referenced by executeCommand().

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

◆ store()

ilWOPIAdministrationGUI::store ( )
private

Definition at line 160 of file class.ilWOPIAdministrationGUI.php.

160 : void
161 {
162 if (!$this->access->checkAccess("write", "", $this->ref_id)) {
163 $this->maint_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
164 $this->ctrl->redirect($this, self::CMD_DEFAULT);
165 }
166
167 $form = new ilWOPISettingsForm(
168 $this->settings,
169 $this->access->checkAccess("write", "", $this->ref_id)
170 );
171
172 if ($form->proceed($this->http->request())) {
173 global $DIC;
174
175 $this->maint_tpl->setOnScreenMessage('success', $this->lng->txt("msg_wopi_settings_modified"), true);
176
177 // Crawl
178 $discovery_url = $this->settings->get("wopi_discovery_url");
179 if ($discovery_url === null) {
180 $this->app_repo->clear($this->action_repo);
181 } else {
182 $apps = $this->crawler->crawl(new URI($discovery_url));
183 if ($apps !== null) {
184 $this->app_repo->storeCollection($apps, $this->action_repo);
185 }
186 }
187
188 $this->ctrl->redirect($this, self::CMD_DEFAULT);
189 }
190
191 $this->maint_tpl->setContent($form->getHTML());
192 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by executeCommand().

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

Field Documentation

◆ $access

ilAccessHandler ilWOPIAdministrationGUI::$access
private

Definition at line 45 of file class.ilWOPIAdministrationGUI.php.

◆ $action_repo

ActionRepository ilWOPIAdministrationGUI::$action_repo
private

Definition at line 52 of file class.ilWOPIAdministrationGUI.php.

◆ $app_repo

AppRepository ilWOPIAdministrationGUI::$app_repo
private

Definition at line 53 of file class.ilWOPIAdministrationGUI.php.

◆ $crawler

Crawler ilWOPIAdministrationGUI::$crawler
private

Definition at line 50 of file class.ilWOPIAdministrationGUI.php.

◆ $ctrl

ilCtrlInterface ilWOPIAdministrationGUI::$ctrl
private

Definition at line 44 of file class.ilWOPIAdministrationGUI.php.

◆ $http

Services ilWOPIAdministrationGUI::$http
private

Definition at line 46 of file class.ilWOPIAdministrationGUI.php.

◆ $lng

ilLanguage ilWOPIAdministrationGUI::$lng
private

Definition at line 47 of file class.ilWOPIAdministrationGUI.php.

◆ $maint_tpl

ilGlobalTemplateInterface ilWOPIAdministrationGUI::$maint_tpl
private

Definition at line 48 of file class.ilWOPIAdministrationGUI.php.

◆ $ref_id

int ilWOPIAdministrationGUI::$ref_id = null
private

Definition at line 51 of file class.ilWOPIAdministrationGUI.php.

◆ $settings

ilSetting ilWOPIAdministrationGUI::$settings
private

Definition at line 49 of file class.ilWOPIAdministrationGUI.php.

◆ $ui_factory

Factory ilWOPIAdministrationGUI::$ui_factory
private

Definition at line 54 of file class.ilWOPIAdministrationGUI.php.

◆ $ui_renderer

Renderer ilWOPIAdministrationGUI::$ui_renderer
private

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

◆ CMD_DEFAULT

const ilWOPIAdministrationGUI::CMD_DEFAULT = "index"

Definition at line 41 of file class.ilWOPIAdministrationGUI.php.

◆ CMD_SHOW

const ilWOPIAdministrationGUI::CMD_SHOW = 'show'

Definition at line 43 of file class.ilWOPIAdministrationGUI.php.

◆ CMD_STORE

const ilWOPIAdministrationGUI::CMD_STORE = "store"

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

Referenced by ilWOPISettingsForm\initForm().


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