28 $this->obj_id = $a_id;
38 $this->ref_id = $a_ref_id;
48 return $this->start_objs ? $this->start_objs : array();
55 $this->start_objs = array();
57 $query =
"SELECT * FROM crs_start".
58 " WHERE crs_id = ".$ilDB->quote($this->
getObjId(),
'integer').
59 " ORDER BY pos, crs_start_id";
63 if($tree->isInTree(
$row->item_ref_id))
65 $this->start_objs[
$row->crs_start_id][
'item_ref_id'] =
$row->item_ref_id;
69 $this->
delete(
$row->item_ref_id);
81 public function delete($a_crs_start_id)
85 $query =
"DELETE FROM crs_start".
86 " WHERE crs_start_id = ".$ilDB->quote($a_crs_start_id,
'integer').
87 " AND crs_id = ".$ilDB->quote($this->
getObjId(),
'integer');
100 $query =
"DELETE FROM crs_start".
101 " WHERE crs_id = ".$ilDB->quote($this->
getObjId(),
'integer').
102 " AND item_ref_id = ".$ilDB->quote($a_item_ref_id,
'integer');
103 $ilDB->manipulate(
$query);
111 $query =
"SELECT * FROM crs_start".
112 " WHERE crs_id = ".$ilDB->quote($this->
getObjId(),
'integer').
113 " AND item_ref_id = ".$ilDB->quote($a_item_ref_id,
'integer');
116 return $res->numRows() ?
true :
false;
119 public function add($a_item_ref_id)
125 $max_pos = $ilDB->query(
"SELECT max(pos) pos FROM crs_start".
126 " WHERE crs_id = ".$ilDB->quote($this->getObjId(),
"integer"));
127 $max_pos = $ilDB->fetchAssoc($max_pos);
128 $max_pos = ((int)$max_pos[
"pos"])+10;
130 $next_id = $ilDB->nextId(
'crs_start');
131 $query =
"INSERT INTO crs_start".
132 " (crs_start_id,crs_id,item_ref_id,pos)".
134 " (".$ilDB->quote($next_id,
'integer').
135 ", ".$ilDB->quote($this->
getObjId(),
'integer').
136 ", ".$ilDB->quote($a_item_ref_id,
'integer').
137 ", ".$ilDB->quote($max_pos,
'integer').
139 $ilDB->manipulate(
$query);
149 $query =
"DELETE FROM crs_start".
150 " WHERE crs_id = ".$ilDB->quote($this->
getObjId(),
'integer');
151 $ilDB->manipulate(
$query);
159 if(!(
int)$a_start_id || !(
int)$a_pos)
164 $ilDB->manipulate(
"UPDATE crs_start".
165 " SET pos = ".$ilDB->quote($a_pos,
"integer").
166 " WHERE crs_id = ".$ilDB->quote($this->
getObjId(),
'integer').
167 " AND crs_start_id = ".$ilDB->quote($a_start_id,
'integer'));
172 include_once
"Services/Object/classes/class.ilObjectActivation.php";
175 switch($node[
'type'])
181 $poss_items[] = $node[
'ref_id'];
185 return $poss_items ? $poss_items : array();
192 if(!$this->
isFullfilled($a_user_id, $item[
'item_ref_id']))
202 global $ilObjDataCache;
204 $obj_id = $ilObjDataCache->lookupObjId($a_item_id);
205 $type = $ilObjDataCache->lookupType(
$obj_id);
210 include_once
'./Modules/Test/classes/class.ilObjTestAccess.php';
219 include_once
'./Modules/Survey/classes/class.ilObjSurveyAccess.php';
227 include_once
'Services/Tracking/classes/class.ilLPStatus.php';
235 include_once
'./Modules/Course/classes/class.ilCourseLMHistory.php';
237 $continue_data = $lm_continue->getLMHistory();
238 if(!isset($continue_data[$a_item_id]))
250 global $ilObjDataCache,
$ilLog;
252 $ilLog->write(__METHOD__.
': Begin course start objects...');
254 $new_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
255 $start =
new self($a_target_id, $new_obj_id);
257 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
259 $mappings = $cwo->getMappings();
262 $item_ref_id = $data[
'item_ref_id'];
263 if(isset($mappings[$item_ref_id]) and $mappings[$item_ref_id])
265 $ilLog->write(__METHOD__.
': Clone start object nr. '.$item_ref_id);
266 $start->add($mappings[$item_ref_id]);
270 $ilLog->write(__METHOD__.
': No mapping found for start object nr. '.$item_ref_id);
273 $ilLog->write(__METHOD__.
': ... end course start objects');
288 $query =
'SELECT crs_start_id FROM crs_start '.
289 'WHERE crs_id = '.$ilDB->quote($a_container_id,
'integer').
' '.
290 'AND item_ref_id = '.$ilDB->quote($a_item_ref_id,
'integer');
292 if(
$res->numRows() >= 1)