48 $this->objective_id = $a_objective_id;
49 if($this->objective_id)
67 $query =
"SELECT crs_id FROM crs_objectives ".
68 "WHERE objective_id = ".$ilDB->quote($a_objective_id ,
'integer');
89 $query =
"SELECT * FROM crs_objectives ".
90 "WHERE crs_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ";
92 return $res->numRows() ?
true :
false;
103 public function ilClone($a_target_id,$a_copy_id)
107 $ilLog->write(__METHOD__.
': Start cloning learning objectives...');
109 $query =
"SELECT * FROM crs_objectives ".
110 "WHERE crs_id = ".$this->db->quote($this->course_obj->getId() ,
'integer').
' '.
111 "ORDER BY position ";
115 $ilLog->write(__METHOD__.
': ... no objectives found.');
121 $ilLog->write(__METHOD__.
': Cannot init new course object.');
127 $new_objective->setTitle(
$row->title);
128 $new_objective->setDescription(
$row->description);
130 $ilLog->write(__METHOD__.
': Added new objective nr: '.
$objective_id);
133 include_once(
'Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
137 $ilLog->write(__METHOD__.
': Finished objective question dependencies: '.
$objective_id);
140 include_once(
'Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
142 $objective_material->cloneDependencies(
$objective_id,$a_copy_id);
144 $ilLog->write(__METHOD__.
': Finished cloning objectives.');
149 $this->title = $a_title;
157 $this->description = $a_description;
161 return $this->description;
165 $this->objective_id = $a_objective_id;
176 $next_id = $ilDB->nextId(
'crs_objectives');
177 $query =
"INSERT INTO crs_objectives (crs_id,objective_id,title,description,position,created) ".
179 $ilDB->quote($this->course_obj->getId() ,
'integer').
", ".
180 $ilDB->quote($next_id,
'integer').
", ".
181 $ilDB->quote($this->
getTitle() ,
'text').
", ".
184 $ilDB->quote(time() ,
'integer').
" ".
188 return $this->objective_id = $next_id;
195 $query =
"UPDATE crs_objectives ".
196 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
197 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
" ".
198 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
199 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
"";
216 $query =
"UPDATE crs_objectives ".
217 "SET position = ".$this->db->quote((
string) $a_position ,
'integer').
" ".
218 "WHERE objective_id = ".$this->db->quote($this->
getObjectiveId() ,
'integer').
" ";
231 return (
bool) strlen($this->
getTitle());
238 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
241 $tmp_obj_qst->deleteAll();
243 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
246 $tmp_obj_lm->deleteAll();
249 $query =
"DELETE FROM crs_objectives ".
250 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
251 "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,
'integer').
" ";
271 $query =
"UPDATE crs_objectives ".
272 "SET position = position + 1 ".
273 "WHERE position = ".$ilDB->quote($this->
__getPosition() - 1 ,
'integer').
" ".
274 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
277 $query =
"UPDATE crs_objectives ".
278 "SET position = position - 1 ".
279 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
280 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
302 $query =
"UPDATE crs_objectives ".
303 "SET position = position - 1 ".
304 "WHERE position = ".$ilDB->quote($this->
__getPosition() + 1 ,
'integer').
" ".
305 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
308 $query =
"UPDATE crs_objectives ".
309 "SET position = position + 1 ".
310 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
311 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
322 $this->position = $a_position;
326 return $this->position;
330 $this->created = $a_created;
334 return $this->created;
344 $query =
"SELECT * FROM crs_objectives ".
345 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
346 "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,
'integer').
" ";
365 switch($this->course_obj->getOrderType())
368 return 'ORDER BY position';
371 return 'ORDER BY title';
374 return 'ORDER BY create';
383 $query =
"UPDATE crs_objectives ".
384 "SET position = position - 1 ".
385 "WHERE position > ".$ilDB->quote($this->
__getPosition() ,
'integer').
" ".
386 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
396 $query =
"SELECT MAX(position) pos FROM crs_objectives ".
397 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
412 $query =
"SELECT objective_id FROM crs_objectives ".
413 "WHERE crs_id = ".$ilDB->quote($course_id ,
'integer').
" ".
419 $ids[] =
$row->objective_id;
422 return $ids ? $ids : array();
436 $in = $ilDB->in(
'objective_id',$ids,
false,
'integer');
439 $query =
"DELETE FROM crs_objective_lm WHERE ".$in;
442 $query =
"DELETE FROM crs_objective_tst WHERE ".$in;
445 $query =
"DELETE FROM crs_objective_qst WHERE ".$in;
448 $query =
"DELETE FROM crs_objectives WHERE crs_id = ".$ilDB->quote($course_id ,
'integer');