ILIAS  release_8 Revision v8.24
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

WrapperFactory $wrapper
 
Factory $refinery
 

Private Attributes

IdentificationInterface $identification
 
array $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 49 of file ItemState.php.

50 {
51 $this->identification = $identification;
52 $this->storage = $this->getStorage();
54 global $DIC;
55 $this->wrapper = $DIC->http()->wrapper();
56 $this->refinery = $DIC->refinery();
57 }
IdentificationInterface $identification
Definition: ItemState.php:38
static initILIAS()
ilias initialisation
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getStorage()

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

Definition at line 70 of file ItemState.php.

70 : 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 }

References ILIAS\Repository\refinery().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isItemActive()

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

Definition at line 59 of file ItemState.php.

59 : bool
60 {
61 $hash = $this->hash($this->identification->serialize());
62 $b = isset($this->storage[$hash]) && $this->storage[$hash] == true;
63
64 return $b;
65 }

References Vendor\Package\$b.

Field Documentation

◆ $identification

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

Definition at line 38 of file ItemState.php.

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

◆ $refinery

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

Definition at line 42 of file ItemState.php.

◆ $storage

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

Definition at line 39 of file ItemState.php.

◆ $wrapper

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

Definition at line 41 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: