ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLPCollectionOfSCOs Class Reference

LP collection of SCOs. More...

+ Inheritance diagram for ilLPCollectionOfSCOs:
+ Collaboration diagram for ilLPCollectionOfSCOs:

Public Member Functions

 getPossibleItems ()
 
 getTableGUIData (int $a_parent_ref_id)
 
 getScoresForUserAndCP_Node_Id (int $item_id, int $user_id)
 
 cloneCollection (int $a_target_id, int $a_copy_id)
 Scorm items are not copied, they are newly created by reading the manifest. More...
 
- Public Member Functions inherited from ilLPCollection
 __construct (int $a_obj_id, int $a_mode)
 
 hasSelectableItems ()
 
 cloneCollection (int $a_target_id, int $a_copy_id)
 
 getItems ()
 
 delete ()
 
 isAssignedEntry (int $a_item_id)
 
 deactivateEntries (array $a_item_ids)
 
 activateEntries (array $a_item_ids)
 

Protected Member Functions

 itemsAreEqual (int $item_a_id, int $item_b_id)
 
- Protected Member Functions inherited from ilLPCollection
 read (int $a_obj_id)
 
 validateEntry (int $a_item_id)
 
 addEntry (int $a_item_id)
 
 deleteEntry (int $a_item_id)
 

Static Protected Attributes

static array $possible_items = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLPCollection
static getInstanceByMode (int $a_obj_id, int $a_mode)
 
static getCollectionModes ()
 
- Protected Attributes inherited from ilLPCollection
int $obj_id
 
int $mode
 
array $items = []
 
ilDBInterface $db
 
ilLogger $logger
 

Detailed Description

LP collection of SCOs.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 12 of file class.ilLPCollectionOfSCOs.php.

Member Function Documentation

◆ cloneCollection()

ilLPCollectionOfSCOs::cloneCollection ( int  $a_target_id,
int  $a_copy_id 
)

Scorm items are not copied, they are newly created by reading the manifest.

Therefore, they do not have a mapping. So we need to map them via the import_id/identifierref

Parameters
int$a_target_id
int$a_copy_id

Definition at line 112 of file class.ilLPCollectionOfSCOs.php.

References ilLPCollection\$mode, ilObject\_lookupObjId(), and itemsAreEqual().

112  : void
113  {
114  $target_obj_id = ilObject::_lookupObjId($a_target_id);
115  $new_collection = new static($target_obj_id, $this->mode);
116  $possible_items = $new_collection->getPossibleItems();
117  foreach ($this->items as $item_id) {
118  foreach ($possible_items as $pos_item_id => $pos_item) {
119  if ($this->itemsAreEqual($item_id, $pos_item_id)) {
120  $new_collection->addEntry($pos_item_id);
121  }
122  }
123  }
124  }
itemsAreEqual(int $item_a_id, int $item_b_id)
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:

◆ getPossibleItems()

ilLPCollectionOfSCOs::getPossibleItems ( )

Definition at line 16 of file class.ilLPCollectionOfSCOs.php.

References ilLPCollection\$items, ilLPCollection\$obj_id, ilObjSCORMLearningModule\_getTrackingItems(), ilObjSCORM2004LearningModule\_getTrackingItems(), and ilObjSAHSLearningModule\_lookupSubType().

Referenced by getTableGUIData().

16  : array
17  {
18  if (!isset(self::$possible_items[$this->obj_id])) {
19  $items = array();
20 
21  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
22  case 'hacp':
23  case 'aicc':
24  foreach (ilObjAICCLearningModule::_getTrackingItems(
25  $this->obj_id
26  ) as $item) {
27  $items[$item['obj_id']]['title'] = $item['title'];
28  }
29  break;
30 
31  case 'scorm':
33  $this->obj_id
34  ) as $item) {
35  $items[$item->getId()]['title'] = $item->getTitle();
36  }
37  break;
38 
39  case 'scorm2004':
41  $this->obj_id
42  ) as $item) {
43  $items[$item['id']]['title'] = $item['title'];
44  }
45  break;
46  }
47 
48  self::$possible_items[$this->obj_id] = $items;
49  }
50 
51  return self::$possible_items[$this->obj_id];
52  }
static _getTrackingItems(int $a_obj_id)
get all tracking items of scorm object
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
static _getTrackingItems(int $a_obj_id)
get all tracking items of scorm object currently a for learning progress only
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoresForUserAndCP_Node_Id()

ilLPCollectionOfSCOs::getScoresForUserAndCP_Node_Id ( int  $item_id,
int  $user_id 
)

Definition at line 78 of file class.ilLPCollectionOfSCOs.php.

References ilObjSCORM2004LearningModule\_getScores2004ForUser(), ilObjSCORMLearningModule\_getScoresForUser(), and ilObjSAHSLearningModule\_lookupSubType().

81  : array {
82  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
83  case 'hacp':
84  case 'aicc':
85  return ilObjAICCLearningModule::_getScoresForUser(
86  $item_id,
87  $user_id
88  );
89 
90  case 'scorm':
92  $item_id,
93  $user_id
94  );
95 
96  case 'scorm2004':
98  $item_id,
99  $user_id
100  );
101  }
102 
103  return array("raw" => null, "max" => null, "scaled" => null);
104  }
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
static _getScoresForUser(int $a_item_id, int $a_user_id)
static _getScores2004ForUser(int $a_cp_node_id, int $a_user)
+ Here is the call graph for this function:

◆ getTableGUIData()

ilLPCollectionOfSCOs::getTableGUIData ( int  $a_parent_ref_id)

Definition at line 54 of file class.ilLPCollectionOfSCOs.php.

References $data, getPossibleItems(), and ilLPCollection\isAssignedEntry().

54  : array
55  {
56  $data = array();
57 
58  foreach ($this->getPossibleItems() as $sco_id => $item) {
59  $tmp = array();
60  $tmp['id'] = $sco_id;
61  $tmp['ref_id'] = 0;
62  $tmp['type'] = 'sco';
63  $tmp['title'] = $item['title'];
64  $tmp["status"] = $this->isAssignedEntry($sco_id);
65 
66  $data[] = $tmp;
67  }
68 
69  return $data;
70  }
isAssignedEntry(int $a_item_id)
+ Here is the call graph for this function:

◆ itemsAreEqual()

ilLPCollectionOfSCOs::itemsAreEqual ( int  $item_a_id,
int  $item_b_id 
)
protected

Definition at line 126 of file class.ilLPCollectionOfSCOs.php.

References $DIC, and ilObjSAHSLearningModule\_lookupSubType().

Referenced by cloneCollection().

126  : bool
127  {
128  global $DIC;
129  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
130  case 'scorm':
131  $res_a = $DIC->database()->query(
132  'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
133  )->quote(
134  $item_a_id,
135  'integer'
136  )
137  )->fetchAssoc();
138  $res_b = $DIC->database()->query(
139  'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
140  )->quote(
141  $item_b_id,
142  'integer'
143  )
144  )->fetchAssoc();
145  return (
146  $res_a
147  && $res_b
148  && ($res_a['import_id'] == $res_b['import_id'])
149  && ($res_a['identifierref'] == $res_b['identifierref'])
150  );
151  case 'scorm2004':
152  $res_a = $DIC->database()->query(
153  'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
154  )->quote(
155  $item_a_id,
156  'integer'
157  )
158  )->fetchAssoc();
159  $res_b = $DIC->database()->query(
160  'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
161  )->quote(
162  $item_b_id,
163  'integer'
164  )
165  )->fetchAssoc();
166  return (
167  $res_a
168  && $res_b
169  && ($res_a['id'] == $res_b['id'])
170  && ($res_a['resourceid'] == $res_b['resourceid'])
171  );
172  default:
173  return false;
174  }
175  }
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $possible_items

array ilLPCollectionOfSCOs::$possible_items = array()
staticprotected

Definition at line 14 of file class.ilLPCollectionOfSCOs.php.


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