39 $this->objective_id = $a_objective_id;
40 if ($this->objective_id) {
67 $query =
"SELECT crs_id FROM crs_objectives " .
68 "WHERE objective_id = " .
$ilDB->quote($a_objective_id,
'integer');
96 $query =
'SELECT passes from crs_objectives ' .
97 'WHERE objective_id = ' .
$ilDB->quote($a_objective_id,
'integer');
100 return (
int)
$row->passes;
109 $ilDB = $DIC[
'ilDB'];
111 $query =
'SELECT title,description from crs_objectives ' .
112 'WHERE objective_id = ' .
$ilDB->quote($a_objective_id,
'integer');
115 if (!$a_add_description) {
116 return $row[
'title'];
133 public function ilClone($a_target_id, $a_copy_id)
141 $query =
"SELECT * FROM crs_objectives " .
142 "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(),
'integer') .
' ' .
143 "ORDER BY position ";
145 if (!
$res->numRows()) {
156 $new_objective->setTitle(
$row->title);
157 $new_objective->setDescription(
$row->description);
158 $new_objective->setActive(
$row->active);
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';
175 $random_i->copy($a_copy_id, $new_course->getId(),
$objective_id);
183 $random_q->copy($a_copy_id, $new_course->getId(),
$objective_id);
185 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
188 if ($assignment_it) {
189 $assignment_it->cloneSettings($a_copy_id, $new_course->getId(),
$objective_id);
193 if ($assignment_qt) {
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;
252 $this->objective_id = $a_objective_id;
262 $this->position = $a_pos;
270 $ilDB = $DIC[
'ilDB'];
273 $next_id =
$ilDB->nextId(
'crs_objectives');
274 $query =
"INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
276 $ilDB->quote($this->course_obj->getId(),
'integer') .
", " .
277 $ilDB->quote($next_id,
'integer') .
", " .
282 $ilDB->quote(time(),
'integer') .
", " .
289 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
292 return $this->objective_id = $next_id;
299 $ilDB = $DIC[
'ilDB'];
302 $query =
"UPDATE crs_objectives " .
303 "SET title = " .
$ilDB->quote($this->
getTitle(),
'text') .
", " .
304 'active = ' .
$ilDB->quote($this->
isActive(),
'integer') .
', ' .
308 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
326 $ilDB = $DIC[
'ilDB'];
328 $query =
"UPDATE crs_objectives " .
329 "SET position = " . $this->db->quote((
string) $a_position,
'integer') .
" " .
330 "WHERE objective_id = " . $this->db->quote($this->
getObjectiveId(),
'integer') .
" ";
343 return (
bool) strlen($this->
getTitle());
346 public function delete()
350 $ilDB = $DIC[
'ilDB'];
352 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
355 $tmp_obj_qst->deleteAll();
357 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
360 $tmp_obj_lm->deleteAll();
363 $query =
"DELETE FROM crs_objectives " .
364 "WHERE crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" " .
365 "AND objective_id = " .
$ilDB->quote($this->getObjectiveId(),
'integer') .
" ";
369 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
379 $ilDB = $DIC[
'ilDB'];
389 $query =
"UPDATE crs_objectives " .
390 "SET position = position + 1 " .
392 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
395 $query =
"UPDATE crs_objectives " .
396 "SET position = position - 1 " .
398 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
410 $ilDB = $DIC[
'ilDB'];
420 $query =
"UPDATE crs_objectives " .
421 "SET position = position - 1 " .
423 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
426 $query =
"UPDATE crs_objectives " .
427 "SET position = position + 1 " .
429 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
440 $this->position = $a_position;
444 return $this->position;
448 $this->created = $a_created;
452 return $this->created;
460 $ilDB = $DIC[
'ilDB'];
463 $query =
"SELECT * FROM crs_objectives " .
464 "WHERE crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" " .
465 "AND objective_id = " .
$ilDB->quote($this->getObjectiveId(),
'integer') .
" ";
487 switch ($this->course_obj->getOrderType()) {
489 return 'ORDER BY position';
492 return 'ORDER BY title';
495 return 'ORDER BY create';
504 $ilDB = $DIC[
'ilDB'];
506 $query =
"UPDATE crs_objectives " .
507 "SET position = position - 1 " .
509 "AND crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
519 $ilDB = $DIC[
'ilDB'];
521 $query =
"SELECT MAX(position) pos FROM crs_objectives " .
522 "WHERE crs_id = " .
$ilDB->quote($this->course_obj->getId(),
'integer') .
" ";
537 $ilDB = $DIC[
'ilDB'];
539 if ($a_activated_only) {
540 $query =
"SELECT objective_id FROM crs_objectives " .
541 "WHERE crs_id = " .
$ilDB->quote($course_id,
'integer') .
" " .
542 'AND active = ' .
$ilDB->quote(1,
'integer') .
' ' .
545 $query =
"SELECT objective_id FROM crs_objectives " .
546 "WHERE crs_id = " .
$ilDB->quote($course_id,
'integer') .
" " .
552 $ids[] =
$row->objective_id;
555 return $ids ? $ids : array();
563 $ilDB = $DIC[
'ilDB'];
572 $in =
$ilDB->in(
'objective_id', $ids,
false,
'integer');
575 $query =
"DELETE FROM crs_objective_lm WHERE " .
$in;
578 $query =
"DELETE FROM crs_objective_tst WHERE " .
$in;
581 $query =
"DELETE FROM crs_objective_qst WHERE " .
$in;
584 $query =
"DELETE FROM crs_objectives WHERE crs_id = " .
$ilDB->quote($course_id,
'integer');
588 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
604 'online' => (
int) $this->
isActive(),
605 'position' => (
int) $this->position,
613 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
615 $materials->toXml($writer);
618 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
620 $test->toXml($writer);
622 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
626 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
static getInstance($a_container_id)
Get instance by container id.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
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
static _getObjectiveIds($course_id, $a_activated_only=false)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
setObjectiveId($a_objective_id)
xmlEndTag($tag)
Writes an endtag.
class ilCourseObjectiveMaterials
foreach($_POST as $key=> $value) $res
writePosition($a_position)
write position
if(php_sapi_name() !='cli') $in
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
__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.
class ilcourseobjectiveQuestion
__construct($course_obj, $a_objective_id=0)
Constructor.
setDescription($a_description)