120 $this->validation =
true;
157 if($tree->checkForParentType($a_ref_id,
'crs'))
164 $childs = $tree->getSubTree($tree->getNodeData($a_ref_id),
false);
167 foreach(array_intersect(
$conditions,$childs) as $target_ref)
169 if(!$tree->checkForParentType($target_ref,
'crs'))
188 $query =
"SELECT DISTINCT target_ref_id AS ref FROM conditions ";
189 $res = $ilDB->query($query);
192 $ref_ids[] = $row->ref;
194 return $ref_ids ? $ref_ids : array();
211 $query =
"DELETE FROM conditions ".
212 "WHERE target_ref_id = ".$ilDB->quote($a_target_ref_id).
" ".
213 "AND target_type != 'st' ";
214 $ilDB->query($query);
227 return $this->condition_reference_type = $a_type;
238 return $this->condition_reference_type;
244 $this->error_message = $a_msg;
256 return $this->target_ref_id = $a_target_ref_id;
272 return $this->target_obj_id = $a_target_obj_id;
288 return $this->target_type = $a_target_type;
304 return $this->trigger_ref_id = $a_trigger_ref_id;
320 return $this->trigger_obj_id = $a_trigger_obj_id;
336 return $this->trigger_type = $a_trigger_type;
352 return $this->
operator = $a_operator;
368 return $this->value = $a_value;
384 $this->validation = $a_validate;
394 return array(
'crs',
'exc',
'tst',
'sahs',
'svy');
404 return array(
'passed');
407 return array(
'passed',
'finished',
'not_finished');
410 return array(
'not_member');
413 return array(
'finished');
416 return array(
'finished');
433 $query =
'INSERT INTO conditions '.
441 $res = $this->db->query($query);
443 $query =
"SELECT LAST_INSERT_ID() AS last FROM conditions";
444 $res = $this->db->query($query);
447 $last_id = $row->last;
450 if ($this->validation && !$this->
validate())
462 $query =
"SELECT * FROM conditions ".
463 "WHERE target_ref_id = ".$ilDB->quote($this->
getTargetRefId()).
" ".
467 "AND operator = ".$ilDB->quote($this->
getOperator());
469 $res = $this->db->query($query);
471 return $res->numRows() ?
true :
false;
480 $query =
"UPDATE conditions SET ".
482 "operator = ".$ilDB->quote($this->
getOperator()).
", ".
483 "value = ".$ilDB->quote($this->
getValue()).
", ".
485 "WHERE id = ".$ilDB->quote($a_id);
487 $res = $this->db->query($query);
497 function delete($a_ref_id)
501 $query =
"DELETE FROM conditions WHERE ".
502 "target_ref_id = ".$ilDB->quote($a_ref_id).
" ".
503 "OR trigger_ref_id = ".$ilDB->quote($a_ref_id);
505 $res = $this->db->query($query);
517 $query =
"DELETE FROM conditions WHERE ".
518 "target_obj_id = ".$ilDB->quote($a_obj_id).
" ".
519 "OR trigger_obj_id = ".$ilDB->quote($a_obj_id);
521 $res = $this->db->query($query);
533 $query =
"DELETE FROM conditions ".
534 "WHERE id = ".$ilDB->quote($a_id);
536 $res = $ilDB->query($query);
549 $query =
"SELECT * FROM conditions ".
550 "WHERE trigger_obj_id = ".$ilDB->quote($a_trigger_id).
" ".
551 " AND trigger_type = ".$ilDB->quote($a_trigger_obj_type).
" ";
553 $res = $ilDB->query($query);
556 $tmp_array[
'id'] = $row->id;
557 $tmp_array[
'target_ref_id'] = $row->target_ref_id;
558 $tmp_array[
'target_obj_id'] = $row->target_obj_id;
559 $tmp_array[
'target_type'] = $row->target_type;
560 $tmp_array[
'trigger_ref_id'] = $row->trigger_ref_id;
561 $tmp_array[
'trigger_obj_id'] = $row->trigger_obj_id;
562 $tmp_array[
'trigger_type'] = $row->trigger_type;
563 $tmp_array[
'operator'] = $row->operator;
564 $tmp_array[
'value'] = $row->value;
565 $tmp_array[
'ref_handling'] = $row->ref_handling;
588 $ilBench->start(
"ilConditionHandler",
"getConditionsOfTarget");
590 if ($a_target_type ==
"")
595 $query =
"SELECT * FROM conditions ".
596 "WHERE target_obj_id = ".$ilDB->quote($a_target_obj_id).
" ".
597 " AND target_type = ".$ilDB->quote($a_target_type);
599 $res = $ilDB->query($query);
602 if($row->ref_handling == self::UNIQUE_CONDITIONS)
604 if($row->target_ref_id != $a_target_ref_id)
610 $tmp_array[
'id'] = $row->id;
611 $tmp_array[
'target_ref_id'] = $row->target_ref_id;
612 $tmp_array[
'target_obj_id'] = $row->target_obj_id;
613 $tmp_array[
'target_type'] = $row->target_type;
614 $tmp_array[
'trigger_ref_id'] = $row->trigger_ref_id;
615 $tmp_array[
'trigger_obj_id'] = $row->trigger_obj_id;
616 $tmp_array[
'trigger_type'] = $row->trigger_type;
617 $tmp_array[
'operator'] = $row->operator;
618 $tmp_array[
'value'] = $row->value;
619 $tmp_array[
'ref_handling'] = $row->ref_handling;
625 $ilBench->stop(
"ilConditionHandler",
"getConditionsOfTarget");
634 $query =
"SELECT * FROM conditions ".
635 "WHERE id = ".$ilDB->quote($a_id);
637 $res = $ilDB->query($query);
640 $tmp_array[
'id'] = $row->id;
641 $tmp_array[
'target_ref_id'] = $row->target_ref_id;
642 $tmp_array[
'target_obj_id'] = $row->target_obj_id;
643 $tmp_array[
'target_type'] = $row->target_type;
644 $tmp_array[
'trigger_ref_id'] = $row->trigger_ref_id;
645 $tmp_array[
'trigger_obj_id'] = $row->trigger_obj_id;
646 $tmp_array[
'trigger_type'] = $row->trigger_type;
647 $tmp_array[
'operator'] = $row->operator;
648 $tmp_array[
'value'] = $row->value;
649 $tmp_array[
'ref_handling'] = $row->ref_handling;
667 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
671 switch($condition[
'trigger_type'])
674 include_once
'./Modules/Test/classes/class.ilObjTestAccess.php';
678 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
682 include_once
'./Modules/Exercise/classes/class.ilObjExercise.php';
686 include_once
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
690 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
694 include_once
'./Modules/Survey/classes/class.ilObjSurvey.php';
711 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
715 $ilBench->start(
"ilConditionHandler",
"checkCondition");
717 $ilBench->stop(
"ilConditionHandler",
"checkCondition");
737 $query =
"SELECT * FROM conditions WHERE ".
738 "trigger_ref_id = ".$ilDB->quote($trigger_obj->getId()).
" ".
739 "AND target_ref_id = ".$ilDB->quote($target_obj->getId());
741 $res = $this->db->query($query);
742 if(
$res->numRows() > 1)
752 $this->target_obj_id = $target_obj->getId();
768 if($condition[
'trigger_obj_id'] == $this->target_obj_id and $condition[
'operator'] == $this->
getOperator())
770 $this->circle =
true;
775 $this->
checkCircle($condition[
'trigger_ref_id'],$condition[
'trigger_obj_id']);
778 return $this->circle;