37 $this->objective_id = $a_objective_id;
38 if($this->objective_id)
64 $query =
"SELECT crs_id FROM crs_objectives ".
65 "WHERE objective_id = ".$ilDB->quote($a_objective_id ,
'integer');
92 $query =
'SELECT passes from crs_objectives '.
93 'WHERE objective_id = '.$ilDB->quote($a_objective_id,
'integer');
97 return (
int)
$row->passes;
106 $query =
'SELECT title,description from crs_objectives '.
107 'WHERE objective_id = '.$ilDB->quote($a_objective_id,
'integer');
109 while(
$row = $ilDB->fetchAssoc(
$res))
111 if(!$a_add_description)
113 return $row[
'title'];
132 public function ilClone($a_target_id,$a_copy_id)
138 $query =
"SELECT * FROM crs_objectives ".
139 "WHERE crs_id = ".$this->db->quote($this->course_obj->getId() ,
'integer').
' '.
140 "ORDER BY position ";
156 $new_objective->setTitle(
$row->title);
157 $new_objective->setDescription(
$row->description);
158 $new_objective->setActive(
$row->active);
159 $objective_id = $new_objective->add();
163 include_once(
'Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
165 $objective_qst->cloneDependencies($objective_id,$a_copy_id);
167 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
168 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
174 $random_i->copy($a_copy_id, $new_course->getId(),
$objective_id);
181 $random_q->copy($a_copy_id, $new_course->getId(),
$objective_id);
183 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
188 $assignment_it->cloneSettings($a_copy_id, $new_course->getId(),
$objective_id);
194 $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(),
$objective_id);
200 include_once(
'Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
202 $objective_material->cloneDependencies($objective_id,$a_copy_id);
210 $this->active = $a_stat;
220 $this->passes = $a_passes;
230 return $this->passes > 0;
236 $this->title = $a_title;
244 $this->description = $a_description;
248 return $this->description;
252 $this->objective_id = $a_objective_id;
262 $this->position = $a_pos;
271 $next_id = $ilDB->nextId(
'crs_objectives');
272 $query =
"INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) ".
274 $ilDB->quote($this->course_obj->getId() ,
'integer').
", ".
275 $ilDB->quote($next_id,
'integer').
", ".
276 $ilDB->quote($this->
isActive(),
'integer').
', '.
277 $ilDB->quote($this->
getTitle() ,
'text').
", ".
280 $ilDB->quote(
time() ,
'integer').
", ".
281 $ilDB->quote($this->
getPasses(),
'integer').
' '.
287 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
290 return $this->objective_id = $next_id;
298 $query =
"UPDATE crs_objectives ".
299 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
300 'active = '.$ilDB->quote($this->
isActive(),
'integer').
', '.
301 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
302 'passes = '.$ilDB->quote($this->
getPasses(),
'integer').
' '.
303 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
304 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
322 $query =
"UPDATE crs_objectives ".
323 "SET position = ".$this->db->quote((
string) $a_position ,
'integer').
" ".
324 "WHERE objective_id = ".$this->db->quote($this->
getObjectiveId() ,
'integer').
" ";
337 return (
bool) strlen($this->
getTitle());
344 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
347 $tmp_obj_qst->deleteAll();
349 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
352 $tmp_obj_lm->deleteAll();
355 $query =
"DELETE FROM crs_objectives ".
356 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
357 "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,
'integer').
" ";
361 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
381 $query =
"UPDATE crs_objectives ".
382 "SET position = position + 1 ".
383 "WHERE position = ".$ilDB->quote($this->
__getPosition() - 1 ,
'integer').
" ".
384 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
387 $query =
"UPDATE crs_objectives ".
388 "SET position = position - 1 ".
389 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
390 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
412 $query =
"UPDATE crs_objectives ".
413 "SET position = position - 1 ".
414 "WHERE position = ".$ilDB->quote($this->
__getPosition() + 1 ,
'integer').
" ".
415 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
418 $query =
"UPDATE crs_objectives ".
419 "SET position = position + 1 ".
420 "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
421 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
432 $this->position = $a_position;
436 return $this->position;
440 $this->created = $a_created;
444 return $this->created;
454 $query =
"SELECT * FROM crs_objectives ".
455 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
456 "AND objective_id = ".$ilDB->quote($this->getObjectiveId() ,
'integer').
" ";
479 switch($this->course_obj->getOrderType())
482 return 'ORDER BY position';
485 return 'ORDER BY title';
488 return 'ORDER BY create';
497 $query =
"UPDATE crs_objectives ".
498 "SET position = position - 1 ".
499 "WHERE position > ".$ilDB->quote($this->
__getPosition() ,
'integer').
" ".
500 "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
510 $query =
"SELECT MAX(position) pos FROM crs_objectives ".
511 "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
527 if($a_activated_only)
529 $query =
"SELECT objective_id FROM crs_objectives ".
530 "WHERE crs_id = ".$ilDB->quote($course_id ,
'integer').
" ".
531 'AND active = '.$ilDB->quote(1,
'integer').
' '.
536 $query =
"SELECT objective_id FROM crs_objectives ".
537 "WHERE crs_id = ".$ilDB->quote($course_id ,
'integer').
" ".
544 $ids[] =
$row->objective_id;
547 return $ids ? $ids :
array();
563 $in = $ilDB->in(
'objective_id',$ids,
false,
'integer');
566 $query =
"DELETE FROM crs_objective_lm WHERE ".$in;
569 $query =
"DELETE FROM crs_objective_tst WHERE ".$in;
572 $query =
"DELETE FROM crs_objective_qst WHERE ".$in;
575 $query =
"DELETE FROM crs_objectives WHERE crs_id = ".$ilDB->quote($course_id ,
'integer');
579 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
595 'online' => (
int) $this->
isActive(),
596 'position' => (
int) $this->position,
604 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
606 $materials->toXml($writer);
609 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
611 $test->toXml($writer);
613 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
617 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
static getInstance($a_container_id)
Get instance by container id.
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static toXml(ilXmlWriter $writer, $a_objective_id)
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.
static lookupMaxPasses($a_objective_id)
toXml(ilXmlWriter $writer)
write objective xml
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
static _getObjectiveIds($course_id, $a_activated_only=false)
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
setObjectiveId($a_objective_id)
xmlEndTag($tag)
Writes an endtag.
class ilCourseObjectiveMaterials
writePosition($a_position)
write position
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
__setPosition($a_position)
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
ilClone($a_target_id, $a_copy_id)
clone objectives
static _deleteAll($course_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
const TYPE_TEST_QUALIFIED
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
class ilcourseobjectiveQuestion
__construct($course_obj, $a_objective_id=0)
Constructor.
setDescription($a_description)