ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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  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  }
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 157 of file CustomMainBarProvider.php.

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

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),
182  new ilMMLinkItemRenderer(),
183  new ilMMTypeHandlerLink()
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  }
$c
Definition: deliver.php:25
+ 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.

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

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  }
+ 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.

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

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  }
+ 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: