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)
 
 isItemActive (isItem $item)
 
 getParent (isChild $item)
 
 customSymbol (hasSymbol $item)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation
 customTranslationForUser (hasTitle $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 ( )

Member Function Documentation

◆ customPosition()

ilMMItemInformation::customPosition ( isItem  $item)

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

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

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

91  : isItem
92  {
93  return $item->withPosition($this->getPosition($item));
94  }
+ Here is the call graph for this function:

◆ customSymbol()

ilMMItemInformation::customSymbol ( hasSymbol  $item)

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

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

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().

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  }
$data
Definition: storeScorm.php:23
This describes how a icon could be modified during construction of UI.
Definition: Icon.php:9
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:13
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:11
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getParent()

ilMMItemInformation::getParent ( isChild  $item)

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

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

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

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  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getPosition()

ilMMItemInformation::getPosition ( isItem  $item)
private

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

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

Referenced by customPosition().

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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isItemActive()

ilMMItemInformation::isItemActive ( isItem  $item)

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

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

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

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