ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilWOPIAdministrationGUI::executeCommand ( )

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

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

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  }
+ Here is the call graph for this function:

◆ getSupportedSuffixes()

ilWOPIAdministrationGUI::getSupportedSuffixes ( )
private

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

References ILIAS\Repository\settings().

Referenced by index().

125  : array
126  {
127  $wopi_activated = (bool) $this->settings->get("wopi_activated", '0');
128  if (!$wopi_activated) {
129  return [];
130  }
131  return [
132  ActionTarget::EDIT->value => $this->action_repo->getSupportedSuffixes(ActionTarget::EDIT),
133  ActionTarget::VIEW->value => $this->action_repo->getSupportedSuffixes(ActionTarget::VIEW),
134  ];
135  }
+ 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.

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

Referenced by executeCommand().

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(
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($this->settings);
117 
118  $this->maint_tpl->setContent(
119  $form->getHTML()
120  );
121 
122  $this->maint_tpl->setRightContent($info);
123  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show()

ilWOPIAdministrationGUI::show ( )
private

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

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

Referenced by executeCommand().

137  : void
138  {
139  $actions = array_map(
140  fn(Action $action): Item => $this->ui_factory->item()->standard($action->getExtension())->withProperties([
141  $this->lng->txt('launcher_url') => (string) $action->getLauncherUrl(),
142  $this->lng->txt('action') => $action->getName()
143  ]),
144  $this->action_repo->getActionsForTargets(ActionTarget::EDIT, ActionTarget::EMBED_EDIT)
145  );
146 
147  $this->maint_tpl->setContent(
148  $this->ui_renderer->render(
149  $this->ui_factory->item()->group(
150  $this->lng->txt('actions'),
151  $actions
152  )
153  )
154  );
155  }
Common interface to all items.
Definition: Item.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store()

ilWOPIAdministrationGUI::store ( )
private

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

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

Referenced by executeCommand().

157  : void
158  {
159  $form = new ilWOPISettingsForm($this->settings);
160 
161  if ($form->proceed($this->http->request())) {
162  global $DIC;
163 
164  $this->maint_tpl->setOnScreenMessage('success', $this->lng->txt("msg_wopi_settings_modified"), true);
165 
166  // Crawl
167  $discovery_url = $this->settings->get("wopi_discovery_url");
168  if ($discovery_url === null) {
169  $this->app_repo->clear($this->action_repo);
170  } else {
171  $apps = $this->crawler->crawl(new URI($discovery_url));
172  if ($apps !== null) {
173  $this->app_repo->storeCollection($apps, $this->action_repo);
174  }
175  }
176 
177  $this->ctrl->redirect($this, self::CMD_DEFAULT);
178  }
179 
180  $this->maint_tpl->setContent($form->getHTML());
181  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ 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: