44 global $ilObjDataCache,$ilDB;
48 $this->obj_id = $a_obj_id;
62 global $ilObjDataCache,
$ilLog;
64 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
66 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
68 $mappings = $cwo->getMappings();
71 foreach($this->items as $item)
73 if(!isset($mappings[$item]) or !$mappings[$item])
77 $new_collections->add($mappings[$item]);
78 $ilLog->write(__METHOD__.
': Added learning progress collection.');
94 return (
bool) in_array($a_ref_id,$this->items);
97 function add($item_id)
99 $query =
"DELETE FROM ut_lp_collections ".
100 "WHERE obj_id = '".$this->obj_id.
"' ".
101 "AND item_id = '".(int) $item_id.
"'";
102 $this->db->query($query);
104 $query =
"REPLACE INTO ut_lp_collections ".
105 "SET obj_id = '".$this->obj_id.
"', ".
106 "item_id = '".(int) $item_id.
"'";
107 $this->db->query($query);
113 function delete($item_id)
115 $query =
"DELETE FROM ut_lp_collections ".
116 "WHERE item_id = '".$item_id.
"' ".
117 "AND obj_id = '".$this->obj_id.
"'";
118 $this->db->query($query);
131 if($tree->isDeleted($a_target_id))
136 $node_data = $tree->getNodeData($a_target_id);
137 foreach($tree->getSubTree($node_data) as $node)
140 if($node[
'ref_id'] == $a_target_id)
145 switch($node[
'type'])
155 $all_possible[] = $node[
'ref_id'];
160 return $all_possible ? $all_possible : array();
180 include_once
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
186 include_once
'./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
190 $items[
"$item[obj_id]"][
'title'] = $item[
'title'];
191 #$items[$item->getId()]['title'] = $item->getTitle();
196 include_once
'./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
197 include_once
'./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
201 $items[$item->getId()][
'title'] = $item->getTitle();
206 include_once
'./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
210 $items[$item[
"id"]][
'title'] = $item[
"title"];
227 $query =
"DELETE FROM ut_lp_collections ".
228 "WHERE obj_id = '".$a_obj_id.
"'";
229 $ilDB->query($query);
236 global $ilObjDataCache;
239 include_once
'Services/Tracking/classes/class.ilLPObjSettings.php';
244 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
252 if($ilObjDataCache->lookupType($a_obj_id) !=
'sahs')
255 $course_ref_id = end($course_ref_ids);
258 $query =
"SELECT * FROM ut_lp_collections as utc ".
259 "JOIN object_reference as obr ON item_id = ref_id ".
260 "JOIN object_data as obd ON obr.obj_id = obd.obj_id ".
261 "WHERE utc.obj_id = ".$ilDB->quote($a_obj_id).
" ".
267 $query =
"SELECT * FROM ut_lp_collections WHERE obj_id = '".$a_obj_id.
"'";
270 $res = $ilDB->query($query);
273 if($ilObjDataCache->lookupType($a_obj_id) !=
'sahs')
275 if(!in_array($row->item_id,$possible_items))
282 if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) ==
'tst')
284 include_once
'./Modules/Test/classes/class.ilObjTest.php';
301 $query =
"DELETE FROM ut_lp_collections ".
302 "WHERE obj_id = '".$a_obj_id.
"' ".
303 "AND item_id = '".$a_item_id.
"'";
304 $ilDB->query($query);
311 global $ilObjDataCache;
313 if($ilObjDataCache->lookupType($this->getObjId()) !=
'sahs')
316 $course_ref_id = end($course_ref_ids);
317 $query =
"SELECT * FROM ut_lp_collections as utc ".
318 "JOIN object_reference as obr ON item_id = ref_id ".
319 "JOIN object_data as obd ON obr.obj_id = obd.obj_id ".
320 "WHERE utc.obj_id = ".$this->db->quote($this->obj_id).
" ".
325 $query =
"SELECT * FROM ut_lp_collections WHERE obj_id = '".$this->getObjId().
"'";
327 $res = $this->db->query($query);
330 if($ilObjDataCache->lookupType($this->getObjId()) !=
'sahs')
339 if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) ==
'tst')
341 include_once
'./Modules/Test/classes/class.ilObjTest.php';
348 $this->items[] = $row->item_id;