ILIAS  release_7 Revision v7.30-3-g800a261c036
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 COOKIE_NS_GS = 'gs_active_items'
 

Protected Attributes

 $wrapper
 
 $refinery
 

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 32 of file ItemState.php.

Constructor & Destructor Documentation

◆ __construct()

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

ItemState constructor.

Parameters
IdentificationInterface$identification

Definition at line 61 of file ItemState.php.

62 {
63 $this->identification = $identification;
64 $this->storage = $this->getStorage();
66 global $DIC;
67 $this->wrapper = $DIC->http()->wrapper();
68 $this->refinery = $DIC->refinery();
69 }
static initILIAS()
ilias initialisation
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getStorage()

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

Definition at line 82 of file ItemState.php.

82 : array
83 {
84 static $json_decode;
85 if (!isset($json_decode)) {
86 $cookie_value = $this->wrapper->cookie()->has(self::COOKIE_NS_GS)
87 ? $this->wrapper->cookie()->retrieve(self::COOKIE_NS_GS, $this->refinery->to()->string())
88 : '{}';
89
90 $json_decode = json_decode($cookie_value, true, 512);
91 $json_decode = is_array($json_decode) ? $json_decode : [];
92 }
93
94 return $json_decode;
95 }

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

+ Here is the caller graph for this function:

◆ isItemActive()

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

Definition at line 71 of file ItemState.php.

71 : bool
72 {
73 $hash = $this->hash($this->identification->serialize());
74 $b = isset($this->storage[$hash]) && $this->storage[$hash] == true;
75
76 return $b;
77 }

References Vendor\Package\$b.

Field Documentation

◆ $identification

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

Definition at line 41 of file ItemState.php.

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

◆ $refinery

ILIAS\GlobalScreen\Client\ItemState::$refinery
protected

Definition at line 54 of file ItemState.php.

◆ $storage

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

Definition at line 45 of file ItemState.php.

◆ $wrapper

ILIAS\GlobalScreen\Client\ItemState::$wrapper
protected

Definition at line 50 of file ItemState.php.

◆ COOKIE_NS_GS

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

Definition at line 37 of file ItemState.php.

◆ LEVEL_OF_TOOL

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

Definition at line 36 of file ItemState.php.

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


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