24 global $ilObjDataCache,
$ilDB;
28 $this->obj_id = $a_obj_id;
42 global $ilObjDataCache,
$ilLog;
44 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
46 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
48 $mappings = $cwo->getMappings();
51 foreach($this->items as $item)
53 if(!isset($mappings[$item]) or !$mappings[$item])
57 $new_collections->add($mappings[$item]);
58 $ilLog->write(__METHOD__.
': Added learning progress collection.');
74 return (
bool) in_array($a_ref_id,$this->items);
77 function add($item_id)
81 $query =
"DELETE FROM ut_lp_collections ".
82 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ".
83 "AND item_id = ".$ilDB->quote($item_id ,
'integer').
" ";
86 $query =
"INSERT INTO ut_lp_collections (obj_id, item_id) ".
88 $ilDB->quote($this->obj_id ,
'integer').
", ".
89 $ilDB->quote($item_id ,
'integer').
97 function delete($item_id)
101 $query =
"DELETE FROM ut_lp_collections ".
102 "WHERE item_id = ".$ilDB->quote($item_id ,
'integer').
" ".
103 "AND obj_id = ".$ilDB->quote($this->obj_id ,
'integer').
" ";
117 if($tree->isDeleted($a_target_id))
122 $node_data = $tree->getNodeData($a_target_id);
123 foreach($tree->getSubTree($node_data) as $node)
126 if($node[
'ref_id'] == $a_target_id)
131 switch($node[
'type'])
141 $all_possible[] = $node[
'ref_id'];
146 return $all_possible ? $all_possible : array();
166 include_once
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
172 include_once
'./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
176 $items[
"$item[obj_id]"][
'title'] = $item[
'title'];
177 #$items[$item->getId()]['title'] = $item->getTitle();
182 include_once
'./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
183 include_once
'./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
187 $items[$item->getId()][
'title'] = $item->getTitle();
192 include_once
'./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
196 $items[$item[
"id"]][
'title'] = $item[
"title"];
213 $query =
"DELETE FROM ut_lp_collections ".
214 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
"";
220 function &
_getItems($a_obj_id, $a_use_subtree_by_id =
false)
222 global $ilObjDataCache;
225 include_once
'Services/Tracking/classes/class.ilLPObjSettings.php';
230 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
238 if($ilObjDataCache->lookupType($a_obj_id) !=
'sahs')
241 $course_ref_id = end($course_ref_ids);
242 if (!$a_use_subtree_by_id)
248 $possible_items = $tree->getSubTreeIds($course_ref_id);
251 $query =
"SELECT * FROM ut_lp_collections utc ".
252 "JOIN object_reference obr ON item_id = ref_id ".
253 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
254 "WHERE utc.obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
260 $query =
"SELECT * FROM ut_lp_collections WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ";
266 if($ilObjDataCache->lookupType($a_obj_id) !=
'sahs')
268 if(!in_array(
$row->item_id,$possible_items))
275 if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId(
$row->item_id)) ==
'tst')
277 include_once
'./Modules/Test/classes/class.ilObjTest.php';
294 $query =
"DELETE FROM ut_lp_collections ".
295 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ".
296 "AND item_id = ".$ilDB->quote($a_item_id ,
'integer').
" ";
304 global $ilObjDataCache,
$ilDB;
306 $this->items = array();
308 if($ilObjDataCache->lookupType($this->getObjId()) !=
'sahs')
311 $course_ref_id = end($course_ref_ids);
312 $query =
"SELECT * FROM ut_lp_collections utc ".
313 "JOIN object_reference obr ON item_id = ref_id ".
314 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
315 "WHERE utc.obj_id = ".$this->db->quote($this->obj_id,
'integer').
" ".
320 $query =
"SELECT * FROM ut_lp_collections WHERE obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ";
325 if($ilObjDataCache->lookupType($this->getObjId()) !=
'sahs')
334 if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId(
$row->item_id)) ==
'tst')
336 include_once
'./Modules/Test/classes/class.ilObjTest.php';
343 $this->items[] =
$row->item_id;