ILIAS  release_8 Revision v8.24
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 48 of file class.ilMMItemInformation.php.

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

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

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

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($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) {
151 return $item;
152 }
153
154 try {
155 $src = $this->storage->consume()->src($ri);
156 } catch (FileNotFoundException $f) {
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 $e) {
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
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:33
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:31
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29

References $DIC, Vendor\Package\$e, Vendor\Package\$f, $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 105 of file class.ilMMItemInformation.php.

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

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

References ILIAS\GlobalScreen\isGlobalScreenItem\getProviderIdentification().

+ Here is the call graph for this function:

Field Documentation

◆ $items

array ilMMItemInformation::$items
private

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

◆ $storage

Services ilMMItemInformation::$storage
private

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

◆ $translations

array ilMMItemInformation::$translations
private

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

◆ ICON_ID

const ilMMItemInformation::ICON_ID = 'icon_id'
private

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


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