ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilMMItemStorage.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
31 {
37  public static function register(isItem $item): ilMMItemStorage
38  {
39  if ($item instanceof Lost) {
40  return new self();
41  }
42 
43  $mm_item = ilMMItemStorage::find($item->getProviderIdentification()->serialize());
44  if ($mm_item === null) {
45  $mm_item = new ilMMItemStorage();
46  $mm_item->setPosition($item->getPosition());
47  $mm_item->setIdentification($item->getProviderIdentification()->serialize());
48  $mm_item->setActive(true);
49  if ($item instanceof isChild) {
50  $mm_item->setParentIdentification($item->getParent()->serialize());
51  }
52  $mm_item->create();
53  }
54 
55  return $mm_item;
56  }
57 
58 
59 
60 
61  public function create(): void
62  {
63  if (self::find($this->getIdentification())) {
64  $this->update();
65  } else {
66  parent::create();
67  }
68  }
69 
70 
78  protected ?string $identification;
84  protected bool $active = true;
90  protected int $position = 0;
96  protected ?string $parent_identification = '';
102  protected ?string $icon_id = '';
106  protected string $connector_container_name = "il_mm_items";
107 
108 
112  public function getIdentification(): string
113  {
114  return $this->identification;
115  }
116 
117 
121  public function setIdentification(string $identification)
122  {
123  $this->identification = $identification;
124  }
125 
126 
130  public function isActive(): bool
131  {
132  return $this->active;
133  }
134 
135 
139  public function setActive(bool $active)
140  {
141  $this->active = $active;
142  }
143 
144 
148  public function getPosition(): int
149  {
150  return $this->position;
151  }
152 
153 
157  public function setPosition(int $position)
158  {
159  $this->position = $position;
160  }
161 
162 
166  public function getParentIdentification(): string
167  {
169  }
170 
171 
175  public function setParentIdentification(string $parent_identification)
176  {
177  $this->parent_identification = $parent_identification;
178  }
179 
180 
184  public function getIconId(): ?string
185  {
186  return $this->icon_id === '' ? null : $this->icon_id;
187  }
188 
189 
195  public function setIconId(string $icon_id): ilMMItemStorage
196  {
197  $this->icon_id = $icon_id;
198 
199  return $this;
200  }
201 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $parent_identification
true text 256
int $position
true integer 4
string $icon_id
true text 256
string $identification
true true true text 64
setParentIdentification(string $parent_identification)
setPosition(int $position)
setIdentification(string $identification)
setIconId(string $icon_id)
bool $active
true integer 1