100 $this->validation =
true;
137 if($tree->checkForParentType($a_ref_id,
'crs'))
144 $childs = $tree->getSubTree($tree->getNodeData($a_ref_id),
false);
147 foreach(array_intersect(
$conditions,$childs) as $target_ref)
149 if(!$tree->checkForParentType($target_ref,
'crs'))
168 $query =
"SELECT DISTINCT target_ref_id ref FROM conditions ";
172 $ref_ids[] =
$row->ref;
174 return $ref_ids ? $ref_ids : array();
191 $query =
"DELETE FROM conditions ".
192 "WHERE target_ref_id = ".$ilDB->quote($a_target_ref_id,
'integer').
" ".
193 "AND target_type != 'st' ";
207 return $this->condition_reference_type = $a_type;
218 return (
int) $this->condition_reference_type;
224 $this->error_message = $a_msg;
236 return $this->target_ref_id = $a_target_ref_id;
252 return $this->target_obj_id = $a_target_obj_id;
268 return $this->target_type = $a_target_type;
284 return $this->trigger_ref_id = $a_trigger_ref_id;
300 return $this->trigger_obj_id = $a_trigger_obj_id;
316 return $this->trigger_type = $a_trigger_type;
332 return $this->
operator = $a_operator;
348 return $this->value = $a_value;
364 $this->validation = $a_validate;
374 return array(
'crs',
'exc',
'tst',
'sahs',
'svy');
384 return array(
'passed');
387 return array(
'passed',
'finished',
'not_finished');
390 return array(
'not_member');
393 return array(
'finished');
396 return array(
'finished');
413 $next_id = $ilDB->nextId(
'conditions');
414 $query =
'INSERT INTO conditions (condition_id,target_ref_id,target_obj_id,target_type,'.
415 'trigger_ref_id,trigger_obj_id,trigger_type,operator,value,ref_handling) '.
417 $ilDB->quote($next_id,
'integer').
','.
425 $ilDB->quote($this->
getValue(),
'text').
", ".
431 if ($this->validation && !$this->
validate())
443 $query =
"SELECT * FROM conditions ".
444 "WHERE target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
" ".
445 "AND target_obj_id = ".$ilDB->quote($this->
getTargetObjId(),
'integer').
" ".
446 "AND trigger_ref_id = ".$ilDB->quote($this->
getTriggerRefId(),
'integer').
" ".
447 "AND trigger_obj_id = ".$ilDB->quote($this->
getTriggerObjId(),
'integer').
" ".
448 "AND operator = ".$ilDB->quote($this->
getOperator(),
'text');
451 return $res->numRows() ?
true :
false;
460 $query =
"UPDATE conditions SET ".
461 "target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
", ".
462 "operator = ".$ilDB->quote($this->
getOperator(),
'text').
", ".
463 "value = ".$ilDB->quote($this->
getValue(),
'text').
", ".
465 "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
476 function delete($a_ref_id)
480 $query =
"DELETE FROM conditions WHERE ".
481 "target_ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ".
482 "OR trigger_ref_id = ".$ilDB->quote($a_ref_id,
'integer');
495 $query =
"DELETE FROM conditions WHERE ".
496 "target_obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
497 "OR trigger_obj_id = ".$ilDB->quote($a_obj_id,
'integer');
510 $query =
"DELETE FROM conditions ".
511 "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
525 $query =
"SELECT * FROM conditions ".
526 "WHERE trigger_obj_id = ".$ilDB->quote($a_trigger_id,
'integer').
" ".
527 " AND trigger_type = ".$ilDB->quote($a_trigger_obj_type,
'text');
532 $tmp_array[
'id'] =
$row->condition_id;
533 $tmp_array[
'target_ref_id'] =
$row->target_ref_id;
534 $tmp_array[
'target_obj_id'] =
$row->target_obj_id;
535 $tmp_array[
'target_type'] =
$row->target_type;
536 $tmp_array[
'trigger_ref_id'] =
$row->trigger_ref_id;
537 $tmp_array[
'trigger_obj_id'] =
$row->trigger_obj_id;
538 $tmp_array[
'trigger_type'] =
$row->trigger_type;
539 $tmp_array[
'operator'] =
$row->operator;
540 $tmp_array[
'value'] =
$row->value;
541 $tmp_array[
'ref_handling'] =
$row->ref_handling;
564 $ilBench->start(
"ilConditionHandler",
"getConditionsOfTarget");
566 if ($a_target_type ==
"")
571 $query =
"SELECT * FROM conditions ".
572 "WHERE target_obj_id = ".$ilDB->quote($a_target_obj_id,
'integer').
" ".
573 " AND target_type = ".$ilDB->quote($a_target_type,
'text');
578 if(
$row->ref_handling == self::UNIQUE_CONDITIONS)
580 if(
$row->target_ref_id != $a_target_ref_id)
586 $tmp_array[
'id'] =
$row->condition_id;
587 $tmp_array[
'target_ref_id'] =
$row->target_ref_id;
588 $tmp_array[
'target_obj_id'] =
$row->target_obj_id;
589 $tmp_array[
'target_type'] =
$row->target_type;
590 $tmp_array[
'trigger_ref_id'] =
$row->trigger_ref_id;
591 $tmp_array[
'trigger_obj_id'] =
$row->trigger_obj_id;
592 $tmp_array[
'trigger_type'] =
$row->trigger_type;
593 $tmp_array[
'operator'] =
$row->operator;
594 $tmp_array[
'value'] =
$row->value;
595 $tmp_array[
'ref_handling'] =
$row->ref_handling;
601 $ilBench->stop(
"ilConditionHandler",
"getConditionsOfTarget");
610 $query =
"SELECT * FROM conditions ".
611 "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
616 $tmp_array[
'id'] =
$row->condition_id;
617 $tmp_array[
'target_ref_id'] =
$row->target_ref_id;
618 $tmp_array[
'target_obj_id'] =
$row->target_obj_id;
619 $tmp_array[
'target_type'] =
$row->target_type;
620 $tmp_array[
'trigger_ref_id'] =
$row->trigger_ref_id;
621 $tmp_array[
'trigger_obj_id'] =
$row->trigger_obj_id;
622 $tmp_array[
'trigger_type'] =
$row->trigger_type;
623 $tmp_array[
'operator'] =
$row->operator;
624 $tmp_array[
'value'] =
$row->value;
625 $tmp_array[
'ref_handling'] =
$row->ref_handling;
643 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
647 switch($condition[
'trigger_type'])
650 include_once
'./Modules/Test/classes/class.ilObjTestAccess.php';
654 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
658 include_once
'./Modules/Exercise/classes/class.ilObjExercise.php';
662 include_once
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
666 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
670 include_once
'./Modules/Survey/classes/class.ilObjSurvey.php';
687 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
691 if($tree->isDeleted($condition[
'trigger_ref_id']))
696 $ilBench->start(
"ilConditionHandler",
"checkCondition");
698 $ilBench->stop(
"ilConditionHandler",
"checkCondition");
700 include_once
'./Services/Container/classes/class.ilMemberViewSettings.php';
719 $query =
"SELECT * FROM conditions WHERE ".
720 "trigger_ref_id = ".$ilDB->quote($trigger_obj->getId(),
'integer').
" ".
721 "AND target_ref_id = ".$ilDB->quote($target_obj->getId(),
'integer');
724 if(
$res->numRows() > 1)
734 $this->target_obj_id = $target_obj->getId();
750 if($condition[
'trigger_obj_id'] == $this->target_obj_id and $condition[
'operator'] == $this->
getOperator())
752 $this->circle =
true;
757 $this->
checkCircle($condition[
'trigger_ref_id'],$condition[
'trigger_obj_id']);
760 return $this->circle;