ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMMCustomProvider Class Reference

Class ilMMCustomProvider. More...

+ Inheritance diagram for ilMMCustomProvider:
+ Collaboration diagram for ilMMCustomProvider:

Public Member Functions

 getSingleCustomItem (ilMMCustomItemStorage $storage, $register=false)
 
 provideTypeInformation ()
 
- 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)
 

Additional Inherited Members

- Data Fields inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
const PURPOSE_MAINBAR = 'mainmenu'
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Detailed Description

Member Function Documentation

◆ getSingleCustomItem()

ilMMCustomProvider::getSingleCustomItem ( ilMMCustomItemStorage  $storage,
  $register = false 
)
Parameters
ilMMCustomItemStorage$storage
bool$register
Returns

Definition at line 73 of file class.ilMMCustomProvider.php.

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

74  {
75  $identification = $this->globalScreen()->identification()->core($this)->identifier($storage->getIdentifier());
76 
77  if ($register) {
79  }
80 
81  $item = $this->globalScreen()->mainmenu()->custom($storage->getType(), $identification);
82 
83  if ($item instanceof hasTitle && $storage->getDefaultTitle() !== '') {
84  $item = $item->withTitle($storage->getDefaultTitle());
85  }
86  if ($item instanceof hasAction) {
87  $item = $item->withAction("#");
88  }
89  if ($item instanceof isChild) {
90  $mm_item = ilMMItemStorage::find($identification->serialize());
91  $parent_identification = "";
92  if ($mm_item instanceof ilMMItemStorage) {
93  $parent_identification = $mm_item->getParentIdentification();
94  }
95 
96  if ($parent_identification) {
97  $item = $item->withParent(
98  $this->globalScreen()
99  ->identification()
100  ->fromSerializedIdentification($parent_identification)
101  );
102  }
103  }
104 
105  if ($register) {
107  }
108 
109  return $item;
110  }
static find($primary_key, array $add_constructor_args=array())
static register(isItem $item)
Class ilMMItemStorage.
static registerIdentification(\ILIAS\GlobalScreen\Identification\IdentificationInterface $identification, \ILIAS\GlobalScreen\Provider\Provider $provider)
+ Here is the call graph for this function:

◆ provideTypeInformation()

ilMMCustomProvider::provideTypeInformation ( )

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

Definition at line 116 of file class.ilMMCustomProvider.php.

References $c, translateByline(), and translateType().

117  {
119  $c->add(new TypeInformation(TopParentItem::class, $this->translateType(TopParentItem::class), new ilMMTopParentItemRenderer()));
120  $c->add(new TypeInformation(TopLinkItem::class, $this->translateType(TopLinkItem::class), new ilMMTopLinkItemRenderer(), new ilMMTypeHandlerTopLink()));
121  $c->add(new TypeInformation(Link::class, $this->translateType(Link::class), null, new ilMMTypeHandlerLink()));
122  $link_list = new TypeInformation(LinkList::class, $this->translateType(LinkList::class));
123  $link_list->setCreationPrevented(true);
124  $c->add($link_list);
125  $c->add(new TypeInformation(Separator::class, $this->translateType(Separator::class), null, new ilMMTypeHandlerSeparator(), $this->translateByline(Separator::class)));
126  $c->add(new TypeInformation(RepositoryLink::class, $this->translateType(RepositoryLink::class), null, new ilMMTypeHandlerRepositoryLink()));
127  $complex = new TypeInformation(Complex::class, $this->translateType(Complex::class));
128  $complex->setCreationPrevented(true);
129  $c->add($complex);
130  $lost = new TypeInformation(Lost::class, $this->translateType(Lost::class), new ilMMLostItemRenderer());
131  $lost->setCreationPrevented(true);
132  $c->add($lost);
133 
134  return $c;
135  }
Class ilMMTypeHandlerSeparator.
Class ilMMTopLinkItemRenderer.
Class ilMMTopParentItemRenderer.
Class ilMMLostItemRenderer.
+ Here is the call graph for this function:

◆ translateByline()

ilMMCustomProvider::translateByline ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 157 of file class.ilMMCustomProvider.php.

Referenced by provideTypeInformation().

157  : string
158  {
159  $last_part = substr(strrchr($type, "\\"), 1);
160  $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
161 
162  return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
163  }
$type
+ Here is the caller graph for this function:

◆ translateType()

ilMMCustomProvider::translateType ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 143 of file class.ilMMCustomProvider.php.

Referenced by provideTypeInformation().

143  : string
144  {
145  $last_part = substr(strrchr($type, "\\"), 1);
146  $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
147 
148  return $this->dic->language()->txt("type_" . strtolower($last_part));
149  }
$type
+ Here is the caller graph for this function:

Field Documentation

◆ $dic

ilMMCustomProvider::$dic
protected

Definition at line 30 of file class.ilMMCustomProvider.php.


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