ILIAS  release_8 Revision v8.24
class.ilMMItemStorage.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
8
9/******************************************************************************
10 *
11 * This file is part of ILIAS, a powerful learning management system.
12 *
13 * ILIAS is licensed with the GPL-3.0, you should have received a copy
14 * of said license along with the source code.
15 *
16 * If this is not the case or you just want to try ILIAS, you'll find
17 * us at:
18 * https://www.ilias.de
19 * https://github.com/ILIAS-eLearning
20 *
21 *****************************************************************************/
28{
34 public static function register(isItem $item): ilMMItemStorage
35 {
36 if ($item instanceof Lost) {
37 return new self();
38 }
39
40 $mm_item = ilMMItemStorage::find($item->getProviderIdentification()->serialize());
41 if ($mm_item === null) {
42 $mm_item = new ilMMItemStorage();
43 $mm_item->setPosition($item->getPosition());
44 $mm_item->setIdentification($item->getProviderIdentification()->serialize());
45 $mm_item->setActive(true);
46 if ($item instanceof isChild) {
47 $mm_item->setParentIdentification($item->getParent()->serialize());
48 }
49 $mm_item->create();
50 }
51
52 return $mm_item;
53 }
54
55
56
57
58 public function create(): void
59 {
60 if (self::find($this->getIdentification())) {
61 $this->update();
62 } else {
63 parent::create();
64 }
65 }
66
67
71 public function getCache(): ilGlobalCache
72 {
74 }
75
76
84 protected ?string $identification;
90 protected bool $active = true;
96 protected int $position = 0;
102 protected ?string $parent_identification = '';
108 protected ?string $icon_id = '';
112 protected string $connector_container_name = "il_mm_items";
113
114
118 public function getIdentification(): string
119 {
121 }
122
123
127 public function setIdentification(string $identification)
128 {
129 $this->identification = $identification;
130 }
131
132
136 public function isActive(): bool
137 {
138 return $this->active;
139 }
140
141
145 public function setActive(bool $active)
146 {
147 $this->active = $active;
148 }
149
150
154 public function getPosition(): int
155 {
156 return $this->position;
157 }
158
159
163 public function setPosition(int $position)
164 {
165 $this->position = $position;
166 }
167
168
172 public function getParentIdentification(): string
173 {
175 }
176
177
182 {
183 $this->parent_identification = $parent_identification;
184 }
185
186
190 public function getIconId(): ?string
191 {
192 return $this->icon_id === '' ? null : $this->icon_id;
193 }
194
195
201 public function setIconId(string $icon_id): ilMMItemStorage
202 {
203 $this->icon_id = $icon_id;
204
205 return $this;
206 }
207}
Class CachedActiveRecord.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(?string $component)
Class ilMMItemStorage.
setPosition(int $position)
string $parent_identification
@con_has_field true @con_fieldtype text @con_length 256
string $identification
@con_is_primary true @con_is_unique true @con_has_field true @con_fieldtype text @con_length 64
bool $active
@con_has_field true @con_fieldtype integer @con_length 1
setIconId(string $icon_id)
int $position
@con_has_field true @con_fieldtype integer @con_length 4
setParentIdentification(string $parent_identification)
string $icon_id
@con_has_field true @con_fieldtype text @con_length 256
setIdentification(string $identification)