ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLPCollectionOfMediaObjects.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
5 
16 {
17  protected static $possible_items = array();
18 
19  public function getPossibleItems()
20  {
21  if (!isset(self::$possible_items[$this->obj_id])) {
22  $items = array();
23 
24  include_once "Modules/MediaCast/classes/class.ilObjMediaCast.php";
25  $cast = new ilObjMediaCast($this->obj_id, false);
26 
27  foreach ($cast->getSortedItemsArray() as $item) {
28  $items[$item["mob_id"]] = array("title" => $item["title"]);
29  }
30 
31  self::$possible_items[$this->obj_id] = $items;
32  }
33 
34  return self::$possible_items[$this->obj_id];
35  }
36 
37 
38  //
39  // TABLE GUI
40  //
41 
42  public function getTableGUIData($a_parent_ref_id)
43  {
44  $data = array();
45 
46  foreach ($this->getPossibleItems() as $mob_id => $item) {
47  $tmp = array();
48  $tmp['id'] = $mob_id;
49  $tmp['ref_id'] = 0;
50  $tmp['type'] = 'mob';
51  $tmp['title'] = $item['title'];
52  $tmp['status'] = $this->isAssignedEntry($mob_id);
53 
54  $data[] = $tmp;
55  }
56 
57  return $data;
58  }
59 
67  public function cloneCollection($a_target_id, $a_copy_id, $mob_mapping = null)
68  {
69  global $DIC;
70 
71  $target_obj_id = ilObject::_lookupObjId($a_target_id);
72  $new_collection = new static($target_obj_id, $this->mode);
73  $possible_items = $new_collection->getPossibleItems();
74  foreach ($this->items as $item_id) {
75  if (isset($mob_mapping[$item_id]) && isset($possible_items[$mob_mapping[$item_id]])) {
76  $new_collection->addEntry($mob_mapping[$item_id]);
77  }
78  }
79 
80  $DIC->logger()->root()->write(__METHOD__ . ': cloned learning progress collection.');
81  }
82 }
global $DIC
Definition: saml.php:7
Class ilObjMediaCast.
static _lookupObjId($a_id)
cloneCollection($a_target_id, $a_copy_id, $mob_mapping=null)
Scorm items are not copied, they are newly created by reading the manifest.
LP collection base class.
isAssignedEntry($a_item_id)
$data
Definition: bench.php:6