ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MainMenu\Provider\CustomMainBarProvider Class Reference

Class CustomMainBarProvider. More...

+ Inheritance diagram for ILIAS\MainMenu\Provider\CustomMainBarProvider:
+ Collaboration diagram for ILIAS\MainMenu\Provider\CustomMainBarProvider:

Public Member Functions

 __construct (Container $dic, ?\ilMainMenuAccess $access=null)
 @inheritDoc More...
 
 getSingleCustomItem (ilMMCustomItemStorage $storage, bool $register=false)
 
 provideTypeInformation ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getAllIdentifications ()
 @inheritDoc More...
 
 provideTypeInformation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Attributes

Container $dic
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
Container $dic
 
IdentificationProviderInterface $if
 
MainMenuItemFactory $mainmenu
 

Private Member Functions

 translateType (string $type)
 
 translateByline (string $type)
 

Private Attributes

ilMainMenuAccess $mm_access
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MainMenu\Provider\CustomMainBarProvider::__construct ( Container  $dic,
?\ilMainMenuAccess  $access = null 
)

@inheritDoc

Definition at line 68 of file CustomMainBarProvider.php.

69 {
71 $this->mm_access = $access ?? new ilObjMainMenuAccess();
72 }
Class ilObjMainMenuAccess.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\MainMenu\Provider\CustomMainBarProvider\$dic, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getProviderNameForPresentation()

ILIAS\MainMenu\Provider\CustomMainBarProvider::getProviderNameForPresentation ( )

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Provider\AbstractProvider.

Definition at line 266 of file CustomMainBarProvider.php.

266 : string
267 {
268 return "Custom";
269 }

◆ getSingleCustomItem()

ILIAS\MainMenu\Provider\CustomMainBarProvider::getSingleCustomItem ( ilMMCustomItemStorage  $storage,
bool  $register = false 
)
Parameters
ilMMCustomItemStorage$storage
bool$register
Returns
isItem

Definition at line 111 of file CustomMainBarProvider.php.

111 : isItem
112 {
113 $identification = $this->globalScreen()->identification()->core($this)->identifier($storage->getIdentifier());
114
115 $item = $this->globalScreen()->mainBar()->custom($storage->getType(), $identification);
116
117 $item = $item->withVisibilityCallable(
118 $this->mm_access->isCurrentUserAllowedToSeeCustomItem(
119 $storage,
120 fn(): bool => $item->isVisible()
121 )
122 );
123
124 if ($item instanceof hasTitle && !empty($storage->getDefaultTitle())) {
125 $item = $item->withTitle($storage->getDefaultTitle());
126 }
127 if ($item instanceof hasAction) {
128 $item = $item->withAction("#");
129 }
130 if ($item instanceof isChild) {
131 $mm_item = ilMMItemStorage::find($identification->serialize());
132 $parent_identification = '';
133 if ($mm_item instanceof ilMMItemStorage) {
134 $parent_identification = $mm_item->getParentIdentification();
135 }
136
137 if ($parent_identification !== '' && $parent_identification !== '0') {
138 $item = $item->withParent(
139 $this->globalScreen()
140 ->identification()
141 ->fromSerializedIdentification($parent_identification)
142 );
143 }
144 }
145
146 if ($register) {
148 }
149
150 return $item;
151 }
Class ilMMItemStorage.
static register(isItem $item)

References ilMMCustomItemStorage\getDefaultTitle(), ilMMCustomItemStorage\getIdentifier(), ilMMCustomItemStorage\getType(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), and ilMMItemStorage\register().

+ Here is the call graph for this function:

◆ provideTypeInformation()

ILIAS\MainMenu\Provider\CustomMainBarProvider::provideTypeInformation ( )

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider.

Definition at line 157 of file CustomMainBarProvider.php.

157 : TypeInformationCollection
158 {
159 $c = new TypeInformationCollection();
160 // TopParentItem
161 $c->add(
162 new TypeInformation(
163 TopParentItem::class,
164 $this->translateType(TopParentItem::class),
165 new TopParentItemRenderer()
166 )
167 );
168 // TopLinkItem
169 $c->add(
170 new TypeInformation(
171 TopLinkItem::class,
172 $this->translateType(TopLinkItem::class),
175 )
176 );
177 // Link
178 $c->add(
179 new TypeInformation(
180 Link::class,
181 $this->translateType(Link::class),
184 )
185 );
186
187 // LinkList
188 $link_list = new TypeInformation(
189 LinkList::class,
190 $this->translateType(LinkList::class),
191 new LinkListItemRenderer()
192 );
193 $link_list->setCreationPrevented(true);
194 $c->add($link_list);
195
196 // Separator
197 $c->add(
198 new TypeInformation(
199 Separator::class,
200 $this->translateType(Separator::class),
201 new SeparatorItemRenderer(),
203 $this->translateByline(Separator::class)
204 )
205 );
206
207 // RepositoryLink
208 $c->add(
209 new TypeInformation(
210 RepositoryLink::class,
211 $this->translateType(RepositoryLink::class),
214 )
215 );
216
217 // Lost
218 $lost = new TypeInformation(
219 Lost::class,
220 $this->translateType(Lost::class),
221 new LostItemRenderer()
222 );
223 $lost->setCreationPrevented(true);
224 $c->add($lost);
225
226 // Complex
227 $complex = new TypeInformation(
228 Complex::class,
229 $this->translateType(Complex::class),
230 new ComplexItemRenderer()
231 );
232 $complex->setCreationPrevented(true);
233 $c->add($complex);
234
235 return $c;
236 }
Class ilMMLinkItemRenderer.
Class ilMMRepositoryLinkItemRenderer.
Class ilMMTopLinkItemRenderer.
Class ilMMTypeHandlerSeparator.
$c
Definition: deliver.php:25

References $c, ILIAS\MainMenu\Provider\CustomMainBarProvider\translateByline(), and ILIAS\MainMenu\Provider\CustomMainBarProvider\translateType().

+ Here is the call graph for this function:

◆ translateByline()

ILIAS\MainMenu\Provider\CustomMainBarProvider::translateByline ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 254 of file CustomMainBarProvider.php.

254 : string
255 {
256 $last_part = substr(strrchr($type, "\\"), 1);
257 $last_part = strtolower((string) preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
258
259 return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
260 }

Referenced by ILIAS\MainMenu\Provider\CustomMainBarProvider\provideTypeInformation().

+ Here is the caller graph for this function:

◆ translateType()

ILIAS\MainMenu\Provider\CustomMainBarProvider::translateType ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 242 of file CustomMainBarProvider.php.

242 : string
243 {
244 $last_part = substr(strrchr($type, "\\"), 1);
245 $last_part = strtolower((string) preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
246
247 return $this->dic->language()->txt("type_" . strtolower($last_part));
248 }

Referenced by ILIAS\MainMenu\Provider\CustomMainBarProvider\provideTypeInformation().

+ Here is the caller graph for this function:

Field Documentation

◆ $dic

Container ILIAS\MainMenu\Provider\CustomMainBarProvider::$dic
protected

◆ $mm_access

ilMainMenuAccess ILIAS\MainMenu\Provider\CustomMainBarProvider::$mm_access
private

Definition at line 62 of file CustomMainBarProvider.php.


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