ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)

Member Function Documentation

◆ getProviderNameForPresentation()

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

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Provider\AbstractProvider.

Definition at line 240 of file CustomMainBarProvider.php.

240 : string
241 {
242 return "Custom";
243 }

◆ getSingleCustomItem()

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

Definition at line 102 of file CustomMainBarProvider.php.

102 : isItem
103 {
104 $identification = $this->globalScreen()->identification()->core($this)->identifier($storage->getIdentifier());
105
106 $item = $this->globalScreen()->mainBar()->custom($storage->getType(), $identification)->withVisibilityCallable(
107 $this->mm_access->isCurrentUserAllowedToSeeCustomItem($storage)
108 );
109
110 if ($item instanceof hasTitle && !empty($storage->getDefaultTitle())) {
111 $item = $item->withTitle($storage->getDefaultTitle());
112 }
113 if ($item instanceof hasAction) {
114 $item = $item->withAction("#");
115 }
116 if ($item instanceof isChild) {
117 $mm_item = ilMMItemStorage::find($identification->serialize());
118 $parent_identification = '';
119 if ($mm_item instanceof ilMMItemStorage) {
120 $parent_identification = $mm_item->getParentIdentification();
121 }
122
123 if ($parent_identification) {
124 $item = $item->withParent(
125 $this->globalScreen()
126 ->identification()
127 ->fromSerializedIdentification($parent_identification)
128 );
129 }
130 }
131
132 if ($register) {
134 }
135
136 return $item;
137 }
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 142 of file CustomMainBarProvider.php.

142 : TypeInformationCollection
143 {
144 $c = new TypeInformationCollection();
145 // TopParentItem
146 $c->add(new TypeInformation(
147 TopParentItem::class,
148 $this->translateType(TopParentItem::class),
149 new TopParentItemRenderer())
150 );
151 // TopLinkItem
152 $c->add(new TypeInformation(
153 TopLinkItem::class,
154 $this->translateType(TopLinkItem::class),
157 );
158 // Link
159 $c->add(new TypeInformation(
160 Link::class,
161 $this->translateType(Link::class),
164 );
165
166 // LinkList
167 $link_list = new TypeInformation(
168 LinkList::class,
169 $this->translateType(LinkList::class),
170 new LinkListItemRenderer()
171 );
172 $link_list->setCreationPrevented(true);
173 $c->add($link_list);
174
175 // Separator
176 $c->add(new TypeInformation(
177 Separator::class,
178 $this->translateType(Separator::class),
179 new SeparatorItemRenderer(),
181 $this->translateByline(Separator::class))
182 );
183
184 // RepositoryLink
185 $c->add(new TypeInformation(
186 RepositoryLink::class,
187 $this->translateType(RepositoryLink::class),
190 );
191
192 // Lost
193 $lost = new TypeInformation(
194 Lost::class,
195 $this->translateType(Lost::class),
196 new LostItemRenderer()
197 );
198 $lost->setCreationPrevented(true);
199 $c->add($lost);
200
201 // Complex
202 $complex = new TypeInformation(
203 Complex::class,
204 $this->translateType(Complex::class),
205 new ComplexItemRenderer()
206 );
207 $complex->setCreationPrevented(true);
208 $c->add($complex);
209
210 return $c;
211 }
Class ilMMLinkItemRenderer.
Class ilMMRepositoryLinkItemRenderer.
Class ilMMTopLinkItemRenderer.
Class ilMMTypeHandlerSeparator.

References Vendor\Package\$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 229 of file CustomMainBarProvider.php.

229 : string
230 {
231 $last_part = substr(strrchr($type, "\\"), 1);
232 $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
233
234 return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
235 }
$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 217 of file CustomMainBarProvider.php.

217 : string
218 {
219 $last_part = substr(strrchr($type, "\\"), 1);
220 $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
221
222 return $this->dic->language()->txt("type_" . strtolower($last_part));
223 }

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

◆ $dic

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

◆ $mm_access

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

Definition at line 49 of file CustomMainBarProvider.php.


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