19declare(strict_types=1);
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();');
86 $this->ui_renderer =
$DIC->ui()->renderer();
87 $this->
http = $DIC->http()->wrapper()->query();
89 $this->
ctrl = $DIC->ctrl();
90 $this->
lng = $DIC->language();
91 $this->
lng->loadLanguageModule(
'wopi');
92 $this->data_signer =
$DIC[
'file_delivery.data_signer'];
97 if (!$this->application->isInline()) {
98 $this->
tabs->clearTargets();
100 $this->global_screen->tool()->context()->current()->addAdditionalData(
101 EmbeddedApplicationGSProvider::EMBEDDED_APPLICATION,
104 $a_value = $this->
sign((
string) $this->application->getBackTarget());
105 $this->
ctrl->setParameter($this, self::P_RETURN_TO, $a_value);
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(),
117 $this->main_tpl->setContent(
118 $this->ui_renderer->render($this->renderer->getComponent())
124 $this->main_tpl->setContent(
125 $this->ui_renderer->render($this->renderer->getComponent())
129 private function return():
void
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()))
135 if ($return_to ===
null) {
136 $return_to = (string) $this->application->getBackTarget();
139 $this->main_tpl->setOnScreenMessage(
141 $this->
lng->txt(
'close_wopi_editor_info'),
145 $this->
ctrl->redirectToURL($return_to);
148 private function sign(
string $back_target): string
150 return $this->data_signer->sign([
't' => $back_target], self::DATA_SIGNER_SALT);
153 private function verify(
string $back_target_token): ?string
155 return $this->data_signer->verify($back_target_token, self::DATA_SIGNER_SALT)[
't'] ??
null;
Class ArrayBasedRequestWrapper.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
verify(string $back_target_token)
ArrayBasedRequestWrapper $http
@readonly
Services $global_screen
@readonly
Factory $refinery
@readonly
ILIAS UI Renderer $ui_renderer
@readonly
Renderer $renderer
@readonly
ilGlobalTemplateInterface $main_tpl
@readonly
sign(string $back_target)
ilCtrlInterface $ctrl
@readonly
__construct(private EmbeddedApplication $application,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.