ILIAS  release_8 Revision v8.24
CallbackHandler.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
21
22use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
28
30{
31 use Hasher;
32
33 private const TARGET_SCRIPT = "/ilias.php";
34 public const KEY_ITEM = 'item';
35
37 protected Factory $refinery;
38 protected \ilCtrlInterface $ctrl;
39 protected \ILIAS\GlobalScreen\Services $global_screen;
40
41 public function __construct()
42 {
44 global $DIC;
45 $this->ctrl = $DIC->ctrl();
46 $this->wrapper = $DIC->http()->wrapper();
47 $this->refinery = $DIC->refinery();
48 $this->global_screen = $DIC->globalScreen();
49 }
50
51 public function run(): void
52 {
53 $this->ctrl->setTargetScript(self::TARGET_SCRIPT);
54
55 $this->global_screen->collector()
56 ->tool()
57 ->collectOnce();
58
59 $item = $this->global_screen->collector()
60 ->tool()
61 ->getSingleItem($this->getIdentification());
62
63 if ($item instanceof isToolItem) {
64 $callback = $this->resolveCallback($item);
65 $callback();
66 }
67 }
68
69 private function resolveCallback(isToolItem $item): \Closure
70 {
71 return $item->hasCloseCallback()
72 ? $item->getCloseCallback()
73 : static function (): void {
74 };
75 }
76
78 {
79 $hashed = $this->wrapper->query()->has(self::KEY_ITEM)
80 ? $this->wrapper->query()->retrieve(self::KEY_ITEM, $this->refinery->to()->string())
81 : '';
82
83 $unhashed = $this->unhash($hashed);
84
85 return $this->global_screen->identification()->fromSerializedIdentification($unhashed);
86 }
87}
Builds data types.
Definition: Factory.php:21
ILIAS GlobalScreen Services $global_screen
ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration fil...
static initILIAS()
ilias initialisation
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: gs_content.php:1