ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\GlobalScreen\Client\ItemState Class Reference

Class ItemState. More...

+ Collaboration diagram for ILIAS\GlobalScreen\Client\ItemState:

Public Member Functions

 __construct (IdentificationInterface $identification)
 ItemState constructor. More...
 
 isItemActive ()
 
 getStorage ()
 

Data Fields

const LEVEL_OF_TOOL = 1
 
const LEVEL_OF_TOPITEM = 2
 
const LEVEL_OF_SUBITEM = 10
 
const COOKIE_NS_GS = 'gs_active_items'
 

Private Attributes

 $identification
 
 $storage = []
 

Detailed Description

Class ItemState.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 13 of file ItemState.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\Client\ItemState::__construct ( IdentificationInterface  $identification)

ItemState constructor.

Parameters
IdentificationInterface$identification

Definition at line 35 of file ItemState.php.

36 {
37 $this->identification = $identification;
38 $this->storage = $this->getStorage();
39 }

References ILIAS\GlobalScreen\Client\ItemState\$identification, and ILIAS\GlobalScreen\Client\ItemState\getStorage().

+ Here is the call graph for this function:

Member Function Documentation

◆ getStorage()

ILIAS\GlobalScreen\Client\ItemState::getStorage ( )
Returns
mixed

Definition at line 54 of file ItemState.php.

54 : 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 }
$_COOKIE[session_name()]
Definition: xapitoken.php:39

References $_COOKIE.

Referenced by ILIAS\GlobalScreen\Client\ItemState\__construct().

+ Here is the caller graph for this function:

◆ isItemActive()

ILIAS\GlobalScreen\Client\ItemState::isItemActive ( )

Definition at line 42 of file ItemState.php.

42 : bool
43 {
44 $hash = $this->hash($this->identification->serialize());
45 $b = isset($this->storage[$hash]) && $this->storage[$hash] == true;
46
47 return $b;
48 }

References Vendor\Package\$b.

Field Documentation

◆ $identification

ILIAS\GlobalScreen\Client\ItemState::$identification
private

Definition at line 23 of file ItemState.php.

Referenced by ILIAS\GlobalScreen\Client\ItemState\__construct().

◆ $storage

ILIAS\GlobalScreen\Client\ItemState::$storage = []
private

Definition at line 27 of file ItemState.php.

◆ COOKIE_NS_GS

const ILIAS\GlobalScreen\Client\ItemState::COOKIE_NS_GS = 'gs_active_items'

Definition at line 19 of file ItemState.php.

Referenced by ILIAS\GlobalScreen\Client\ModeToggle\toggle().

◆ LEVEL_OF_SUBITEM

const ILIAS\GlobalScreen\Client\ItemState::LEVEL_OF_SUBITEM = 10

◆ LEVEL_OF_TOOL

const ILIAS\GlobalScreen\Client\ItemState::LEVEL_OF_TOOL = 1

◆ LEVEL_OF_TOPITEM

const ILIAS\GlobalScreen\Client\ItemState::LEVEL_OF_TOPITEM = 2

The documentation for this class was generated from the following file: