ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPCollectionOfSCOs Class Reference

LP collection of SCOs. More...

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

Public Member Functions

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

Protected Member Functions

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

Static Protected Attributes

static $possible_items = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLPCollection
static getInstanceByMode ($a_obj_id, $a_mode)
 
static getCollectionModes ()
 
- Protected Attributes inherited from ilLPCollection
 $obj_id
 
 $mode
 
 $items
 

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
Version
Id
class.ilLPCollections.php 40326 2013-03-05 11:39:24Z jluetzen

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

Member Function Documentation

◆ cloneCollection()

ilLPCollectionOfSCOs::cloneCollection (   $a_target_id,
  $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
$a_target_id
$a_copy_id

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

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

118  {
119  global $DIC;
120 
121  $target_obj_id = ilObject::_lookupObjId($a_target_id);
122  $new_collection = new static($target_obj_id, $this->mode);
123  $possible_items = $new_collection->getPossibleItems();
124  foreach ($this->items as $item_id) {
125  foreach ($possible_items as $pos_item_id => $pos_item) {
126  if ($this->itemsAreEqual($item_id, $pos_item_id)) {
127  $new_collection->addEntry($pos_item_id);
128  }
129  }
130  }
131 
132  $DIC->logger()->root()->write(__METHOD__ . ': cloned learning progress collection.');
133  }
global $DIC
Definition: saml.php:7
itemsAreEqual($item_a_id, $item_b_id)
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ getPossibleItems()

ilLPCollectionOfSCOs::getPossibleItems ( )

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

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

Referenced by getTableGUIData().

22  {
23  if (!isset(self::$possible_items[$this->obj_id])) {
24  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
25 
26  $items = array();
27 
28  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
29  case 'hacp':
30  case 'aicc':
31  include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
32  foreach (ilObjAICCLearningModule::_getTrackingItems($this->obj_id) as $item) {
33  $items[$item['obj_id']]['title'] = $item['title'];
34  }
35  break;
36 
37  case 'scorm':
38  include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
39  include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
40  foreach (ilObjSCORMLearningModule::_getTrackingItems($this->obj_id) as $item) {
41  $items[$item->getId()]['title'] = $item->getTitle();
42  }
43  break;
44 
45  case 'scorm2004':
46  include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
47  foreach (ilObjSCORM2004LearningModule::_getTrackingItems($this->obj_id) as $item) {
48  $items[$item['id']]['title'] = $item['title'];
49  }
50  break;
51  }
52 
53  self::$possible_items[$this->obj_id] = $items;
54  }
55 
56  return self::$possible_items[$this->obj_id];
57  }
static _getTrackingItems($a_obj_id)
get all tracking items of scorm object
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
Create styles array
The data for the language used.
static _getTrackingItems($a_obj_id)
get all tracking items of scorm object static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScoresForUserAndCP_Node_Id()

ilLPCollectionOfSCOs::getScoresForUserAndCP_Node_Id (   $item_id,
  $user_id 
)

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

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

89  {
90  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
91  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
92  case 'hacp':
93  case 'aicc':
94  include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
95  return ilObjAICCLearningModule::_getScoresForUser($item_id, $user_id);
96 
97  case 'scorm':
98  include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
99  //include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
100  return ilObjSCORMLearningModule::_getScoresForUser($item_id, $user_id);
101 
102  case 'scorm2004':
103  include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
104  return ilObjSCORM2004LearningModule::_getScores2004ForUser($item_id, $user_id);
105  }
106 
107  return array("raw" => null, "max" => null, "scaled" => null);
108  }
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _getScores2004ForUser($a_cp_node_id, $a_user)
Create styles array
The data for the language used.
static _getScoresForUser($a_item_id, $a_user_id)
+ Here is the call graph for this function:

◆ getTableGUIData()

ilLPCollectionOfSCOs::getTableGUIData (   $a_parent_ref_id)

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

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

65  {
66  $data = array();
67 
68  foreach ($this->getPossibleItems() as $sco_id => $item) {
69  $tmp = array();
70  $tmp['id'] = $sco_id;
71  $tmp['ref_id'] = 0;
72  $tmp['type'] = 'sco';
73  $tmp['title'] = $item['title'];
74  $tmp["status"] = $this->isAssignedEntry($sco_id);
75 
76  $data[] = $tmp;
77  }
78 
79  return $data;
80  }
Create styles array
The data for the language used.
isAssignedEntry($a_item_id)
+ Here is the call graph for this function:

◆ itemsAreEqual()

ilLPCollectionOfSCOs::itemsAreEqual (   $item_a_id,
  $item_b_id 
)
protected
Parameters
$item_a_id
$item_b_id
Returns
bool

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

References $DIC, and ilObjSAHSLearningModule\_lookupSubType().

Referenced by cloneCollection().

143  {
144  global $DIC;
145  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
146  case 'scorm':
147  $res_a = $DIC->database()->query('SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database()->quote($item_a_id, 'integer'))->fetchAssoc();
148  $res_b = $DIC->database()->query('SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database()->quote($item_b_id, 'integer'))->fetchAssoc();
149  return (
150  $res_a
151  && $res_b
152  && ($res_a['import_id'] == $res_b['import_id'])
153  && ($res_a['identifierref'] == $res_b['identifierref'])
154  );
155  case 'scorm2004':
156  $res_a = $DIC->database()->query('SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database()->quote($item_a_id, 'integer'))->fetchAssoc();
157  $res_b = $DIC->database()->query('SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database()->quote($item_b_id, 'integer'))->fetchAssoc();
158  return (
159  $res_a
160  && $res_b
161  && ($res_a['import_id'] == $res_b['import_id'])
162  && ($res_a['identifierref'] == $res_b['identifierref'])
163  );
164  default:
165  return false;
166  }
167  }
global $DIC
Definition: saml.php:7
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $possible_items

ilLPCollectionOfSCOs::$possible_items = array()
staticprotected

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

Referenced by cloneCollection().


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