ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 @inheritDoc More...
 
 getSingleCustomItem (ilMMCustomItemStorage $storage, $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 (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Attributes

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

Private Member Functions

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

Private Attributes

 $access_helper
 
 $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)

@inheritDoc

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

Definition at line 74 of file CustomMainBarProvider.php.

75 {
77 $this->mm_access = new ilObjMainMenuAccess();
78 $this->access_helper = BasicAccessCheckClosures::getInstance();
79 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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 273 of file CustomMainBarProvider.php.

273 : string
274 {
275 return "Custom";
276 }

◆ getSingleCustomItem()

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

Definition at line 118 of file CustomMainBarProvider.php.

118 : isItem
119 {
120 $identification = $this->globalScreen()->identification()->core($this)->identifier($storage->getIdentifier());
121
122 $item = $this->globalScreen()->mainBar()->custom($storage->getType(), $identification);
123
124 $item = $item->withVisibilityCallable(
125 $this->mm_access->isCurrentUserAllowedToSeeCustomItem(
126 $storage,
127 function () use ($item) {
128 return $item->isVisible();
129 }
130 )
131 );
132
133 if ($item instanceof hasTitle && !empty($storage->getDefaultTitle())) {
134 $item = $item->withTitle($storage->getDefaultTitle());
135 }
136 if ($item instanceof hasAction) {
137 $item = $item->withAction("#");
138 }
139 if ($item instanceof isChild) {
140 $mm_item = ilMMItemStorage::find($identification->serialize());
141 $parent_identification = '';
142 if ($mm_item instanceof ilMMItemStorage) {
143 $parent_identification = $mm_item->getParentIdentification();
144 }
145
146 if ($parent_identification) {
147 $item = $item->withParent(
148 $this->globalScreen()
149 ->identification()
150 ->fromSerializedIdentification($parent_identification)
151 );
152 }
153 }
154
155 if ($register) {
157 }
158
159 return $item;
160 }
static find($primary_key, array $add_constructor_args=array())
@inheritDoc
Class ilMMItemStorage.
static register(isItem $item)

References CachedActiveRecord\find(), 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 165 of file CustomMainBarProvider.php.

165 : TypeInformationCollection
166 {
167 $c = new TypeInformationCollection();
168 // TopParentItem
169 $c->add(
170 new TypeInformation(
171 TopParentItem::class,
172 $this->translateType(TopParentItem::class),
173 new TopParentItemRenderer()
174 )
175 );
176 // TopLinkItem
177 $c->add(
178 new TypeInformation(
179 TopLinkItem::class,
180 $this->translateType(TopLinkItem::class),
183 )
184 );
185 // Link
186 $c->add(
187 new TypeInformation(
188 Link::class,
189 $this->translateType(Link::class),
192 )
193 );
194
195 // LinkList
196 $link_list = new TypeInformation(
197 LinkList::class,
198 $this->translateType(LinkList::class),
199 new LinkListItemRenderer()
200 );
201 $link_list->setCreationPrevented(true);
202 $c->add($link_list);
203
204 // Separator
205 $c->add(
206 new TypeInformation(
207 Separator::class,
208 $this->translateType(Separator::class),
209 new SeparatorItemRenderer(),
211 $this->translateByline(Separator::class)
212 )
213 );
214
215 // RepositoryLink
216 $c->add(
217 new TypeInformation(
218 RepositoryLink::class,
219 $this->translateType(RepositoryLink::class),
222 )
223 );
224
225 // Lost
226 $lost = new TypeInformation(
227 Lost::class,
228 $this->translateType(Lost::class),
229 new LostItemRenderer()
230 );
231 $lost->setCreationPrevented(true);
232 $c->add($lost);
233
234 // Complex
235 $complex = new TypeInformation(
236 Complex::class,
237 $this->translateType(Complex::class),
238 new ComplexItemRenderer()
239 );
240 $complex->setCreationPrevented(true);
241 $c->add($complex);
242
243 return $c;
244 }
Class ilMMLinkItemRenderer.
Class ilMMRepositoryLinkItemRenderer.
Class ilMMTopLinkItemRenderer.
Class ilMMTypeHandlerSeparator.
$c
Definition: cli.php:37

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 262 of file CustomMainBarProvider.php.

262 : string
263 {
264 $last_part = substr(strrchr($type, "\\"), 1);
265 $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
266
267 return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
268 }
$type

References $type.

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 250 of file CustomMainBarProvider.php.

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

References $type.

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

+ Here is the caller graph for this function:

Field Documentation

◆ $access_helper

ILIAS\MainMenu\Provider\CustomMainBarProvider::$access_helper
private

Definition at line 61 of file CustomMainBarProvider.php.

◆ $dic

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

◆ $mm_access

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

Definition at line 65 of file CustomMainBarProvider.php.


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