ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables 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)
 
 getSingleCustomItem (ilMMCustomItemStorage $storage, $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 (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
 getStaticTopItems ()
 
 getStaticSubItems ()
 

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

Member Function Documentation

◆ getProviderNameForPresentation()

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

Implements ILIAS\GlobalScreen\Provider\Provider.

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.

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

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

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())
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 165 of file CustomMainBarProvider.php.

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

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),
190  new \ilMMLinkItemRenderer(),
191  new ilMMTypeHandlerLink()
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  }
$c
Definition: cli.php:37
Class ilMMLinkItemRenderer.
Class ilMMRepositoryLinkItemRenderer.
Class ilMMTopLinkItemRenderer.
+ 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.

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

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

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

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  }
$type
+ 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

Definition at line 69 of file CustomMainBarProvider.php.

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