ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMMNullItemFacade.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
9 
16 {
17  private ?string $parent_identification = "";
18  private bool $active_status;
19  protected bool $top_item = false;
20 
21 
26  {
28  parent::__construct($identification, $collector);
29  }
30 
31 
35  public function isTopItem(): bool
36  {
37  return $this->top_item;
38  }
39 
40 
44  public function setIsTopItm(bool $top_item): void
45  {
46  $this->top_item = $top_item;
47  }
48 
49 
53  public function isEmpty(): bool
54  {
55  return true;
56  }
57 
58 
62  public function setActiveStatus(bool $status): void
63  {
64  $this->active_status = $status;
65  }
66 
67 
71  public function setParent(string $parent): void
72  {
73  $this->parent_identification = $parent;
74  }
75 
76 
77  public function create(): void
78  {
79  $s = new ilMMCustomItemStorage();
80  $s->setIdentifier(uniqid());
81  $s->setType($this->type);
82  $s->setTopItem($this->isTopItem());
83  $s->setAction($this->action);
84  $s->setDefaultTitle($this->default_title);
85  $s->create();
86 
87  $this->custom_item_storage = $s;
88 
89  global $DIC;
90  $provider = new CustomMainBarProvider($DIC);
91  $this->raw_item = $provider->getSingleCustomItem($s);
92  if ($this->parent_identification && $this->raw_item instanceof isChild) {
93  global $DIC;
94  $this->raw_item = $this->raw_item->withParent($DIC->globalScreen()->identification()->fromSerializedIdentification($this->parent_identification));
95  }
96 
97  $this->identification = $this->raw_item->getProviderIdentification();
98 
99  $this->mm_item = new ilMMItemStorage();
100  $this->mm_item->setPosition(9999999); // always the last on the top item
101  $this->mm_item->setIdentification($this->raw_item->getProviderIdentification()->serialize());
102  $this->mm_item->setParentIdentification($this->parent_identification);
103  $this->mm_item->setActive($this->active_status);
104  if ($this->raw_item instanceof isChild) {
105  $this->mm_item->setParentIdentification($this->raw_item->getParent()->serialize());
106  }
107 
108  parent::create();
109  }
110 
111 
112  public function isAvailable(): bool
113  {
114  return false;
115  }
116 
117 
121  public function isAlwaysAvailable(): bool
122  {
123  return false;
124  }
125 
126 
130  public function getProviderNameForPresentation(): string
131  {
132  return $this->identification->getProviderNameForPresentation();
133  }
134 
135 
139  public function isDeletable(): bool
140  {
141  return true;
142  }
143 
144 
148  public function supportsRoleBasedVisibility(): bool
149  {
150  return true;
151  }
152 }
Class ilMMNullItemFacade.
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
IdentificationInterface $identification
__construct(IdentificationInterface $identification, Main $collector)
Class ilMMCustomItemFacade.
__construct(Container $dic, ilPlugin $plugin)
Interface ilMMItemFacadeInterface.