ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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
 
ILIAS HTTP Services $http
 
ilLanguage $lng
 
ilGlobalTemplateInterface $maint_tpl
 
ilSetting $settings
 
Crawler $crawler
 
int $ref_id = null
 
ActionRepository $action_repo
 
AppRepository $app_repo
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWOPIAdministrationGUI::__construct ( )

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

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

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

Member Function Documentation

◆ executeCommand()

ilWOPIAdministrationGUI::executeCommand ( )

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

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

77  : void
78  {
79  if (!$this->access->checkAccess("read", "", $this->ref_id)) {
80  $this->maint_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
81  $this->ctrl->redirectByClass(ilObjExternalToolsSettingsGUI::class);
82  }
83 
84  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
85  match ($cmd) {
86  self::CMD_DEFAULT => $this->index(),
87  self::CMD_SHOW => $this->show(),
88  self::CMD_STORE => $this->store(),
89  default => throw new ilException("command not found: " . $cmd),
90  };
91  }
+ Here is the call graph for this function:

◆ getSupportedSuffixes()

ilWOPIAdministrationGUI::getSupportedSuffixes ( )
private

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

References ILIAS\Repository\settings().

Referenced by index().

113  : array
114  {
115  $wopi_activated = (bool) $this->settings->get("wopi_activated", '0');
116  if (!$wopi_activated) {
117  return [];
118  }
119  return $this->action_repo->getSupportedSuffixes(ActionTarget::EDIT);
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilWOPIAdministrationGUI::index ( )
private

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

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

Referenced by executeCommand().

93  : void
94  {
95  $supported_suffixes = $this->getSupportedSuffixes();
96  if (!empty($supported_suffixes)) {
97  $this->maint_tpl->setOnScreenMessage(
98  'info',
99  sprintf(
100  $this->lng->txt("currently_supported"),
101  implode(", ", $supported_suffixes)
102  )
103  );
104  }
105 
106  $form = new ilWOPISettingsForm($this->settings);
107 
108  $this->maint_tpl->setContent(
109  $form->getHTML()
110  );
111  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show()

ilWOPIAdministrationGUI::show ( )
private

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

References ILIAS\Services\WOPI\Discovery\Action\getExtension(), ILIAS\Services\WOPI\Discovery\Action\getLauncherUrl(), ILIAS\Services\WOPI\Discovery\Action\getName(), and ILIAS\Repository\lng().

Referenced by executeCommand().

122  : void
123  {
124  $actions = array_map(
125  function (Action $action) {
126  return $this->ui_factory->item()->standard($action->getExtension())->withProperties([
127  $this->lng->txt('launcher_url') => (string) $action->getLauncherUrl(),
128  $this->lng->txt('action') => $action->getName()
129  ]);
130  },
131  $this->action_repo->getActionsForTargets(ActionTarget::EDIT, ActionTarget::EMBED_EDIT)
132  );
133 
134  $this->maint_tpl->setContent(
135  $this->ui_renderer->render(
136  $this->ui_factory->item()->group(
137  $this->lng->txt('actions'),
138  $actions
139  )
140  )
141  );
142  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store()

ilWOPIAdministrationGUI::store ( )
private

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

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

Referenced by executeCommand().

144  : void
145  {
146  $form = new ilWOPISettingsForm($this->settings);
147 
148  if ($form->proceed($this->http->request())) {
149  global $DIC;
150 
151  $this->maint_tpl->setOnScreenMessage('success', $this->lng->txt("msg_wopi_settings_modified"), true);
152 
153  // Crawl
154  $discovery_url = $this->settings->get("wopi_discovery_url");
155  if ($discovery_url === null) {
156  $this->app_repo->clear($this->action_repo);
157  } else {
158  $apps = $this->crawler->crawl(new URI($discovery_url));
159  if ($apps !== null) {
160  $this->app_repo->storeCollection($apps, $this->action_repo);
161  }
162  }
163 
164  $this->ctrl->redirect($this, self::CMD_DEFAULT);
165  }
166 
167  $this->maint_tpl->setContent($form->getHTML());
168  }
global $DIC
Definition: feed.php:28
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:18
+ 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 41 of file class.ilWOPIAdministrationGUI.php.

◆ $action_repo

ActionRepository ilWOPIAdministrationGUI::$action_repo
private

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

◆ $app_repo

AppRepository ilWOPIAdministrationGUI::$app_repo
private

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

◆ $crawler

Crawler ilWOPIAdministrationGUI::$crawler
private

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

◆ $ctrl

ilCtrlInterface ilWOPIAdministrationGUI::$ctrl
private

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

◆ $http

ILIAS HTTP Services ilWOPIAdministrationGUI::$http
private

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

◆ $lng

ilLanguage ilWOPIAdministrationGUI::$lng
private

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

◆ $maint_tpl

ilGlobalTemplateInterface ilWOPIAdministrationGUI::$maint_tpl
private

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

◆ $ref_id

int ilWOPIAdministrationGUI::$ref_id = null
private

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

◆ $settings

ilSetting ilWOPIAdministrationGUI::$settings
private

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

◆ $ui_factory

ILIAS UI Factory ilWOPIAdministrationGUI::$ui_factory
private

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

◆ $ui_renderer

ILIAS UI Renderer ilWOPIAdministrationGUI::$ui_renderer
private

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

◆ CMD_DEFAULT

const ilWOPIAdministrationGUI::CMD_DEFAULT = "index"

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

◆ CMD_SHOW

const ilWOPIAdministrationGUI::CMD_SHOW = 'show'

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

◆ CMD_STORE

const ilWOPIAdministrationGUI::CMD_STORE = "store"

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

Referenced by ilWOPISettingsForm\initForm().


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