ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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)
 
 getSingleCustomItem (ilMMCustomItemStorage $storage, bool $register=false)
 
 provideTypeInformation ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 __construct (Container $dic)
 
 getAllIdentifications ()
 
 provideTypeInformation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
 getStaticTopItems ()
 
 getStaticSubItems ()
 

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()

Member Function Documentation

◆ getProviderNameForPresentation()

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

Implements ILIAS\GlobalScreen\Provider\Provider.

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.

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

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

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  function () use ($item) {
121  return $item->isVisible();
122  }
123  )
124  );
125 
126  if ($item instanceof hasTitle && !empty($storage->getDefaultTitle())) {
127  $item = $item->withTitle($storage->getDefaultTitle());
128  }
129  if ($item instanceof hasAction) {
130  $item = $item->withAction("#");
131  }
132  if ($item instanceof isChild) {
133  $mm_item = ilMMItemStorage::find($identification->serialize());
134  $parent_identification = '';
135  if ($mm_item instanceof ilMMItemStorage) {
136  $parent_identification = $mm_item->getParentIdentification();
137  }
138 
139  if ($parent_identification) {
140  $item = $item->withParent(
141  $this->globalScreen()
142  ->identification()
143  ->fromSerializedIdentification($parent_identification)
144  );
145  }
146  }
147 
148  if ($register) {
150  }
151 
152  return $item;
153  }
static register(isItem $item)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ provideTypeInformation()

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

Implements ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider.

Definition at line 158 of file CustomMainBarProvider.php.

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

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

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

255  : string
256  {
257  $last_part = substr(strrchr($type, "\\"), 1);
258  $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
259 
260  return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
261  }
+ 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 243 of file CustomMainBarProvider.php.

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

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

Field Documentation

◆ $dic

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

Definition at line 63 of file CustomMainBarProvider.php.

◆ $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: