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 ()
 
 isAlwaysAvailable ()
 
 getProviderNameForPresentation ()
 
 getDefaultTitle ()
 
 setDefaultTitle (string $default_title)
 
 getStatus ()
 
 getTypeForPresentation ()
 
 getParentIdentificationString ()
 
 isCustomType ()
 
 isTopItem ()
 
 isInLostItem ()
 
 setIsTopItm (bool $top_item)
 
 getType ()
 FSX check if doublette. More...
 
 setParent (string $parent)
 
 setPosition (int $position)
 
Parameters
int$position
More...
 
 setActiveStatus (bool $status)
 
 update ()
 
 create ()
 
 delete ()
 
- Public Member Functions inherited from ilMMItemFacadeInterface
 isEditable ()
 
 isDeletable ()
 
 isCustom ()
 
 setAction (string $action)
 
 setType (string $type)
 

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

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

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

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)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMMAbstractItemFacade::create ( )
Returns
void

Implements ilMMItemFacadeInterface.

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

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

324  {
326  $this->mm_item->create();
327  ilMMItemStorage::register($this->gs_item);
328  }
static storeDefaultTranslation(IdentificationInterface $identification, string $translation)
static register(isItem $item)
+ Here is the call graph for this function:

◆ delete()

ilMMAbstractItemFacade::delete ( )

Implements ilMMItemFacadeInterface.

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

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

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  }
deleteAssociatedTranslations()
deletes all translations associated with the current identification.
static find($primary_key, array $add_constructor_args=array())
Class ilMMItemStorage.
+ 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.

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

Referenced by delete().

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

References $default_title, and identification().

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 
171  return $this->default_title;
172  }
Class BaseForm.
+ Here is the call graph for this function:

◆ getId()

ilMMAbstractItemFacade::getId ( )
Returns
string

Implements ilMMItemFacadeInterface.

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

References identification().

Referenced by hasStorage().

64  : string
65  {
66  return $this->identification->serialize();
67  }
+ 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.

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

References identification().

152  : string
153  {
154  return $this->identification->getProviderNameForPresentation();
155  }
+ Here is the call graph for this function:

◆ getStatus()

ilMMAbstractItemFacade::getStatus ( )
Returns
string

Implements ilMMItemFacadeInterface.

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

References $DIC.

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

◆ getType()

ilMMAbstractItemFacade::getType ( )

FSX check if doublette.

Implements ilMMItemFacadeInterface.

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.

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

73  : bool
74  {
75  return ilMMItemStorage::find($this->getId()) !== null;
76  }
static find($primary_key, array $add_constructor_args=array())
+ Here is the call graph for this function:

◆ identification()

◆ isActivated()

ilMMAbstractItemFacade::isActivated ( )

Implements ilMMItemFacadeInterface.

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

References item().

134  : bool
135  {
136  return (bool) $this->mm_item->isActive() || $this->item()->isAlwaysAvailable();
137  }
+ Here is the call graph for this function:

◆ isAlwaysAvailable()

ilMMAbstractItemFacade::isAlwaysAvailable ( )

Implements ilMMItemFacadeInterface.

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

References item().

143  : bool
144  {
145  return $this->item()->isAlwaysAvailable();
146  }
+ Here is the call graph for this function:

◆ isAvailable()

ilMMAbstractItemFacade::isAvailable ( )
Returns
bool

Implements ilMMItemFacadeInterface.

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

References item().

125  : bool
126  {
127  return (bool) ($this->gs_item->isAvailable() || $this->item()->isAlwaysAvailable());
128  }
+ 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.

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

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

◆ isInLostItem()

ilMMAbstractItemFacade::isInLostItem ( )

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

Implements ilMMItemFacadeInterface.

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

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

◆ 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 ( )
Returns
ilMMItemStorage

Implements ilMMItemFacadeInterface.

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

References $mm_item.

92  {
93  return $this->mm_item;
94  }
Class ilMMItemStorage.

◆ setActiveStatus()

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

Implements ilMMItemFacadeInterface.

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.

References $default_title.

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

◆ setIsTopItm()

ilMMAbstractItemFacade::setIsTopItm ( bool  $top_item)

Implements ilMMItemFacadeInterface.

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.

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.

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

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

317  {
319  $this->mm_item->update();
320  }
static storeDefaultTranslation(IdentificationInterface $identification, string $translation)
+ 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: