ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
ItemState.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\GlobalScreen\Client
;
22
23
use
ILIAS\GlobalScreen\Identification\IdentificationInterface
;
24
use
ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher
;
25
use
ILIAS\HTTP\Wrapper\WrapperFactory
;
26
use
ILIAS\Refinery\Factory
;
27
33
class
ItemState
34
{
35
use
Hasher
;
36
37
public
const
LEVEL_OF_TOOL
= 1;
38
public
const
COOKIE_NS_GS
=
'gs_active_items'
;
39
private
array
$storage
;
40
41
protected
WrapperFactory
$wrapper
;
42
protected
Factory
$refinery
;
43
49
public
function
__construct
(
private
IdentificationInterface $identification)
50
{
51
$this->storage = $this->
getStorage
();
52
\ilInitialisation::initILIAS
();
53
global
$DIC
;
54
$this->wrapper = $DIC->http()->wrapper();
55
$this->
refinery
= $DIC->refinery();
56
}
57
58
public
function
isItemActive
(): bool
59
{
60
$hash = $this->
hash
($this->identification->serialize());
61
$b
= isset($this->storage[$hash]) && $this->storage[$hash] ==
true
;
62
63
return
$b
;
64
}
65
69
public
function
getStorage
(): array
70
{
71
static
$json_decode;
72
if
(!isset($json_decode)) {
73
$cookie_value = $this->wrapper->cookie()->has(self::COOKIE_NS_GS)
74
? $this->wrapper->cookie()->retrieve(self::COOKIE_NS_GS, $this->
refinery
->to()->string())
75
:
'{}'
;
76
77
$json_decode = json_decode((
string
) $cookie_value,
true
);
78
$json_decode = is_array($json_decode) ? $json_decode : [];
79
}
80
81
return
$json_decode;
82
}
83
}
GuzzleHttp\Client\ItemState\getStorage
getStorage()
Definition:
ItemState.php:69
GuzzleHttp\Client\ItemState\LEVEL_OF_TOOL
const LEVEL_OF_TOOL
Definition:
ItemState.php:37
ILIAS\GlobalScreen\Client
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
callback_handler.php:19
GuzzleHttp\Client\ItemState
Class ItemState.
Definition:
ItemState.php:33
GuzzleHttp\Client\ItemState\$wrapper
WrapperFactory $wrapper
Definition:
ItemState.php:41
GuzzleHttp\Client\ItemState\__construct
__construct(private IdentificationInterface $identification)
ItemState constructor.
Definition:
ItemState.php:49
Hasher
GuzzleHttp\Client\ItemState\COOKIE_NS_GS
const COOKIE_NS_GS
Definition:
ItemState.php:38
hash
ILIAS\Repository\refinery
refinery()
Definition:
trait.GlobalDICDomainServices.php:76
ilInitialisation\initILIAS
static initILIAS()
ilias initialisation
Definition:
class.ilInitialisation.php:1145
IdentificationInterface
Factory
GuzzleHttp\Client\ItemState\$refinery
Factory $refinery
Definition:
ItemState.php:42
$DIC
global $DIC
Definition:
shib_login.php:26
Hasher
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Vendor\Package\$b
$b
Definition:
example_cleaned.php:49
WrapperFactory
GuzzleHttp\Client\ItemState\isItemActive
isItemActive()
Definition:
ItemState.php:58
GuzzleHttp\Client\ItemState\$storage
array $storage
Definition:
ItemState.php:39
components
ILIAS
GlobalScreen
src
Client
ItemState.php
Generated on Sun Aug 31 2025 23:03:01 for ILIAS by
1.8.13 (using
Doxyfile
)