ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ItemState.php
Go to the documentation of this file.
1<?php
2
4
6use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
7
14{
15 use Hasher;
16 const LEVEL_OF_TOOL = 1;
18 const LEVEL_OF_SUBITEM = 10;
19 const COOKIE_NS_GS = 'gs_active_items';
27 private $storage = [];
28
29
36 {
37 $this->identification = $identification;
38 $this->storage = $this->getStorage();
39 }
40
41
42 public function isItemActive() : bool
43 {
44 $hash = $this->hash($this->identification->serialize());
45 $b = isset($this->storage[$hash]) && $this->storage[$hash] == true;
46
47 return $b;
48 }
49
50
54 public function getStorage() : array
55 {
56 static $json_decode;
57 if (!isset($json_decode)) {
58 $json_decode = json_decode($_COOKIE[self::COOKIE_NS_GS], true);
59 $json_decode = is_array($json_decode) ? $json_decode : [];
60 }
61
62 return $json_decode;
63 }
64}
An exception for terminatinating execution or to throw for unit testing.
__construct(IdentificationInterface $identification)
ItemState constructor.
Definition: ItemState.php:35
Entry Point for Async calls from the Notification Center.
Definition: gs_content.php:1
$_COOKIE[session_name()]
Definition: xapitoken.php:39