ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMMCustomItemFacade.php
Go to the documentation of this file.
1 <?php
2 
5 
12 {
13 
21  protected $action = '';
25  protected $type = '';
29  protected $top_item = false;
30 
31 
36  {
37  parent::__construct($identification, $collector);
38  $this->custom_item_storage = $this->getCustomStorage();
39  if ($this->custom_item_storage instanceof ilMMCustomItemStorage) {
40  if ($this->custom_item_storage->getType()) {
41  $this->type = $this->custom_item_storage->getType();
42  }
43  }
44  }
45 
46 
50  public function update()
51  {
52  if ($this->isCustom()) {
53  $mm = $this->getCustomStorage();
54  if ($mm instanceof ilMMCustomItemStorage) {
55  $default_title = ilMMItemTranslationStorage::getDefaultTranslation($this->identification());
56  $mm->setDefaultTitle($default_title);
57  $mm->setType($this->getType());
58  $mm->update();
59  }
60  }
62  }
63 
64 
68  public function delete()
69  {
70  if (!$this->isDeletable()) {
71  throw new LogicException("Non Custom items can't be deleted");
72  }
73 
74  $cm = $this->getCustomStorage();
75  if ($cm instanceof ilMMCustomItemStorage) {
76  $cm->delete();
77  }
78  parent::delete();
79  }
80 
81 
85  private function getCustomStorage()
86  {
87  $id = $this->gs_item->getProviderIdentification()->getInternalIdentifier();
89 
90  return $mm;
91  }
92 
93 
97  public function isCustom() : bool
98  {
99  return true;
100  }
101 
102 
106  public function isEditable() : bool
107  {
108  return true;
109  }
110 
111 
115  public function isDeletable() : bool
116  {
117  return true;
118  }
119 
120 
124  public function getProviderNameForPresentation() : string
125  {
126  return "Custom";
127  }
128 
129 
133  public function getStatus() : string
134  {
135  return "";
136  }
137 
138 
142  public function setAction(string $action)
143  {
144  $this->action = $action;
145  }
146 
147 
151  public function getType() : string
152  {
153  return $this->type;
154  }
155 
156 
160  public function setType(string $type)
161  {
162  $this->type = $type;
163  }
164 
165 
169  public function isTopItem() : bool
170  {
171  if ($this->gs_item instanceof \ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem) {
172  return parent::isTopItem();
173  }
174 
175  return $this->top_item;
176  }
177 
178 
182  public function setIsTopItm(bool $top_item)
183  {
184  $this->top_item = $top_item;
185  }
186 }
Class ilMMAbstractItemFacade.
static find($primary_key, array $add_constructor_args=array())
Class ilMMCustomItemStorage.
Class BaseForm.
if(!array_key_exists('StateId', $_REQUEST)) $id
__construct(IdentificationInterface $identification, Main $collector)
Class ilMMCustomItemFacade.
update($pash, $contents, Config $config)