ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (isItem $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'
 
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.

References $DIC, ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation\customTranslationForUser(), ActiveRecord\getArray(), ilMMItemTranslationStorage\getDefaultLanguage(), ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle\getTitle(), null, and ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle\withTitle().

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

Member Function Documentation

◆ customPosition()

ilMMItemInformation::customPosition ( isItem  $item)

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

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

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

101  : isItem
102  {
103  return $item->withPosition($this->getPosition($item));
104  }
+ Here is the call graph for this function:

◆ customSymbol()

ilMMItemInformation::customSymbol ( hasSymbol  $item)

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

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

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Indicates that a file is missing or not found.
+ Here is the call graph for this function:

◆ getParent()

ilMMItemInformation::getParent ( isItem  $item)

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

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

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

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

◆ getPosition()

ilMMItemInformation::getPosition ( isItem  $item)
private

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

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

Referenced by customPosition().

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

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

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