ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.ilLPCollectionOfMediaObjects.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
22{
23 protected static array $possible_items = array();
24
25 public function getPossibleItems(): array
26 {
27 if (!isset(self::$possible_items[$this->obj_id])) {
28 $items = array();
29
30 $cast = new ilObjMediaCast($this->obj_id, false);
31
32 foreach ($cast->getSortedItemsArray() as $item) {
33 $items[$item["mob_id"]] = array("title" => $item["title"]);
34 }
35 self::$possible_items[$this->obj_id] = $items;
36 }
37 return self::$possible_items[$this->obj_id];
38 }
39
40 public function getTableGUIData(int $a_parent_ref_id): array
41 {
42 $data = array();
43
44 foreach ($this->getPossibleItems() as $mob_id => $item) {
45 $tmp = array();
46 $tmp['id'] = $mob_id;
47 $tmp['ref_id'] = 0;
48 $tmp['type'] = 'mob';
49 $tmp['title'] = $item['title'];
50 $tmp['status'] = $this->isAssignedEntry($mob_id);
51
52 $data[] = $tmp;
53 }
54
55 return $data;
56 }
57
64 public function cloneCollection(int $a_target_id, int $a_copy_id, ?array $mob_mapping = null): void
65 {
66 $target_obj_id = ilObject::_lookupObjId($a_target_id);
67 $new_collection = new static($target_obj_id, $this->mode);
68 $possible_items = $new_collection->getPossibleItems();
69 foreach ($this->items as $item_id) {
70 if (isset($mob_mapping[$item_id]) && isset($possible_items[$mob_mapping[$item_id]])) {
71 $new_collection->addEntry($mob_mapping[$item_id]);
72 }
73 }
74 }
75}
cloneCollection(int $a_target_id, int $a_copy_id, ?array $mob_mapping=null)
Scorm items are not copied, they are newly created by reading the manifest.
isAssignedEntry(int $a_item_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
$data
Definition: storeScorm.php:45