ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CallbackHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
29
31{
32 use Hasher;
33
37 private const TARGET_SCRIPT = "/ilias.php";
38 public const KEY_ITEM = 'item';
39
41 protected Factory $refinery;
42 protected \ilCtrlInterface $ctrl;
44
45 public function __construct()
46 {
47 global $DIC;
48 $this->ctrl = $DIC->ctrl();
49 $this->wrapper = $DIC->http()->wrapper();
50 $this->refinery = $DIC->refinery();
51 $this->global_screen = $DIC->globalScreen();
52 }
53
54 public function run(): void
55 {
56 $this->ctrl->setTargetScript(self::TARGET_SCRIPT);
57
58 $this->global_screen->collector()
59 ->tool()
60 ->collectOnce();
61
62 $item = $this->global_screen->collector()
63 ->tool()
64 ->getSingleItem($this->getIdentification());
65
66 if ($item instanceof isToolItem) {
67 $callback = $this->resolveCallback($item);
68 $callback();
69 }
70 }
71
72 private function resolveCallback(isToolItem $item): \Closure
73 {
74 return $item->hasCloseCallback()
75 ? $item->getCloseCallback()
76 : static function (): void {
77 };
78 }
79
81 {
82 $hashed = $this->wrapper->query()->has(self::KEY_ITEM)
83 ? $this->wrapper->query()->retrieve(self::KEY_ITEM, $this->refinery->to()->string())
84 : '';
85
86 $unhashed = $this->unhash($hashed);
87
88 return $this->global_screen->identification()->fromSerializedIdentification($unhashed);
89 }
90}
Builds data types.
Definition: Factory.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26