104                 $this->validation = 
true;
 
  141                 if($tree->checkForParentType($a_ref_id,
'crs'))
 
  148                 $childs = $tree->getSubTree($tree->getNodeData($a_ref_id),
false);
 
  151                 foreach(array_intersect(
$conditions,$childs) as $target_ref)
 
  153                         if(!$tree->checkForParentType($target_ref,
'crs'))
 
  172                 $query = 
"SELECT DISTINCT target_ref_id ref FROM conditions ";
 
  176                         $ref_ids[] = 
$row->ref;
 
  178                 return $ref_ids ? $ref_ids : array();
 
  195                 $query = 
"DELETE FROM conditions ".
 
  196                         "WHERE target_ref_id = ".$ilDB->quote($a_target_ref_id,
'integer').
" ".
 
  197                         "AND target_type != 'st' ";
 
  211                 return $this->condition_reference_type = $a_type;               
 
  222                 return (
int) $this->condition_reference_type;
 
  228                 $this->error_message = $a_msg;
 
  240                 return $this->target_ref_id = $a_target_ref_id;
 
  256                 return $this->target_obj_id = $a_target_obj_id;
 
  272                 return $this->target_type = $a_target_type;
 
  288                 return $this->trigger_ref_id = $a_trigger_ref_id;
 
  304                 return $this->trigger_obj_id = $a_trigger_obj_id;
 
  320                 return $this->trigger_type = $a_trigger_type;
 
  336                 return $this->
operator = $a_operator;
 
  352                 return $this->value = $a_value;
 
  369                 $this->obligatory = $a_obl;
 
  387                 $this->validation = $a_validate;
 
  397                 return array(
'crs',
'exc',
'tst',
'sahs', 
'svy');
 
  407                                 return array(
'passed');
 
  410                                 return array(
'passed',
'finished',
'not_finished');
 
  413                                 return array(
'not_member');
 
  416                                 return array(
'finished');
 
  419                                 return array(
'finished');
 
  436                 $next_id = $ilDB->nextId(
'conditions');
 
  437                 $query = 
'INSERT INTO conditions (condition_id,target_ref_id,target_obj_id,target_type,'.
 
  438                         'trigger_ref_id,trigger_obj_id,trigger_type,operator,value,ref_handling,obligatory) '.
 
  440                         $ilDB->quote($next_id,
'integer').
','.
 
  448                         $ilDB->quote($this->
getValue(),
'text').
", ".
 
  455                 if ($this->validation && !$this->
validate())
 
  467                 $query = 
"SELECT * FROM conditions ".
 
  468                         "WHERE target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
" ".
 
  469                         "AND target_obj_id = ".$ilDB->quote($this->
getTargetObjId(),
'integer').
" ".
 
  470                         "AND trigger_ref_id = ".$ilDB->quote($this->
getTriggerRefId(),
'integer').
" ".
 
  471                         "AND trigger_obj_id = ".$ilDB->quote($this->
getTriggerObjId(),
'integer').
" ".
 
  472                         "AND operator = ".$ilDB->quote($this->
getOperator(),
'text');
 
  475                 return $res->numRows() ? 
true : 
false;
 
  484                 $query = 
"UPDATE conditions SET ".
 
  485                         "target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
", ".
 
  486                         "operator = ".$ilDB->quote($this->
getOperator(),
'text').
", ".
 
  487                         "value = ".$ilDB->quote($this->
getValue(),
'text').
", ".
 
  489                         'obligatory = '.$this->db->quote($this->
getObligatory(),
'integer').
' '.
 
  490                         "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  506                 $query = 
"UPDATE conditions SET ".
 
  507                         'obligatory = '.$ilDB->quote($a_status,
'integer').
' '.
 
  508                         "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  518         function delete($a_ref_id)
 
  522                 $query = 
"DELETE FROM conditions WHERE ".
 
  523                         "target_ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ".
 
  524                         "OR trigger_ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
  537                 $query = 
"DELETE FROM conditions WHERE ".
 
  538                         "target_obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
 
  539                         "OR trigger_obj_id = ".$ilDB->quote($a_obj_id,
'integer');
 
  552                 $query = 
"DELETE FROM conditions ".
 
  553                         "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  567                 $query = 
"SELECT * FROM conditions ".
 
  568                         "WHERE trigger_obj_id = ".$ilDB->quote($a_trigger_id,
'integer').
" ".
 
  569                         " AND trigger_type = ".$ilDB->quote($a_trigger_obj_type,
'text');
 
  574                         $tmp_array[
'id']                        = 
$row->condition_id;
 
  575                         $tmp_array[
'target_ref_id'] = 
$row->target_ref_id;
 
  576                         $tmp_array[
'target_obj_id'] = 
$row->target_obj_id;
 
  577                         $tmp_array[
'target_type']       = 
$row->target_type;
 
  578                         $tmp_array[
'trigger_ref_id'] = 
$row->trigger_ref_id;
 
  579                         $tmp_array[
'trigger_obj_id'] = 
$row->trigger_obj_id;
 
  580                         $tmp_array[
'trigger_type']      = 
$row->trigger_type;
 
  581                         $tmp_array[
'operator']          = 
$row->operator;
 
  582                         $tmp_array[
'value']                     = 
$row->value;
 
  583                         $tmp_array[
'ref_handling']  = 
$row->ref_handling;
 
  584                         $tmp_array[
'obligatory']        = 
$row->obligatory;
 
  608                 if ($a_target_type == 
"")
 
  614                 if (isset(self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  617                         return self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  622                 if (isset(self::$cond_target_rows[$a_target_type.
":".$a_target_obj_id]))
 
  624                         $rows = self::$cond_target_rows[$a_target_type.
":".$a_target_obj_id];
 
  629                         $query = 
"SELECT * FROM conditions ".
 
  630                                 "WHERE target_obj_id = ".$ilDB->quote($a_target_obj_id,
'integer').
" ".
 
  631                                 " AND target_type = ".$ilDB->quote($a_target_type,
'text');
 
  635                         while (
$row = $ilDB->fetchAssoc(
$res))
 
  643                 foreach ($rows as 
$row)
 
  645                         if ($row[
"ref_handling"] == self::UNIQUE_CONDITIONS)
 
  647                                 if ($row[
"target_ref_id"] != $a_target_ref_id)
 
  653                         $row[
"id"] = $row[
"condition_id"];
 
  658                 self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  674                 if (is_array($a_obj_ids) && count($a_obj_ids) > 0)
 
  676                         $res = $ilDB->query(
"SELECT * FROM conditions ".
 
  677                                 "WHERE ".$ilDB->in(
"target_obj_id", $a_obj_ids, 
false, 
"integer").
 
  678                                 " AND target_type = ".$ilDB->quote($a_type,
'text'));
 
  680                         while (
$row = $ilDB->fetchAssoc(
$res))
 
  682                                 self::$cond_target_rows[$a_type.
":".
$row[
"target_obj_id"]][]
 
  686                         foreach ($a_obj_ids as $obj_id)
 
  688                                 if (!is_array(self::$cond_target_rows[$a_type.
":".$obj_id]))
 
  690                                         self::$cond_target_rows[$a_type.
":".$obj_id] = array();
 
  700                 $query = 
"SELECT * FROM conditions ".
 
  701                         "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  706                         $tmp_array[
'id']                        = 
$row->condition_id;
 
  707                         $tmp_array[
'target_ref_id'] = 
$row->target_ref_id;
 
  708                         $tmp_array[
'target_obj_id'] = 
$row->target_obj_id;
 
  709                         $tmp_array[
'target_type']       = 
$row->target_type;
 
  710                         $tmp_array[
'trigger_ref_id'] = 
$row->trigger_ref_id;
 
  711                         $tmp_array[
'trigger_obj_id'] = 
$row->trigger_obj_id;
 
  712                         $tmp_array[
'trigger_type']      = 
$row->trigger_type;
 
  713                         $tmp_array[
'operator']          = 
$row->operator;
 
  714                         $tmp_array[
'value']                     = 
$row->value;
 
  715                         $tmp_array[
'ref_handling']  = 
$row->ref_handling;
 
  716                         $tmp_array[
'obligatory']        = 
$row->obligatory;
 
  734                 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
 
  738                 switch($condition[
'trigger_type'])
 
  741                                 include_once 
'./Modules/Test/classes/class.ilObjTestAccess.php';
 
  745                                 include_once 
'./Modules/Course/classes/class.ilObjCourse.php';
 
  749                                 include_once 
'./Modules/Exercise/classes/class.ilObjExercise.php';
 
  753                                 include_once 
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
 
  757                                 include_once 
'./Services/Tracking/classes/class.ilLPStatus.php';
 
  761                                 include_once 
'./Modules/Survey/classes/class.ilObjSurvey.php';
 
  783                         if($con[
'obligatory'])
 
  810                         $set_obl = $all[0][
'num_obligatory'];
 
  815                         $set_obl < count($all) and
 
  816                         $set_obl > (count($all) - count($opt)  + 1))
 
  823                         $result = count($all) - count($opt) + 1;
 
  845                 $query = 
'UPDATE conditions '.
 
  846                         'SET num_obligatory = '.$ilDB->quote($a_num,
'integer').
' '.
 
  847                         'WHERE target_ref_id = '.$ilDB->quote($a_target_ref_id,
'integer').
' '.
 
  848                         'AND target_obj_id = '.$ilDB->quote($a_target_obj_id,
'integer');
 
  849                 $ilDB->manipulate(
$query);
 
  860                 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
 
  870                 include_once 
'./Services/Container/classes/class.ilMemberViewSettings.php';
 
  882                         if($tree->isDeleted($condition[
'trigger_ref_id']))
 
  891                                 if($passed >= $num_required)
 
  898                                 if(!count($optional))
 
  918                 $query = 
"SELECT * FROM conditions WHERE ".
 
  919                         "trigger_ref_id = ".$ilDB->quote($trigger_obj->getId(),
'integer').
" ".
 
  920                         "AND target_ref_id = ".$ilDB->quote($target_obj->getId(),
'integer');
 
  923                 if(
$res->numRows() > 1)
 
  933                 $this->target_obj_id = $target_obj->getId();
 
  949                         if($condition[
'trigger_obj_id'] == $this->target_obj_id and $condition[
'operator'] == $this->
getOperator())
 
  951                                 $this->circle = 
true;
 
  956                                 $this->
checkCircle($condition[
'trigger_ref_id'],$condition[
'trigger_obj_id']);
 
  959                 return $this->circle;