ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWebLinkDatabaseRepository Class Reference
+ Inheritance diagram for ilWebLinkDatabaseRepository:
+ Collaboration diagram for ilWebLinkDatabaseRepository:

Public Member Functions

 __construct (int $webr_id)
 
 createItem (ilWebLinkDraftItem $item)
 Creates a new item, complete with parameters. More...
 
 createList (ilWebLinkDraftList $list)
 
 createAllItemsInDraftContainer (ilWebLinkDraftItemsContainer $container)
 
 getAllItemsAsContainer (bool $only_active=false)
 
 getItemByLinkId (int $link_id)
 
 doesOnlyOneItemExist (bool $only_active=false)
 
 getParameterinItemByParamId (ilWebLinkItem $item, int $param_id)
 
 getList ()
 
 doesListExist ()
 
 updateItem (ilWebLinkItem $item, ilWebLinkDraftItem $drafted_item)
 Updates an item. More...
 
 updateList (ilWebLinkList $list, ilWebLinkDraftList $drafted_list)
 
 deleteAllItems ()
 
 deleteItemByLinkID (int $link_id)
 
 deleteParameterByLinkIdAndParamId (int $link_id, int $param_id)
 
 deleteList ()
 
 getWebrId ()
 
 createItem (ilWebLinkDraftItem $item)
 Creates a new item, complete with parameters. More...
 
 createList (ilWebLinkDraftList $list)
 
 createAllItemsInDraftContainer (ilWebLinkDraftItemsContainer $container)
 
 getAllItemsAsContainer (bool $only_active=false)
 
 getItemByLinkId (int $link_id)
 
 doesOnlyOneItemExist (bool $only_active=false)
 
 getParameterinItemByParamId (ilWebLinkItem $item, int $param_id)
 
 getList ()
 
 doesListExist ()
 
 updateItem (ilWebLinkItem $item, ilWebLinkDraftItem $drafted_item)
 Updates an item. More...
 
 updateList (ilWebLinkList $list, ilWebLinkDraftList $drafted_list)
 
 deleteAllItems ()
 
 deleteItemByLinkID (int $link_id)
 
 deleteParameterByLinkIdAndParamId (int $link_id, int $param_id)
 
 deleteList ()
 

Data Fields

const string ITEMS_TABLE = 'webr_items'
 
const string LISTS_TABLE = 'webr_lists'
 
const string PARAMS_TABLE = 'webr_params'
 

Protected Member Functions

 getParametersByLinkId (int $link_id)
 
 validateParameter (ilWebLinkBaseParameter $parameter)
 
 validateInternalItemTarget (ilWebLinkDraftItem $item)
 
 isInternalLink (string $value)
 
 getCurrentTime ()
 
 getNewDateTimeImmutable ()
 

Protected Attributes

int $webr_id
 
ilDBInterface $db
 
ilObjUser $user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebLinkDatabaseRepository::__construct ( int  $webr_id)

Definition at line 34 of file class.ilWebLinkDatabaseRepository.php.

35 {
36 global $DIC;
37
38 $this->db = $DIC->database();
39 $this->user = $DIC->user();
40 $this->webr_id = $webr_id;
41 }
global $DIC
Definition: shib_login.php:26

References $DIC, $webr_id, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ createAllItemsInDraftContainer()

ilWebLinkDatabaseRepository::createAllItemsInDraftContainer ( ilWebLinkDraftItemsContainer  $container)

Implements ilWebLinkRepository.

Definition at line 149 of file class.ilWebLinkDatabaseRepository.php.

150 {
151 $new_items = [];
152
153 foreach ($container->getItems() as $item) {
154 $new_items[] = $this->createItem($item);
155 }
156
157 return new ilWebLinkItemsContainer(
158 $this->getWebrId(),
159 $new_items
160 );
161 }
createItem(ilWebLinkDraftItem $item)
Creates a new item, complete with parameters.
Immutable container class for Web Link items.
$container
@noRector
Definition: wac.php:37

References $container, createItem(), and getWebrId().

+ Here is the call graph for this function:

◆ createItem()

ilWebLinkDatabaseRepository::createItem ( ilWebLinkDraftItem  $item)

Creates a new item, complete with parameters.

New parameters cannot be created on their own, but only by adding them as drafts to a drafted item, and then updating or creating with it.

Implements ilWebLinkRepository.

Definition at line 43 of file class.ilWebLinkDatabaseRepository.php.

44 {
45 $next_link_id = $this->db->nextId(self::ITEMS_TABLE);
46
47 $this->validateInternalItemTarget($item);
48
49 //create the parameters
50 $new_parameters = [];
51 foreach ($item->getParameters() as $parameter) {
52 $next_param_id = $this->db->nextId(self::PARAMS_TABLE);
53
54 try {
55 $this->validateParameter($parameter);
56 } catch (Exception $e) {
57 continue;
58 }
59
60
61 $new_parameter = new ilWebLinkParameter(
62 $this->user,
63 $this->getWebrId(),
64 $next_link_id,
65 $next_param_id,
66 $parameter->getValue(),
67 $parameter->getName()
68 );
69
70 $this->db->insert(
71 self::PARAMS_TABLE,
72 [
73 'webr_id' => ['integer', $new_parameter->getWebrId()],
74 'link_id' => ['integer', $new_parameter->getLinkId()],
75 'param_id' => ['integer', $new_parameter->getParamId()],
76 'name' => ['text', $new_parameter->getName()],
77 'value' => ['integer', $new_parameter->getValue()]
78 ]
79 );
80
81 $new_parameters[] = $new_parameter;
82 }
83
84 //create the item with the new parameters
85 if ($item->isInternal()) {
86 $class = ilWebLinkItemInternal::class;
87 } else {
88 $class = ilWebLinkItemExternal::class;
89 }
90
91 $new_item = new $class(
92 $this->getWebrId(),
93 $next_link_id,
94 $item->getTitle(),
95 $item->getDescription(),
96 $item->getTarget(),
97 $item->isActive(),
98 $this->getNewDateTimeImmutable(),
99 $this->getNewDateTimeImmutable(),
100 $new_parameters
101 );
102
103 $this->db->insert(
104 self::ITEMS_TABLE,
105 [
106 'internal' => ['integer', (int) $new_item->isInternal()],
107 'webr_id' => ['integer', $new_item->getWebrId()],
108 'link_id' => ['integer', $new_item->getLinkId()],
109 'title' => ['text', $new_item->getTitle()],
110 'description' => ['text', $new_item->getDescription() ?? ''],
111 'target' => ['text', $new_item->getTarget()],
112 'active' => ['integer', (int) $new_item->isActive()],
113 'create_date' => ['integer', $new_item->getCreateDate()
114 ->getTimestamp()],
115 'last_update' => ['integer', $new_item->getLastUpdate()
116 ->getTimestamp()]
117 ]
118 );
119
120 return $new_item;
121 }
validateInternalItemTarget(ilWebLinkDraftItem $item)
validateParameter(ilWebLinkBaseParameter $parameter)
Immutable class for Web Link items.
Immutable class for parameters attached to Web Link items.

References Vendor\Package\$e, ilWebLinkBaseItem\getDescription(), ilWebLinkBaseItem\getParameters(), ilWebLinkBaseItem\getTarget(), ilWebLinkBaseItem\getTitle(), getWebrId(), ilWebLinkBaseItem\isActive(), ilWebLinkDraftItem\isInternal(), ILIAS\Repository\user(), validateInternalItemTarget(), and validateParameter().

Referenced by createAllItemsInDraftContainer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createList()

ilWebLinkDatabaseRepository::createList ( ilWebLinkDraftList  $list)

Implements ilWebLinkRepository.

Definition at line 123 of file class.ilWebLinkDatabaseRepository.php.

124 {
125 $new_list = new ilWebLinkList(
126 $this->getWebrId(),
127 $list->getTitle(),
128 $list->getDescription(),
129 $this->getNewDateTimeImmutable(),
130 $this->getNewDateTimeImmutable(),
131 );
132
133 $this->db->insert(
134 self::LISTS_TABLE,
135 [
136 'webr_id' => ['integer', $new_list->getWebrId()],
137 'title' => ['text', $new_list->getTitle()],
138 'description' => ['text', $new_list->getDescription() ?? ''],
139 'create_date' => ['integer', $new_list->getCreateDate()
140 ->getTimestamp()],
141 'last_update' => ['integer', $new_list->getLastUpdate()
142 ->getTimestamp()],
143 ]
144 );
145
146 return $new_list;
147 }

References ilWebLinkBaseList\getDescription(), ilWebLinkBaseList\getTitle(), and getWebrId().

+ Here is the call graph for this function:

◆ deleteAllItems()

ilWebLinkDatabaseRepository::deleteAllItems ( )

Implements ilWebLinkRepository.

Definition at line 435 of file class.ilWebLinkDatabaseRepository.php.

435 : void
436 {
437 $this->db->manipulate(
438 "DELETE FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . " " .
439 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer')
440 );
441
442 $this->db->manipulate(
443 "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . " " .
444 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer')
445 );
446 }

◆ deleteItemByLinkID()

ilWebLinkDatabaseRepository::deleteItemByLinkID ( int  $link_id)

Implements ilWebLinkRepository.

Definition at line 448 of file class.ilWebLinkDatabaseRepository.php.

448 : void
449 {
450 $this->db->manipulate(
451 "DELETE FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . " " .
452 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
453 "AND link_id = " . $this->db->quote($link_id, 'integer')
454 );
455
456 $this->db->manipulate(
457 "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . " " .
458 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
459 "AND link_id = " . $this->db->quote($link_id, 'integer')
460 );
461 }

◆ deleteList()

ilWebLinkDatabaseRepository::deleteList ( )

Implements ilWebLinkRepository.

Definition at line 475 of file class.ilWebLinkDatabaseRepository.php.

475 : void
476 {
477 $res = $this->db->manipulate(
478 "DELETE FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . " " .
479 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer')
480 );
481 }
$res
Definition: ltiservices.php:69

References $res.

◆ deleteParameterByLinkIdAndParamId()

ilWebLinkDatabaseRepository::deleteParameterByLinkIdAndParamId ( int  $link_id,
int  $param_id 
)

Implements ilWebLinkRepository.

Definition at line 463 of file class.ilWebLinkDatabaseRepository.php.

466 : void {
467 $this->db->manipulate(
468 "DELETE FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . " " .
469 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
470 "AND link_id = " . $this->db->quote($link_id, 'integer') . " " .
471 "AND param_id = " . $this->db->quote($param_id, 'integer')
472 );
473 }

◆ doesListExist()

ilWebLinkDatabaseRepository::doesListExist ( )

Implements ilWebLinkRepository.

Definition at line 302 of file class.ilWebLinkDatabaseRepository.php.

302 : bool
303 {
304 $res = $this->db->query(
305 "SELECT COUNT(*) AS num FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . " " .
306 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer')
307 );
308
309 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
310
311 return ((int) $row->num) > 0;
312 }

References $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ doesOnlyOneItemExist()

ilWebLinkDatabaseRepository::doesOnlyOneItemExist ( bool  $only_active = false)

Implements ilWebLinkRepository.

Definition at line 238 of file class.ilWebLinkDatabaseRepository.php.

238 : bool
239 {
240 $query = "SELECT COUNT(*) AS num FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . " " .
241 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer');
242
243 if ($only_active) {
244 $query .= " AND active = " . $this->db->quote(1, 'integer');
245 }
246
247 $row = $this->db->query($query)
249
250 return $row->num == 1;
251 }

References ilDBConstants\FETCHMODE_OBJECT, and getWebrId().

+ Here is the call graph for this function:

◆ getAllItemsAsContainer()

ilWebLinkDatabaseRepository::getAllItemsAsContainer ( bool  $only_active = false)

Implements ilWebLinkRepository.

Definition at line 163 of file class.ilWebLinkDatabaseRepository.php.

164 {
165 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . " " .
166 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer');
167
168 if ($only_active) {
169 $query .= " AND active = " . $this->db->quote(1, 'integer');
170 }
171
172 $res = $this->db->query($query);
173 $items = [];
174
175 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
176 $parameters = $this->getParametersByLinkId((int) $row->link_id);
177
178 if ($row->internal) {
179 $class = ilWebLinkItemInternal::class;
180 } else {
181 $class = ilWebLinkItemExternal::class;
182 }
183
184 $items[] = new $class(
185 (int) $row->webr_id,
186 (int) $row->link_id,
187 (string) $row->title,
188 ((string) $row->description) !== '' ? (string) $row->description : null,
189 (string) $row->target,
190 (bool) $row->active,
191 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->create_date),
192 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->last_update),
193 $parameters
194 );
195 }
196
197 return new ilWebLinkItemsContainer(
198 $this->getWebrId(),
199 $items
200 );
201 }

References $res, ilDBConstants\FETCHMODE_OBJECT, getParametersByLinkId(), and getWebrId().

+ Here is the call graph for this function:

◆ getCurrentTime()

ilWebLinkDatabaseRepository::getCurrentTime ( )
protected

Definition at line 555 of file class.ilWebLinkDatabaseRepository.php.

555 : int
556 {
557 return time();
558 }

◆ getItemByLinkId()

ilWebLinkDatabaseRepository::getItemByLinkId ( int  $link_id)

Implements ilWebLinkRepository.

Definition at line 203 of file class.ilWebLinkDatabaseRepository.php.

204 {
205 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::ITEMS_TABLE) . " " .
206 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
207 "AND link_id = " . $this->db->quote($link_id, 'integer');
208
209 $res = $this->db->query($query);
210
211 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
212 $parameters = $this->getParametersByLinkId((int) $row->link_id);
213
214 if ($row->internal) {
215 $class = ilWebLinkItemInternal::class;
216 } else {
217 $class = ilWebLinkItemExternal::class;
218 }
219
220 return new $class(
221 (int) $row->webr_id,
222 (int) $row->link_id,
223 (string) $row->title,
224 ((string) $row->description) !== '' ? (string) $row->description : null,
225 (string) $row->target,
226 (bool) $row->active,
227 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->create_date),
228 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->last_update),
229 $parameters
230 );
231 }
232
234 'No item with the given link_id was found in this web link object.'
235 );
236 }

References $res, ilDBConstants\FETCHMODE_OBJECT, getParametersByLinkId(), and getWebrId().

+ Here is the call graph for this function:

◆ getList()

ilWebLinkDatabaseRepository::getList ( )

Implements ilWebLinkRepository.

Definition at line 280 of file class.ilWebLinkDatabaseRepository.php.

281 {
282 $res = $this->db->query(
283 "SELECT * FROM " . $this->db->quoteIdentifier(self::LISTS_TABLE) . " " .
284 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer')
285 );
286
287 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
288 return new ilWebLinkList(
289 (int) $row->webr_id,
290 (string) $row->title,
291 ((string) $row->description) !== '' ? (string) $row->description : null,
292 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->create_date),
293 $this->getNewDateTimeImmutable()->setTimestamp((int) $row->last_update),
294 );
295 }
296
298 'No list exists in this web link object.'
299 );
300 }

References $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ getNewDateTimeImmutable()

ilWebLinkDatabaseRepository::getNewDateTimeImmutable ( )
protected

Definition at line 560 of file class.ilWebLinkDatabaseRepository.php.

560 : DateTimeImmutable
561 {
562 return new DateTimeImmutable();
563 }

◆ getParameterinItemByParamId()

ilWebLinkDatabaseRepository::getParameterinItemByParamId ( ilWebLinkItem  $item,
int  $param_id 
)

Implements ilWebLinkRepository.

Definition at line 253 of file class.ilWebLinkDatabaseRepository.php.

257 $res = $this->db->query(
258 "SELECT * FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . " " .
259 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
260 "AND link_id = " . $this->db->quote($item->getLinkId(), 'integer') . " " .
261 "AND param_id = " . $this->db->quote($param_id, 'integer')
262 );
263
264 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
265 return new ilWebLinkParameter(
266 $this->user,
267 (int) $row->webr_id,
268 (int) $row->link_id,
269 (int) $row->param_id,
270 (int) $row->value,
271 (string) $row->name
272 );
273 }
274
276 'In the given item of this web link object, no parameter with the given param_id was found.'
277 );
278 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getParametersByLinkId()

ilWebLinkDatabaseRepository::getParametersByLinkId ( int  $link_id)
protected
Returns
ilWebLinkParameter[]

Definition at line 486 of file class.ilWebLinkDatabaseRepository.php.

486 : array
487 {
488 $res = $this->db->query(
489 "SELECT * FROM " . $this->db->quoteIdentifier(self::PARAMS_TABLE) . " " .
490 "WHERE webr_id = " . $this->db->quote($this->getWebrId(), 'integer') . " " .
491 "AND link_id = " . $this->db->quote($link_id, 'integer')
492 );
493 $parameters = [];
494
495 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
496 $parameter = new ilWebLinkParameter(
497 $this->user,
498 (int) $row->webr_id,
499 (int) $row->link_id,
500 (int) $row->param_id,
501 (int) $row->value,
502 (string) $row->name
503 );
504 try {
505 $this->validateParameter($parameter);
506 } catch (Exception $e) {
507 continue;
508 }
509 $parameters[] = $parameter;
510 }
511
512 return $parameters;
513 }

References Vendor\Package\$e, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\user().

Referenced by getAllItemsAsContainer(), and getItemByLinkId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWebrId()

ilWebLinkDatabaseRepository::getWebrId ( )

Definition at line 550 of file class.ilWebLinkDatabaseRepository.php.

550 : int
551 {
552 return $this->webr_id;
553 }

Referenced by createAllItemsInDraftContainer(), createItem(), createList(), doesOnlyOneItemExist(), getAllItemsAsContainer(), and getItemByLinkId().

+ Here is the caller graph for this function:

◆ isInternalLink()

ilWebLinkDatabaseRepository::isInternalLink ( string  $value)
protected

Definition at line 545 of file class.ilWebLinkDatabaseRepository.php.

545 : bool
546 {
547 return ilLinkInputGUI::isInternalLink($value);
548 }
static isInternalLink(string $a_value)

References ilLinkInputGUI\isInternalLink().

+ Here is the call graph for this function:

◆ updateItem()

ilWebLinkDatabaseRepository::updateItem ( ilWebLinkItem  $item,
ilWebLinkDraftItem  $drafted_item 
)

Updates an item.

New parameters added as drafts update the parameter they replace, or else are created fresh. Current parameters of the item not added to the draft are deleted.

Implements ilWebLinkRepository.

Definition at line 314 of file class.ilWebLinkDatabaseRepository.php.

317 : void {
318 if ($item->getWebrId() !== $this->getWebrId()) {
320 'Cannot update an item from a different web link object.'
321 );
322 }
323
324 $this->validateInternalItemTarget($drafted_item);
325
326 $this->db->update(
327 self::ITEMS_TABLE,
328 [
329 'title' => ['text', $drafted_item->getTitle()],
330 'description' => ['text', $drafted_item->getDescription() ?? ''],
331 'target' => ['text', $drafted_item->getTarget()],
332 'active' => ['integer', (int) $drafted_item->isActive()],
333 'internal' => ['integer', (int) $drafted_item->isInternal()],
334 'last_update' => ['integer', $this->getCurrentTime()]
335 ],
336 [
337 'webr_id' => ['integer', $item->getWebrId()],
338 'link_id' => ['integer', $item->getLinkId()]
339 ]
340 );
341
342 /*
343 * drafted parameters of the drafted item are either created or
344 * update an existing parameter
345 */
346 $param_ids = [];
347 foreach ($drafted_item->getParameters() as $parameter) {
348 if ($parameter instanceof ilWebLinkParameter) {
349 $param_ids[] = $parameter->getParamId();
350 continue;
351 }
352
353 try {
354 $this->validateParameter($parameter);
355 } catch (Exception $e) {
356 continue;
357 }
358
359 if ($old_parameter = $parameter->getOldParameter()) {
360 if (
361 $old_parameter->getLinkId() !== $item->getLinkId() ||
362 $old_parameter->getWebrId() !== $item->getWebrId()
363 ) {
365 'Cannot update a parameter from a different item.'
366 );
367 }
368
369 $this->db->update(
370 self::PARAMS_TABLE,
371 [
372 'name' => ['text', $drafted_item->getTitle()],
373 'value' => ['integer', $drafted_item->getTitle()]
374 ],
375 [
376 'webr_id' => ['integer', $item->getWebrId()],
377 'link_id' => ['integer', $item->getLinkId()],
378 'param_id' => ['integer', $parameter->getOldParameter()
379 ->getParamId()],
380 ]
381 );
382 continue;
383 }
384
385 $next_param_id = $this->db->nextId(self::PARAMS_TABLE);
386 $this->db->insert(
387 self::PARAMS_TABLE,
388 [
389 'webr_id' => ['integer', $this->getWebrId()],
390 'link_id' => ['integer', $item->getLinkId()],
391 'param_id' => ['integer', $next_param_id],
392 'name' => ['text', $parameter->getName()],
393 'value' => ['integer', $parameter->getValue()]
394 ]
395 );
396 }
397
398 /*
399 * parameters attached to the original item but not the drafted item
400 * are deleted
401 */
402 foreach ($item->getParameters() as $parameter) {
403 if (!in_array($parameter->getParamId(), $param_ids)) {
405 $item->getLinkId(),
406 $parameter->getParamId()
407 );
408 }
409 }
410 }
deleteParameterByLinkIdAndParamId(int $link_id, int $param_id)

◆ updateList()

ilWebLinkDatabaseRepository::updateList ( ilWebLinkList  $list,
ilWebLinkDraftList  $drafted_list 
)

Implements ilWebLinkRepository.

Definition at line 412 of file class.ilWebLinkDatabaseRepository.php.

415 : void {
416 if ($list->getWebrId() !== $this->getWebrId()) {
418 'Cannot update a list from a different web link object.'
419 );
420 }
421
422 $this->db->update(
423 self::LISTS_TABLE,
424 [
425 'title' => ['text', $drafted_list->getTitle()],
426 'description' => ['text', $drafted_list->getDescription() ?? ''],
427 'last_update' => ['integer', $this->getCurrentTime()]
428 ],
429 [
430 'webr_id' => ['integer', $list->getWebrId()]
431 ]
432 );
433 }

◆ validateInternalItemTarget()

ilWebLinkDatabaseRepository::validateInternalItemTarget ( ilWebLinkDraftItem  $item)
protected
Exceptions
ilWebLinkDatabaseRepositoryException

Definition at line 533 of file class.ilWebLinkDatabaseRepository.php.

533 : void
534 {
535 if (
536 $item->isInternal() &&
537 !$this->isInternalLink($item->getTarget())
538 ) {
540 'The target of this internal link item is not internal.'
541 );
542 }
543 }

References ilWebLinkBaseItem\getTarget(), and ilWebLinkDraftItem\isInternal().

Referenced by createItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateParameter()

ilWebLinkDatabaseRepository::validateParameter ( ilWebLinkBaseParameter  $parameter)
protected
Exceptions
ilWebLinkDatabaseRepositoryException

Definition at line 518 of file class.ilWebLinkDatabaseRepository.php.

518 : void
519 {
520 if (!in_array(
521 $parameter->getValue(),
523 )) {
525 'The value of the parameter you are trying to create is invalid.'
526 );
527 }
528 }
const array VALUES
TODO Once the GUI is updated, undefined can be dropped.

References ilWebLinkBaseParameter\getValue(), and ilWebLinkBaseParameter\VALUES.

Referenced by createItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilWebLinkDatabaseRepository::$db
protected

Definition at line 31 of file class.ilWebLinkDatabaseRepository.php.

◆ $user

ilObjUser ilWebLinkDatabaseRepository::$user
protected

Definition at line 32 of file class.ilWebLinkDatabaseRepository.php.

◆ $webr_id

int ilWebLinkDatabaseRepository::$webr_id
protected

Definition at line 30 of file class.ilWebLinkDatabaseRepository.php.

Referenced by __construct().

◆ ITEMS_TABLE

◆ LISTS_TABLE

const string ilWebLinkDatabaseRepository::LISTS_TABLE = 'webr_lists'

◆ PARAMS_TABLE

const string ilWebLinkDatabaseRepository::PARAMS_TABLE = 'webr_params'

The documentation for this class was generated from the following file: