ILIAS  release_7 Revision v7.30-3-g800a261c036
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'
 
 $ui_factory
 
 $storage
 
 $translations = []
 
 $items = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMItemInformation::__construct ( )

ilMMItemInformation constructor.

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

60 {
61 global $DIC;
62 $this->items = ilMMItemStorage::getArray('identification');
63 $this->translations = ilMMItemTranslationStorage::getArray('id', 'translation');
64 $this->storage = $DIC['resource_storage'];
65 }
static getArray($key=null, $values=null)
global $DIC
Definition: goto.php:24

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

109 : isItem
110 {
111 return $item->withPosition($this->getPosition($item));
112 }

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

152 : hasSymbol
153 {
154 $id = $item->getProviderIdentification()->serialize();
155 if (isset($this->items[$id][self::ICON_ID]) && strlen($this->items[$id][self::ICON_ID]) > 1) {
156 global $DIC;
157
158 $ri = $this->storage->manage()->find($this->items[$id][self::ICON_ID]);
159 if (!$ri) {
160 return $item;
161 }
162
163 try {
164 $src = $this->storage->consume()->src($ri);
165 } catch (FileNotFoundException $f) {
166 return $item;
167 }
168
169 $old_symbol = $item->hasSymbol() ? $item->getSymbol() : null;
170 if ($old_symbol instanceof Glyph) {
171 $aria_label = $old_symbol->getAriaLabel();
172 } elseif ($old_symbol instanceof Icon) {
173 $aria_label = $old_symbol->getLabel();
174 } elseif ($item instanceof hasTitle) {
175 $aria_label = $item->getTitle();
176 }
177
178 $aria_label = empty($aria_label) ? $id : $aria_label;
179
180 $symbol = $DIC->ui()->factory()->symbol()->icon()->custom($src->getSrc(), $aria_label);
181
182 return $item->withSymbol($symbol);
183 }
184
185 return $item;
186 }
Class FileNotFoundException Indicates that a file is missing or not found.
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:14
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:10

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

139 {
140 global $DIC;
141 $serialized = $item->getProviderIdentification()->serialize();
142 if (isset($this->items[$serialized]['parent_identification'])) {
143 return $DIC->globalScreen()->identification()->fromSerializedIdentification($this->items[$serialized]['parent_identification']);
144 }
145
146 return $item->getParent();
147 }

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

+ Here is the call graph for this function:

◆ getPosition()

ilMMItemInformation::getPosition ( isItem  $item)
private

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

114 : int
115 {
116 if (isset($this->items[$item->getProviderIdentification()->serialize()]['position'])) {
117 return (int) $this->items[$item->getProviderIdentification()->serialize()]['position'];
118 }
119
120 return $item->getPosition();
121 }
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 126 of file class.ilMMItemInformation.php.

126 : bool
127 {
128 $serialize = $item->getProviderIdentification()->serialize();
129 if (isset($this->items[$serialize]['active'])) {
130 return $this->items[$serialize]['active'] === '1';
131 }
132 return true;
133 }

References ILIAS\GlobalScreen\isGlobalScreenItem\getProviderIdentification().

+ Here is the call graph for this function:

Field Documentation

◆ $items

ilMMItemInformation::$items = []
private

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

◆ $storage

ilMMItemInformation::$storage
private

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

◆ $translations

ilMMItemInformation::$translations = []
private

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

◆ $ui_factory

ilMMItemInformation::$ui_factory
private

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

◆ ICON_ID

const ilMMItemInformation::ICON_ID = 'icon_id'
private

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


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