ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilLPCollectionOfSCOs Class Reference
+ 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
array $items
 
int $obj_id
 
int $mode
 
ilDBInterface $db
 
ilLogger $logger
 
TrackingDBFactoryInterface $tracking_db_factory
 

Detailed Description

Definition at line 21 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

Reimplemented from ilLPCollection.

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

121 : void
122 {
123 $target_obj_id = ilObject::_lookupObjId($a_target_id);
124 $new_collection = new static($target_obj_id, $this->mode);
125 $possible_items = $new_collection->getPossibleItems();
126 foreach ($this->items as $item_id) {
127 foreach ($possible_items as $pos_item_id => $pos_item) {
128 if ($this->itemsAreEqual($item_id, $pos_item_id)) {
129 $new_collection->addEntry($pos_item_id);
130 }
131 }
132 }
133 }
itemsAreEqual(int $item_a_id, int $item_b_id)
static _lookupObjId(int $ref_id)

References ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ getPossibleItems()

ilLPCollectionOfSCOs::getPossibleItems ( )

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

25 : array
26 {
27 if (!isset(self::$possible_items[$this->obj_id])) {
28 $items = array();
29
30 switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
31 case 'hacp':
32 case 'aicc':
33 foreach (ilObjAICCLearningModule::_getTrackingItems(
34 $this->obj_id
35 ) as $item) {
36 $items[$item['obj_id']]['title'] = $item['title'];
37 }
38 break;
39
40 case 'scorm':
42 $this->obj_id
43 ) as $item) {
44 $items[$item->getId()]['title'] = $item->getTitle();
45 }
46 break;
47
48 case 'scorm2004':
50 $this->obj_id
51 ) as $item) {
52 $items[$item['id']]['title'] = $item['title'];
53 }
54 break;
55 }
56
57 self::$possible_items[$this->obj_id] = $items;
58 }
59
60 return self::$possible_items[$this->obj_id];
61 }
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
static _getTrackingItems(int $a_obj_id)
get all tracking items of scorm object

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

Referenced by getTableGUIData().

+ 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 87 of file class.ilLPCollectionOfSCOs.php.

90 : array {
91 switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
92 case 'hacp':
93 case 'aicc':
94 return ilObjAICCLearningModule::_getScoresForUser(
95 $item_id,
97 );
98
99 case 'scorm':
101 $item_id,
103 );
104
105 case 'scorm2004':
107 $item_id,
109 );
110 }
111
112 return array("raw" => null, "max" => null, "scaled" => null);
113 }
static _getScores2004ForUser(int $a_cp_node_id, int $a_user)
static _getScoresForUser(int $a_item_id, int $a_user_id)

References $user_id, ilObjSCORM2004LearningModule\_getScores2004ForUser(), and ilObjSCORMLearningModule\_getScoresForUser().

+ Here is the call graph for this function:

◆ getTableGUIData()

ilLPCollectionOfSCOs::getTableGUIData ( int  $a_parent_ref_id)

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

63 : array
64 {
65 $data = array();
66
67 foreach ($this->getPossibleItems() as $sco_id => $item) {
68 $tmp = array();
69 $tmp['id'] = $sco_id;
70 $tmp['ref_id'] = 0;
71 $tmp['type'] = 'sco';
72 $tmp['title'] = $item['title'];
73 $tmp["status"] = $this->isAssignedEntry($sco_id);
74
75 $data[] = $tmp;
76 }
77
78 return $data;
79 }
isAssignedEntry(int $a_item_id)
$data
Definition: storeScorm.php:45

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

+ Here is the call graph for this function:

◆ itemsAreEqual()

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

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

135 : bool
136 {
137 global $DIC;
138 switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) {
139 case 'scorm':
140 $res_a = $DIC->database()->query(
141 'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
142 )->quote(
143 $item_a_id,
144 'integer'
145 )
146 )->fetchAssoc();
147 $res_b = $DIC->database()->query(
148 'SELECT import_id, identifierref FROM sc_item WHERE obj_id = ' . $DIC->database(
149 )->quote(
150 $item_b_id,
151 'integer'
152 )
153 )->fetchAssoc();
154 return (
155 $res_a
156 && $res_b
157 && ($res_a['import_id'] == $res_b['import_id'])
158 && ($res_a['identifierref'] == $res_b['identifierref'])
159 );
160 case 'scorm2004':
161 $res_a = $DIC->database()->query(
162 'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
163 )->quote(
164 $item_a_id,
165 'integer'
166 )
167 )->fetchAssoc();
168 $res_b = $DIC->database()->query(
169 'SELECT id, resourceid FROM cp_item WHERE cp_node_id = ' . $DIC->database(
170 )->quote(
171 $item_b_id,
172 'integer'
173 )
174 )->fetchAssoc();
175 return (
176 $res_a
177 && $res_b
178 && ($res_a['id'] == $res_b['id'])
179 && ($res_a['resourceid'] == $res_b['resourceid'])
180 );
181 default:
182 return false;
183 }
184 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ilObjSAHSLearningModule\_lookupSubType().

+ Here is the call graph for this function:

Field Documentation

◆ $possible_items

array ilLPCollectionOfSCOs::$possible_items = array()
staticprotected

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


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