ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (isItem $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 (isItem $item)
 
 customSymbol (hasSymbol $item)
 

Private Member Functions

 getPosition (isItem $item)
 

Private Attributes

const ICON_ID = 'icon_id'
 
Services $storage
 
array $translations
 
array $items
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMItemInformation::__construct ( )

ilMMItemInformation constructor.

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

51 {
52 global $DIC;
53 $this->items = ilMMItemStorage::getArray('identification');
54 $this->translations = ilMMItemTranslationStorage::getArray('id', 'translation');
55 $this->storage = $DIC['resource_storage'];
56 }
static getArray(?string $key=null, string|array|null $values=null)
global $DIC
Definition: shib_login.php:26

References $DIC, and 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 101 of file class.ilMMItemInformation.php.

101 : isItem
102 {
103 return $item->withPosition($this->getPosition($item));
104 }

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 143 of file class.ilMMItemInformation.php.

143 : hasSymbol
144 {
145 $id = $item->getProviderIdentification()->serialize();
146 if (isset($this->items[$id][self::ICON_ID]) && strlen((string) $this->items[$id][self::ICON_ID]) > 1) {
147 global $DIC;
148
149 $ri = $this->storage->manage()->find($this->items[$id][self::ICON_ID]);
150 if ($ri === null) {
151 return $item;
152 }
153
154 try {
155 $src = $this->storage->consume()->src($ri);
156 } catch (FileNotFoundException) {
157 return $item;
158 }
159
160 $old_symbol = $item->hasSymbol() ? $item->getSymbol() : null;
161 if ($old_symbol instanceof Glyph) {
162 $aria_label = $old_symbol->getAriaLabel();
163 } elseif ($old_symbol instanceof Icon) {
164 $aria_label = $old_symbol->getLabel();
165 } elseif ($item instanceof hasTitle) {
166 $aria_label = $item->getTitle();
167 }
168
169 $aria_label = empty($aria_label) ? $id : $aria_label;
170 try {
171 $symbol = $DIC->ui()->factory()->symbol()->icon()->custom($src->getSrc(), $aria_label);
172 } catch (Exception) {
173 return $item;
174 }
175
176 return $item->withSymbol($symbol);
177 }
178
179 return $item;
180 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Indicates that a file is missing or not found.
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29

References $DIC, $id, ILIAS\GlobalScreen\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 ( isItem  $item)

@inheritDoc

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

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

130 {
131 global $DIC;
132 $serialized = $item->getProviderIdentification()->serialize();
133 if (isset($this->items[$serialized]['parent_identification'])) {
134 return $DIC->globalScreen()->identification()->fromSerializedIdentification($this->items[$serialized]['parent_identification']);
135 }
136
137 return $item->getParent();
138 }

References $DIC, and ILIAS\GlobalScreen\isGlobalScreenItem\getProviderIdentification().

+ Here is the call graph for this function:

◆ getPosition()

ilMMItemInformation::getPosition ( isItem  $item)
private

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

106 : int
107 {
108 if (isset($this->items[$item->getProviderIdentification()->serialize()]['position'])) {
109 return (int) $this->items[$item->getProviderIdentification()->serialize()]['position'];
110 }
111
112 return $item->getPosition();
113 }
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\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 118 of file class.ilMMItemInformation.php.

118 : bool
119 {
120 if (!isset($this->items[$item->getProviderIdentification()->serialize()]['active'])) {
121 return $item->isAvailable();
122 }
123 return ((int) ($this->items[$item->getProviderIdentification()->serialize()]['active'] ?? 0) === 1);
124 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $items

array ilMMItemInformation::$items
private

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

◆ $storage

Services ilMMItemInformation::$storage
private

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

◆ $translations

array ilMMItemInformation::$translations
private

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

◆ ICON_ID

const ilMMItemInformation::ICON_ID = 'icon_id'
private

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


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