ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 26 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 126 of file class.ilLPCollectionOfSCOs.php.

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

126  : void
127  {
128  $target_obj_id = ilObject::_lookupObjId($a_target_id);
129  $new_collection = new static($target_obj_id, $this->mode);
130  $possible_items = $new_collection->getPossibleItems();
131  foreach ($this->items as $item_id) {
132  foreach ($possible_items as $pos_item_id => $pos_item) {
133  if ($this->itemsAreEqual($item_id, $pos_item_id)) {
134  $new_collection->addEntry($pos_item_id);
135  }
136  }
137  }
138  }
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 30 of file class.ilLPCollectionOfSCOs.php.

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

Referenced by getTableGUIData().

30  : array
31  {
32  if (!isset(self::$possible_items[$this->obj_id])) {
33  $items = array();
34 
35  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
36  case 'hacp':
37  case 'aicc':
38  foreach (ilObjAICCLearningModule::_getTrackingItems(
39  $this->obj_id
40  ) as $item) {
41  $items[$item['obj_id']]['title'] = $item['title'];
42  }
43  break;
44 
45  case 'scorm':
47  $this->obj_id
48  ) as $item) {
49  $items[$item->getId()]['title'] = $item->getTitle();
50  }
51  break;
52 
53  case 'scorm2004':
55  $this->obj_id
56  ) as $item) {
57  $items[$item['id']]['title'] = $item['title'];
58  }
59  break;
60  }
61 
62  self::$possible_items[$this->obj_id] = $items;
63  }
64 
65  return self::$possible_items[$this->obj_id];
66  }
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 92 of file class.ilLPCollectionOfSCOs.php.

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

95  : array {
96  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
97  case 'hacp':
98  case 'aicc':
99  return ilObjAICCLearningModule::_getScoresForUser(
100  $item_id,
101  $user_id
102  );
103 
104  case 'scorm':
106  $item_id,
107  $user_id
108  );
109 
110  case 'scorm2004':
112  $item_id,
113  $user_id
114  );
115  }
116 
117  return array("raw" => null, "max" => null, "scaled" => null);
118  }
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 68 of file class.ilLPCollectionOfSCOs.php.

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

68  : array
69  {
70  $data = array();
71 
72  foreach ($this->getPossibleItems() as $sco_id => $item) {
73  $tmp = array();
74  $tmp['id'] = $sco_id;
75  $tmp['ref_id'] = 0;
76  $tmp['type'] = 'sco';
77  $tmp['title'] = $item['title'];
78  $tmp["status"] = $this->isAssignedEntry($sco_id);
79 
80  $data[] = $tmp;
81  }
82 
83  return $data;
84  }
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 140 of file class.ilLPCollectionOfSCOs.php.

References $DIC, and ilObjSAHSLearningModule\_lookupSubType().

Referenced by cloneCollection().

140  : bool
141  {
142  global $DIC;
143  switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
144  case 'scorm':
145  $res_a = $DIC->database()->query(
146  'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
147  )->quote(
148  $item_a_id,
149  'integer'
150  )
151  )->fetchAssoc();
152  $res_b = $DIC->database()->query(
153  'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
154  )->quote(
155  $item_b_id,
156  'integer'
157  )
158  )->fetchAssoc();
159  return (
160  $res_a
161  && $res_b
162  && ($res_a['import_id'] == $res_b['import_id'])
163  && ($res_a['identifierref'] == $res_b['identifierref'])
164  );
165  case 'scorm2004':
166  $res_a = $DIC->database()->query(
167  'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
168  )->quote(
169  $item_a_id,
170  'integer'
171  )
172  )->fetchAssoc();
173  $res_b = $DIC->database()->query(
174  'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
175  )->quote(
176  $item_b_id,
177  'integer'
178  )
179  )->fetchAssoc();
180  return (
181  $res_a
182  && $res_b
183  && ($res_a['import_id'] == $res_b['import_id'])
184  && ($res_a['identifierref'] == $res_b['identifierref'])
185  );
186  default:
187  return false;
188  }
189  }
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
global $DIC
Definition: shib_login.php:22
+ 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 28 of file class.ilLPCollectionOfSCOs.php.


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