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

Public Member Functions

 __construct (private EmbeddedApplication $application,)
 
 executeCommand ()
 

Data Fields

const CMD_EDIT = 'edit'
 
const CMD_VIEW = 'view'
 
const CMD_RETURN = 'return'
 
const P_RETURN_TO = 'return_to'
 
const DATA_SIGNER_SALT = 'wopi_return'
 

Private Member Functions

 view ()
 
 edit ()
 
 return ()
 
 sign (string $back_target)
 
 verify (string $back_target_token)
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 @readonly More...
 
ilTabsGUI $tabs
 @readonly More...
 
Services $global_screen
 @readonly More...
 
Renderer $renderer
 @readonly More...
 
ILIAS UI Renderer $ui_renderer
 @readonly More...
 
ArrayBasedRequestWrapper $http
 @readonly More...
 
Factory $refinery
 @readonly More...
 
ilCtrlInterface $ctrl
 @readonly More...
 
ilLanguage $lng
 @readonly More...
 
DataSigner $data_signer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWOPIEmbeddedApplicationGUI::__construct ( private EmbeddedApplication  $application)

Definition at line 76 of file class.ilWOPIEmbeddedApplicationGUI.php.

78 {
79 global $DIC;
80 $this->main_tpl = $DIC->ui()->mainTemplate();
81 $this->tabs = $DIC->tabs();
82 $this->global_screen = $DIC->globalScreen();
83 $this->global_screen->layout()->meta()->addJs('./assets/js/wopi.min.js');
84 $this->global_screen->layout()->meta()->addOnloadCode('il.WOPI.init();');
85 $this->renderer = new Renderer($this->application);
86 $this->ui_renderer = $DIC->ui()->renderer();
87 $this->http = $DIC->http()->wrapper()->query();
88 $this->refinery = $DIC->refinery();
89 $this->ctrl = $DIC->ctrl();
90 $this->lng = $DIC->language();
91 $this->lng->loadLanguageModule('wopi');
92 $this->data_signer = $DIC['file_delivery.data_signer'];
93 }
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), renderer(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Member Function Documentation

◆ edit()

ilWOPIEmbeddedApplicationGUI::edit ( )
private

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

122 : void
123 {
124 $this->main_tpl->setContent(
125 $this->ui_renderer->render($this->renderer->getComponent())
126 );
127 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilWOPIEmbeddedApplicationGUI::executeCommand ( )

Definition at line 95 of file class.ilWOPIEmbeddedApplicationGUI.php.

95 : void
96 {
97 if (!$this->application->isInline()) {
98 $this->tabs->clearTargets();
99 }
100 $this->global_screen->tool()->context()->current()->addAdditionalData(
101 EmbeddedApplicationGSProvider::EMBEDDED_APPLICATION,
102 $this->application
103 );
104 $a_value = $this->sign((string) $this->application->getBackTarget());
105 $this->ctrl->setParameter($this, self::P_RETURN_TO, $a_value);
106
107 match ($this->ctrl->getCmd()) {
108 default => $this->edit(),
109 self::CMD_EDIT => $this->edit(),
110 self::CMD_VIEW => $this->view(),
111 self::CMD_RETURN => $this->return(),
112 };
113 }

References ILIAS\Repository\ctrl(), edit(), sign(), ILIAS\Repository\tabs(), and view().

+ Here is the call graph for this function:

◆ return()

ilWOPIEmbeddedApplicationGUI::return ( )
private

Definition at line 129 of file class.ilWOPIEmbeddedApplicationGUI.php.

129 : void
130 {
131 $return_to = $this->http->has(self::P_RETURN_TO)
132 ? $this->verify((string) $this->http->retrieve(self::P_RETURN_TO, $this->refinery->kindlyTo()->string()))
133 : null;
134
135 if ($return_to === null) {
136 $return_to = (string) $this->application->getBackTarget();
137 }
138
139 $this->main_tpl->setOnScreenMessage(
140 'info',
141 $this->lng->txt('close_wopi_editor_info'),
142 true
143 );
144
145 $this->ctrl->redirectToURL($return_to);
146 }
return true

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), true, and verify().

+ Here is the call graph for this function:

◆ sign()

ilWOPIEmbeddedApplicationGUI::sign ( string  $back_target)
private

Definition at line 148 of file class.ilWOPIEmbeddedApplicationGUI.php.

148 : string
149 {
150 return $this->data_signer->sign(['t' => $back_target], self::DATA_SIGNER_SALT);
151 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ verify()

ilWOPIEmbeddedApplicationGUI::verify ( string  $back_target_token)
private

Definition at line 153 of file class.ilWOPIEmbeddedApplicationGUI.php.

153 : ?string
154 {
155 return $this->data_signer->verify($back_target_token, self::DATA_SIGNER_SALT)['t'] ?? null;
156 }

Referenced by return().

+ Here is the caller graph for this function:

◆ view()

ilWOPIEmbeddedApplicationGUI::view ( )
private

Definition at line 115 of file class.ilWOPIEmbeddedApplicationGUI.php.

115 : void
116 {
117 $this->main_tpl->setContent(
118 $this->ui_renderer->render($this->renderer->getComponent())
119 );
120 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilWOPIEmbeddedApplicationGUI::$ctrl
private

@readonly

Definition at line 69 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ $data_signer

DataSigner ilWOPIEmbeddedApplicationGUI::$data_signer
private

Definition at line 74 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ $global_screen

Services ilWOPIEmbeddedApplicationGUI::$global_screen
private

@readonly

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

◆ $http

ArrayBasedRequestWrapper ilWOPIEmbeddedApplicationGUI::$http
private

@readonly

Definition at line 61 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ $lng

ilLanguage ilWOPIEmbeddedApplicationGUI::$lng
private

@readonly

Definition at line 73 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilWOPIEmbeddedApplicationGUI::$main_tpl
private

@readonly

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

◆ $refinery

Factory ilWOPIEmbeddedApplicationGUI::$refinery
private

@readonly

Definition at line 65 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ $renderer

Renderer ilWOPIEmbeddedApplicationGUI::$renderer
private

@readonly

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

◆ $tabs

ilTabsGUI ilWOPIEmbeddedApplicationGUI::$tabs
private

@readonly

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

◆ $ui_renderer

ILIAS UI Renderer ilWOPIEmbeddedApplicationGUI::$ui_renderer
private

@readonly

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

◆ CMD_EDIT

◆ CMD_RETURN

const ilWOPIEmbeddedApplicationGUI::CMD_RETURN = 'return'

Definition at line 35 of file class.ilWOPIEmbeddedApplicationGUI.php.

◆ CMD_VIEW

const ilWOPIEmbeddedApplicationGUI::CMD_VIEW = 'view'

◆ DATA_SIGNER_SALT

const ilWOPIEmbeddedApplicationGUI::DATA_SIGNER_SALT = 'wopi_return'

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

◆ P_RETURN_TO

const ilWOPIEmbeddedApplicationGUI::P_RETURN_TO = 'return_to'

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


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