ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMMItemInformation.php
Go to the documentation of this file.
1
<?
php
2
3
use
ILIAS\GlobalScreen\Collector\StorageFacade
;
4
use
ILIAS\GlobalScreen\Identification\IdentificationInterface
;
5
use
ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation
;
6
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle
;
7
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isChild
;
8
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem
;
9
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isTopItem
;
10
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item\RepositoryLink
;
11
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item\Link
;
12
18
class
ilMMItemInformation
implements
ItemInformation
19
{
20
24
private
$translations
= [];
28
private
$items
= [];
29
30
36
public
function
__construct
()
37
{
38
$this->items =
ilMMItemStorage::getArray
(
'identification'
);
39
$this->translations =
ilMMItemTranslationStorage::getArray
(
'id'
,
'translation'
);
40
}
41
42
46
public
function
translateItemForUser
(
hasTitle
$item) :
hasTitle
47
{
51
global
$DIC
;
52
static
$usr_language_key;
53
static
$default_language;
54
if
(!$usr_language_key) {
55
$usr_language_key = $DIC->language()->getUserLanguage() ? $DIC->language()->getUserLanguage() : $DIC->language()->getDefaultLanguage();
56
}
57
if
(!$default_language) {
58
$default_language =
ilMMItemTranslationStorage::getDefaultLanguage
();
59
}
60
61
$ar =
ilMMTypeActionStorage::where
([
62
'identification'
=> $item->getProviderIdentification()->serialize()
63
],
'='
)->first();
64
65
if
(null !== $ar && $item instanceof
RepositoryLink
&& empty($item->
getTitle
())) {
66
$item = $item->
withTitle
(($ar->getAction() > 0) ?
67
ilObject2::_lookupTitle
(
ilObject2::_lookupObjectId
($ar->getAction())) :
68
""
69
);
70
}
71
if
(null !== $ar && $item instanceof
Link
&& empty($item->
getTitle
())) {
72
$item = $item->
withTitle
($ar->getAction());
73
}
74
if
($item instanceof
hasTitle
&& isset($this->translations[
"{$item->getProviderIdentification()->serialize()}|$usr_language_key"
])
75
&& $this->translations[
"{$item->getProviderIdentification()->serialize()}|$usr_language_key"
] !==
''
76
) {
77
$item = $item->
withTitle
((
string
) $this->translations[
"{$item->getProviderIdentification()->serialize()}|$usr_language_key"
]);
78
}
79
80
return
$item;
81
}
82
83
87
public
function
getPositionOfSubItem
(
isChild
$child) : int
88
{
89
$position = $this->
getPosition
($child);
90
91
return
$position;
92
}
93
94
98
public
function
getPositionOfTopItem
(
isTopItem
$top_item) : int
99
{
100
return
$this->
getPosition
($top_item);
101
}
102
103
104
private
function
getPosition
(
isItem
$item) : int
105
{
106
if
(isset($this->items[$item->
getProviderIdentification
()->serialize()][
'position'
])) {
107
return
(
int
) $this->items[$item->
getProviderIdentification
()->serialize()][
'position'
];
108
}
109
110
return
$item->
getPosition
();
111
}
112
113
117
public
function
isItemActive
(
isItem
$item) : bool
118
{
119
$serialize = $item->
getProviderIdentification
()->serialize();
120
if
(isset($this->items[$serialize][
'active'
])) {
121
return
$this->items[$serialize][
'active'
] ===
"1"
;
122
}
123
124
return
$item->
isActive
();
125
}
126
127
131
public
function
getParent
(
isChild
$item) :
IdentificationInterface
132
{
133
global
$DIC
;
134
$parent_string = $item->
getProviderIdentification
()->serialize();
135
if
(isset($this->items[$parent_string][
'parent_identification'
])) {
136
return
$DIC->globalScreen()->identification()->fromSerializedIdentification($this->items[$parent_string][
'parent_identification'
]);
137
}
138
139
return
$item->
getParent
();
140
}
141
}
ilMMItemTranslationStorage\getDefaultLanguage
static getDefaultLanguage()
Definition:
class.ilMMItemTranslationStorage.php:94
ilMMItemInformation
Class ilMMItemInformation.
Definition:
class.ilMMItemInformation.php:18
RepositoryLink
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isChild\getParent
getParent()
ilObject2\_lookupTitle
static _lookupTitle($a_id)
Definition:
class.ilObject2.php:255
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\getProviderIdentification
getProviderIdentification()
$DIC
global $DIC
Definition:
saml.php:7
isTopItem
ILIAS\GlobalScreen\Identification\IdentificationInterface
Interface IdentificationInterface.
Definition:
IdentificationInterface.php:8
ilMMItemInformation\$items
$items
Definition:
class.ilMMItemInformation.php:28
ilMMItemInformation\getPositionOfSubItem
getPositionOfSubItem(isChild $child)
Definition:
class.ilMMItemInformation.php:87
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem
Interface IFactory.
Definition:
isItem.php:12
ilObject2\_lookupObjectId
static _lookupObjectId($a_ref_id)
Definition:
class.ilObject2.php:319
isChild
ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation\translateItemForUser
translateItemForUser(hasTitle $item)
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isChild
Interface isChild.
Definition:
isChild.php:10
Link
ActiveRecord\where
static where($where, $operator=null)
Definition:
class.ActiveRecord.php:687
ItemInformation
ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item\RepositoryLink
Class Link.
Definition:
RepositoryLink.php:17
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isTopItem
Interface TopIs.
Definition:
isTopItem.php:8
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle
Interface hasTitle.
Definition:
hasTitle.php:8
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\isActive
isActive()
ILIAS\GlobalScreen\Scope\MainMenu\Collector\Information\ItemInformation
Class ItemInformation.
Definition:
ItemInformation.php:14
StorageFacade
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\getPosition
getPosition()
Return the default position for installation, this will be overridden by the configuration later...
IdentificationInterface
ilMMItemInformation\getPositionOfTopItem
getPositionOfTopItem(isTopItem $top_item)
Definition:
class.ilMMItemInformation.php:98
ilMMItemInformation\getPosition
getPosition(isItem $item)
Definition:
class.ilMMItemInformation.php:104
ilMMItemInformation\getParent
getParent(isChild $item)
Definition:
class.ilMMItemInformation.php:131
ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item\Link
Class Link.
Definition:
Link.php:15
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle\getTitle
getTitle()
isItem
ilMMItemInformation\isItemActive
isItemActive(isItem $item)
Definition:
class.ilMMItemInformation.php:117
ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle\withTitle
withTitle(string $title)
ActiveRecord\getArray
static getArray($key=null, $values=null)
Definition:
class.ActiveRecord.php:908
php
hasTitle
ilMMItemInformation\$translations
$translations
Definition:
class.ilMMItemInformation.php:24
ilMMItemInformation\__construct
__construct()
ilMMItemInformation constructor.
Definition:
class.ilMMItemInformation.php:36
Services
MainMenu
classes
Items
class.ilMMItemInformation.php
Generated on Thu Jan 16 2025 19:02:24 for ILIAS by
1.8.13 (using
Doxyfile
)