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

Class ilMMAbstractItemFacade. More...

+ Inheritance diagram for ilMMAbstractItemFacade:
+ Collaboration diagram for ilMMAbstractItemFacade:

Public Member Functions

 __construct (\ILIAS\GlobalScreen\Identification\IdentificationInterface $identification, Main $collector)
 ilMMAbstractItemFacade constructor. More...
 
 getId ()
 
 hasStorage ()
 
 isEmpty ()
 
 itemStorage ()
 
 identification ()
 
 item ()
 
 getAmountOfChildren ()
 
 isAvailable ()
 
 isActivated ()
 @inheritDoc More...
 
 isAlwaysAvailable ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getDefaultTitle ()
 
 setDefaultTitle (string $default_title)
 
 getStatus ()
 
 getTypeForPresentation ()
 
 getParentIdentificationString ()
 
 isCustomType ()
 
 isTopItem ()
 @inheritDoc More...
 
 isInLostItem ()
 @inheritDoc More...
 
 setIsTopItm (bool $top_item)
 @inheritDoc More...
 
 getType ()
 FSX check if doublette. More...
 
 setParent (string $parent)
 
 setPosition (int $position)
 
Parameters
int$position
More...
 
 setActiveStatus (bool $status)
 
 update ()
 
 create ()
 
 delete ()
 @inheritDoc More...
 
- Public Member Functions inherited from ilMMItemFacadeInterface
 itemStorage ()
 
 item ()
 
 identification ()
 
 getTypeForPresentation ()
 
 getProviderNameForPresentation ()
 
 getStatus ()
 
 isAvailable ()
 
 isActivated ()
 
 isEditable ()
 
 isDeletable ()
 
 isAlwaysAvailable ()
 
 getDefaultTitle ()
 
 getId ()
 
 getAmountOfChildren ()
 
 hasStorage ()
 
 isEmpty ()
 
 isCustom ()
 
 isCustomType ()
 
 getParentIdentificationString ()
 
 getType ()
 
 isTopItem ()
 
 isInLostItem ()
 
 setAction (string $action)
 
 setActiveStatus (bool $status)
 
 setDefaultTitle (string $default_title)
 
 setPosition (int $position)
 
 setParent (string $parent)
 
 setType (string $type)
 
 setIsTopItm (bool $top_item)
 
 update ()
 
 create ()
 
 delete ()
 

Protected Member Functions

 deleteAssociatedTranslations ()
 deletes all translations associated with the current identification. More...
 

Protected Attributes

 $type_information
 
 $mm_item
 
 $gs_item
 
 $identification
 
 $default_title = "-"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMAbstractItemFacade::__construct ( \ILIAS\GlobalScreen\Identification\IdentificationInterface  $identification,
Main  $collector 
)

ilMMAbstractItemFacade constructor.

Parameters
\ILIAS\GlobalScreen\Identification\IdentificationInterface$identification
Main$collector
Exceptions
Throwable

Reimplemented in ilMMItemFacade.

Definition at line 55 of file class.ilMMAbstractItemFacade.php.

56 {
58 $this->gs_item = $collector->getSingleItem($identification);
59 $this->type_information = $collector->getTypeInformationCollection()->get(get_class($this->gs_item));
60 $this->mm_item = ilMMItemStorage::register($this->gs_item);
61 }
static register(isItem $item)

References $identification, identification(), and ilMMItemStorage\register().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMMAbstractItemFacade::create ( )
Returns
void

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

Definition at line 323 of file class.ilMMAbstractItemFacade.php.

324 {
326 $this->mm_item->create();
327 ilMMItemStorage::register($this->gs_item);
328 }
static storeDefaultTranslation(IdentificationInterface $identification, string $translation)

References identification(), ilMMItemStorage\register(), and ilMMItemTranslationStorage\storeDefaultTranslation().

+ Here is the call graph for this function:

◆ delete()

ilMMAbstractItemFacade::delete ( )

@inheritDoc

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade.

Definition at line 352 of file class.ilMMAbstractItemFacade.php.

353 {
354 if ($this->isDeletable()) {
356 $serialize = $this->identification->serialize();
357 $gs = ilGSIdentificationStorage::find($serialize);
358 if ($gs instanceof ilGSIdentificationStorage) {
359 $gs->delete();
360 }
361 $mm = ilMMItemStorage::find($serialize);
362 if ($mm instanceof ilMMItemStorage) {
363 $mm->delete();
364 }
365 }
366 }
static find($primary_key, array $add_constructor_args=array())
@inheritDoc
deleteAssociatedTranslations()
deletes all translations associated with the current identification.
Class ilMMItemStorage.

References deleteAssociatedTranslations(), CachedActiveRecord\find(), identification(), and ilMMItemFacadeInterface\isDeletable().

+ Here is the call graph for this function:

◆ deleteAssociatedTranslations()

ilMMAbstractItemFacade::deleteAssociatedTranslations ( )
protected

deletes all translations associated with the current identification.

Exceptions
Exception

Definition at line 334 of file class.ilMMAbstractItemFacade.php.

335 {
337 'identification' => $this->identification->serialize(),
338 ], '=')->get();
339
340 if (!empty($ts)) {
341 foreach ($ts as $translation) {
342 if ($translation instanceof ilMMItemTranslationStorage) {
343 $translation->delete();
344 }
345 }
346 }
347 }
static where($where, $operator=null)
Class ilMMItemTranslationStorage.

References identification(), and ActiveRecord\where().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAmountOfChildren()

ilMMAbstractItemFacade::getAmountOfChildren ( )
Returns
int

Implements ilMMItemFacadeInterface.

Definition at line 115 of file class.ilMMAbstractItemFacade.php.

115 : int
116 {
117 if ($this->gs_item instanceof \ILIAS\GlobalScreen\Scope\MainMenu\Factory\isParent) {
118 return count($this->gs_item->getChildren());
119 }
120
121 return 0;
122 }
Class BaseForm.

◆ getDefaultTitle()

ilMMAbstractItemFacade::getDefaultTitle ( )
Returns
string

Implements ilMMItemFacadeInterface.

Definition at line 161 of file class.ilMMAbstractItemFacade.php.

161 : string
162 {
163 $default_translation = ilMMItemTranslationStorage::getDefaultTranslation($this->identification);
164 if ($default_translation !== "") {
165 return $default_translation;
166 }
167 if ($this->default_title == "-" && $this->gs_item instanceof \ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle) {
168 $this->default_title = $this->gs_item->getTitle();
169 }
170
172 }

References $default_title, and identification().

+ Here is the call graph for this function:

◆ getId()

ilMMAbstractItemFacade::getId ( )
Returns
string

Implements ilMMItemFacadeInterface.

Definition at line 64 of file class.ilMMAbstractItemFacade.php.

64 : string
65 {
66 return $this->identification->serialize();
67 }

References identification().

Referenced by hasStorage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentIdentificationString()

ilMMAbstractItemFacade::getParentIdentificationString ( )
Returns
string

Implements ilMMItemFacadeInterface.

Definition at line 208 of file class.ilMMAbstractItemFacade.php.

208 : string
209 {
210 if ($this->gs_item instanceof isChild) {
211 $provider_name_for_presentation = $this->gs_item->getParent()->serialize();
212
213 return $provider_name_for_presentation;
214 }
215
216 return "";
217 }

◆ getProviderNameForPresentation()

ilMMAbstractItemFacade::getProviderNameForPresentation ( )
Returns
string

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade, and ilMMNullItemFacade.

Definition at line 152 of file class.ilMMAbstractItemFacade.php.

152 : string
153 {
154 return $this->identification->getProviderNameForPresentation();
155 }

References identification().

+ Here is the call graph for this function:

◆ getStatus()

ilMMAbstractItemFacade::getStatus ( )
Returns
string

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade.

Definition at line 187 of file class.ilMMAbstractItemFacade.php.

187 : string
188 {
189 global $DIC;
190 if (!$this->gs_item->isAvailable() || $this->gs_item->isAlwaysAvailable()) {
191 return $DIC->ui()->renderer()->render($this->gs_item->getNonAvailableReason());
192 }
193
194 return "";
195 }
global $DIC
Definition: saml.php:7

References $DIC.

◆ getType()

ilMMAbstractItemFacade::getType ( )

FSX check if doublette.

@inheritDoc

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade.

Definition at line 281 of file class.ilMMAbstractItemFacade.php.

281 : string
282 {
283 return $this->type_information->getType();
284 }

◆ getTypeForPresentation()

ilMMAbstractItemFacade::getTypeForPresentation ( )
Returns
string
Exceptions
ReflectionException

Implements ilMMItemFacadeInterface.

Definition at line 202 of file class.ilMMAbstractItemFacade.php.

202 : string
203 {
204 return $this->type_information->getTypeNameForPresentation();
205 }

◆ hasStorage()

ilMMAbstractItemFacade::hasStorage ( )
Returns
bool

Implements ilMMItemFacadeInterface.

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

73 : bool
74 {
75 return ilMMItemStorage::find($this->getId()) !== null;
76 }

References CachedActiveRecord\find(), and getId().

+ Here is the call graph for this function:

◆ identification()

ilMMAbstractItemFacade::identification ( )
Returns
\ILIAS\GlobalScreen\Identification\IdentificationInterface

Implements ilMMItemFacadeInterface.

Definition at line 100 of file class.ilMMAbstractItemFacade.php.

References $identification.

Referenced by __construct(), create(), delete(), deleteAssociatedTranslations(), getDefaultTitle(), getId(), getProviderNameForPresentation(), update(), and ilMMCustomItemFacade\update().

+ Here is the caller graph for this function:

◆ isActivated()

ilMMAbstractItemFacade::isActivated ( )

@inheritDoc

Implements ilMMItemFacadeInterface.

Definition at line 134 of file class.ilMMAbstractItemFacade.php.

134 : bool
135 {
136 return (bool) $this->mm_item->isActive() || $this->item()->isAlwaysAvailable();
137 }

References item().

+ Here is the call graph for this function:

◆ isAlwaysAvailable()

ilMMAbstractItemFacade::isAlwaysAvailable ( )

@inheritDoc

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

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

143 : bool
144 {
145 return $this->item()->isAlwaysAvailable();
146 }

References item().

+ Here is the call graph for this function:

◆ isAvailable()

ilMMAbstractItemFacade::isAvailable ( )
Returns
bool

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

Definition at line 125 of file class.ilMMAbstractItemFacade.php.

125 : bool
126 {
127 return (bool) ($this->gs_item->isAvailable() || $this->item()->isAlwaysAvailable());
128 }

References item().

+ Here is the call graph for this function:

◆ isCustomType()

ilMMAbstractItemFacade::isCustomType ( )
Returns
bool

Implements ilMMItemFacadeInterface.

Definition at line 223 of file class.ilMMAbstractItemFacade.php.

223 : bool
224 {
225 $known_core_types = [
226 Complex::class,
227 Link::class,
228 LinkList::class,
229 Lost::class,
230 RepositoryLink::class,
231 Separator::class,
232 TopLinkItem::class,
233 TopParentItem::class,
234 ];
235 foreach ($known_core_types as $known_core_type) {
236 if (get_class($this->gs_item) === $known_core_type) {
237 return false;
238 }
239 }
240
241 return true;
242 }

◆ isEmpty()

ilMMAbstractItemFacade::isEmpty ( )
Returns
bool

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

Definition at line 82 of file class.ilMMAbstractItemFacade.php.

82 : bool
83 {
84 return $this->mm_item->getIdentification() == '';
85 }

◆ isInLostItem()

ilMMAbstractItemFacade::isInLostItem ( )

@inheritDoc

Implements ilMMItemFacadeInterface.

Definition at line 257 of file class.ilMMAbstractItemFacade.php.

257 : bool
258 {
259 if ($this->gs_item instanceof isChild) {
260 return $this->gs_item->getParent() instanceof NullIdentification;
261 }
262
263 return false;
264 }

◆ isTopItem()

ilMMAbstractItemFacade::isTopItem ( )

@inheritDoc

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade, and ilMMNullItemFacade.

Definition at line 248 of file class.ilMMAbstractItemFacade.php.

248 : bool
249 {
250 return $this->gs_item instanceof isTopItem;
251 }

References isTopItem().

Referenced by isTopItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ item()

ilMMAbstractItemFacade::item ( )
Returns
isItem

Implements ilMMItemFacadeInterface.

Definition at line 109 of file class.ilMMAbstractItemFacade.php.

References $gs_item.

Referenced by isActivated(), isAlwaysAvailable(), and isAvailable().

+ Here is the caller graph for this function:

◆ itemStorage()

ilMMAbstractItemFacade::itemStorage ( )

◆ setActiveStatus()

ilMMAbstractItemFacade::setActiveStatus ( bool  $status)
Parameters
bool$status

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

Definition at line 308 of file class.ilMMAbstractItemFacade.php.

309 {
310 $this->mm_item->setActive($status);
311 }

◆ setDefaultTitle()

ilMMAbstractItemFacade::setDefaultTitle ( string  $default_title)
Parameters
string$default_title

Implements ilMMItemFacadeInterface.

Definition at line 178 of file class.ilMMAbstractItemFacade.php.

179 {
180 $this->default_title = $default_title;
181 }

References $default_title.

◆ setIsTopItm()

ilMMAbstractItemFacade::setIsTopItm ( bool  $top_item)

@inheritDoc

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade, and ilMMNullItemFacade.

Definition at line 270 of file class.ilMMAbstractItemFacade.php.

271 {
272 // TODO: Implement setIsTopItm() method.
273 }

◆ setParent()

ilMMAbstractItemFacade::setParent ( string  $parent)
Parameters
string$parent

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMNullItemFacade.

Definition at line 290 of file class.ilMMAbstractItemFacade.php.

291 {
292 $this->mm_item->setParentIdentification($parent);
293 }

◆ setPosition()

ilMMAbstractItemFacade::setPosition ( int  $position)

Parameters
int$position

Implements ilMMItemFacadeInterface.

Definition at line 299 of file class.ilMMAbstractItemFacade.php.

300 {
301 $this->mm_item->setPosition($position);
302 }

◆ update()

ilMMAbstractItemFacade::update ( )
Returns
void

Implements ilMMItemFacadeInterface.

Reimplemented in ilMMCustomItemFacade.

Definition at line 316 of file class.ilMMAbstractItemFacade.php.

317 {
319 $this->mm_item->update();
320 }

References identification(), and ilMMItemTranslationStorage\storeDefaultTranslation().

+ Here is the call graph for this function:

Field Documentation

◆ $default_title

ilMMAbstractItemFacade::$default_title = "-"
protected

◆ $gs_item

ilMMAbstractItemFacade::$gs_item
protected

Definition at line 36 of file class.ilMMAbstractItemFacade.php.

Referenced by item().

◆ $identification

ilMMAbstractItemFacade::$identification
protected

◆ $mm_item

ilMMAbstractItemFacade::$mm_item
protected

Definition at line 32 of file class.ilMMAbstractItemFacade.php.

Referenced by itemStorage().

◆ $type_information

ilMMAbstractItemFacade::$type_information
protected

Definition at line 28 of file class.ilMMAbstractItemFacade.php.


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