ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMMItemInformation Class Reference

Class ilMMItemInformation. More...

+ Inheritance diagram for ilMMItemInformation:
+ Collaboration diagram for ilMMItemInformation:

Public Member Functions

 __construct ()
 ilMMItemInformation constructor. More...
 
 customPosition (isItem $item)
 @inheritDoc More...
 
 isItemActive (isItem $item)
 @inheritDoc More...
 
 getParent (isChild $item)
 @inheritDoc More...
 
 customSymbol (hasSymbol $item)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation
 isItemActive (isItem $item)
 
 customPosition (isItem $item)
 
 customTranslationForUser (hasTitle $item)
 
 getParent (isChild $item)
 
 customSymbol (hasSymbol $item)
 

Private Member Functions

 getPosition (isItem $item)
 

Private Attributes

const ICON_ID = 'icon_id'
 
 $ui_factory
 
 $storage
 
 $translations = []
 
 $items = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMItemInformation::__construct ( )

ilMMItemInformation constructor.

Definition at line 43 of file class.ilMMItemInformation.php.

44 {
45 $this->items = ilMMItemStorage::getArray('identification');
46 $this->translations = ilMMItemTranslationStorage::getArray('id', 'translation');
47 $this->storage = new Services();
48 }
static getArray($key=null, $values=null)
Class ilAsqQuestionAuthoringFactory.

References ActiveRecord\getArray().

+ Here is the call graph for this function:

Member Function Documentation

◆ customPosition()

ilMMItemInformation::customPosition ( isItem  $item)

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation.

Definition at line 91 of file class.ilMMItemInformation.php.

91 : isItem
92 {
93 return $item->withPosition($this->getPosition($item));
94 }

References getPosition(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\withPosition().

+ Here is the call graph for this function:

◆ customSymbol()

ilMMItemInformation::customSymbol ( hasSymbol  $item)

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation.

Definition at line 134 of file class.ilMMItemInformation.php.

134 : hasSymbol
135 {
136 $id = $item->getProviderIdentification()->serialize();
137 if (isset($this->items[$id][self::ICON_ID]) && strlen($this->items[$id][self::ICON_ID]) > 1) {
138 global $DIC;
139
140 $ri = $this->storage->find($this->items[$id][self::ICON_ID]);
141 if (!$ri) {
142 return $item;
143 }
144 $stream = $this->storage->stream($ri)->getStream();
145 $data = 'data:' . $this->storage->getRevision($ri)->getInformation()->getMimeType() . ';base64,' . base64_encode($stream->getContents());
146 $old_symbol = $item->hasSymbol() ? $item->getSymbol() : null;
147 if ($old_symbol instanceof Glyph || $old_symbol instanceof Icon) {
148 $aria_label = $old_symbol->getAriaLabel();
149 } elseif ($item instanceof hasTitle) {
150 $aria_label = $item->getTitle();
151 } else {
152 $aria_label = 'Custom icon';
153 }
154
155 $symbol = $DIC->ui()->factory()->symbol()->icon()->custom($data, $aria_label);
156
157 return $item->withSymbol($symbol);
158 }
159
160 return $item;
161 }
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:12
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:14
This describes how a icon could be modified during construction of UI.
Definition: Icon.php:10
$data
Definition: storeScorm.php:23
$DIC
Definition: xapitoken.php:46

References $data, $DIC, ILIAS\GlobalScreen\Scope\isGlobalScreenItem\getProviderIdentification(), ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol\getSymbol(), ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol\hasSymbol(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol\withSymbol().

+ Here is the call graph for this function:

◆ getParent()

ilMMItemInformation::getParent ( isChild  $item)

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation.

Definition at line 120 of file class.ilMMItemInformation.php.

121 {
122 global $DIC;
123 $parent_string = $item->getProviderIdentification()->serialize();
124 if (isset($this->items[$parent_string]['parent_identification'])) {
125 return $DIC->globalScreen()->identification()->fromSerializedIdentification($this->items[$parent_string]['parent_identification']);
126 }
127
128 return $item->getParent();
129 }

References $DIC, ILIAS\GlobalScreen\Scope\MainMenu\Factory\isChild\getParent(), and ILIAS\GlobalScreen\Scope\isGlobalScreenItem\getProviderIdentification().

+ Here is the call graph for this function:

◆ getPosition()

ilMMItemInformation::getPosition ( isItem  $item)
private

Definition at line 96 of file class.ilMMItemInformation.php.

96 : int
97 {
98 if (isset($this->items[$item->getProviderIdentification()->serialize()]['position'])) {
99 return (int) $this->items[$item->getProviderIdentification()->serialize()]['position'];
100 }
101
102 return $item->getPosition();
103 }
getPosition()
Return the default position for installation, this will be overridden by the configuration later.

References ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\getPosition(), and ILIAS\GlobalScreen\Scope\isGlobalScreenItem\getProviderIdentification().

Referenced by customPosition().

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

◆ isItemActive()

ilMMItemInformation::isItemActive ( isItem  $item)

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation.

Definition at line 108 of file class.ilMMItemInformation.php.

108 : bool
109 {
110 $serialize = $item->getProviderIdentification()->serialize();
111 if (isset($this->items[$serialize]['active'])) {
112 return $this->items[$serialize]['active'] === '1';
113 }
114 return true;
115 }

References ILIAS\GlobalScreen\Scope\isGlobalScreenItem\getProviderIdentification().

+ Here is the call graph for this function:

Field Documentation

◆ $items

ilMMItemInformation::$items = []
private

Definition at line 38 of file class.ilMMItemInformation.php.

◆ $storage

ilMMItemInformation::$storage
private

Definition at line 30 of file class.ilMMItemInformation.php.

◆ $translations

ilMMItemInformation::$translations = []
private

Definition at line 34 of file class.ilMMItemInformation.php.

◆ $ui_factory

ilMMItemInformation::$ui_factory
private

Definition at line 26 of file class.ilMMItemInformation.php.

◆ ICON_ID

const ilMMItemInformation::ICON_ID = 'icon_id'
private

Definition at line 22 of file class.ilMMItemInformation.php.


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