ILIAS
release_10 Revision v10.1-43-ga1241a92c2f
◀ ilDoc Overview
ItemState.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
20
namespace
ILIAS\GlobalScreen\Client
;
21
22
use
ILIAS\GlobalScreen\Identification\IdentificationInterface
;
23
use
ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher
;
24
use
ILIAS\HTTP\Wrapper\WrapperFactory
;
25
use
ILIAS\Refinery\Factory
;
26
32
class
ItemState
33
{
34
use
Hasher
;
35
36
public
const
LEVEL_OF_TOOL
= 1;
37
public
const
COOKIE_NS_GS
=
'gs_active_items'
;
38
private
IdentificationInterface
$identification
;
39
private
array
$storage
;
40
41
protected
WrapperFactory
$wrapper
;
42
protected
Factory
$refinery
;
43
49
public
function
__construct
(IdentificationInterface $identification)
50
{
51
$this->identification =
$identification
;
52
$this->storage = $this->
getStorage
();
53
\ilInitialisation::initILIAS
();
54
global
$DIC
;
55
$this->wrapper = $DIC->http()->wrapper();
56
$this->
refinery
= $DIC->refinery();
57
}
58
59
public
function
isItemActive
(): bool
60
{
61
$hash = $this->
hash
($this->identification->serialize());
62
$b
= isset($this->storage[$hash]) && $this->storage[$hash] ==
true
;
63
64
return
$b
;
65
}
66
70
public
function
getStorage
(): array
71
{
72
static
$json_decode;
73
if
(!isset($json_decode)) {
74
$cookie_value = $this->wrapper->cookie()->has(self::COOKIE_NS_GS)
75
? $this->wrapper->cookie()->retrieve(self::COOKIE_NS_GS, $this->
refinery
->to()->string())
76
:
'{}'
;
77
78
$json_decode = json_decode($cookie_value,
true
);
79
$json_decode = is_array($json_decode) ? $json_decode : [];
80
}
81
82
return
$json_decode;
83
}
84
}
GuzzleHttp\Client\ItemState\getStorage
getStorage()
Definition:
ItemState.php:70
GuzzleHttp\Client\ItemState\LEVEL_OF_TOOL
const LEVEL_OF_TOOL
Definition:
ItemState.php:36
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:3
GuzzleHttp\Client\ItemState
Class ItemState.
Definition:
ItemState.php:32
GuzzleHttp\Client\ItemState\$wrapper
WrapperFactory $wrapper
Definition:
ItemState.php:41
Hasher
GuzzleHttp\Client\ItemState\COOKIE_NS_GS
const COOKIE_NS_GS
Definition:
ItemState.php:37
hash
ILIAS\Repository\refinery
refinery()
Definition:
trait.GlobalDICDomainServices.php:76
ilInitialisation\initILIAS
static initILIAS()
ilias initialisation
Definition:
class.ilInitialisation.php:1153
IdentificationInterface
Factory
GuzzleHttp\Client\ItemState\$identification
IdentificationInterface $identification
Definition:
ItemState.php:38
GuzzleHttp\Client\ItemState\$refinery
Factory $refinery
Definition:
ItemState.php:42
$DIC
global $DIC
Definition:
shib_login.php:25
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:59
GuzzleHttp\Client\ItemState\$storage
array $storage
Definition:
ItemState.php:39
GuzzleHttp\Client\ItemState\__construct
__construct(IdentificationInterface $identification)
ItemState constructor.
Definition:
ItemState.php:49
components
ILIAS
GlobalScreen
src
Client
ItemState.php
Generated on Wed Sep 10 2025 15:15:40 for ILIAS by
1.8.13 (using
Doxyfile
)