113                $this->validation = 
true;
 
  145                $query = 
'SELECT hidden_status FROM conditions '.
 
  146                                'WHERE target_ref_id = '.$ilDB->quote($a_target_ref_id,
'integer');
 
  150                        return $row->hidden_status;
 
  169                if($tree->checkForParentType($a_ref_id,
'crs'))
 
  176                $childs = $tree->getSubTree($tree->getNodeData($a_ref_id),
false);
 
  179                foreach(array_intersect(
$conditions,$childs) as $target_ref)
 
  181                        if(!$tree->checkForParentType($target_ref,
'crs'))
 
  200                $query = 
"SELECT DISTINCT target_ref_id ref FROM conditions ";
 
  204                        $ref_ids[] = 
$row->ref;
 
  206                return $ref_ids ? $ref_ids : array();
 
  223                $query = 
"DELETE FROM conditions ".
 
  224                        "WHERE target_ref_id = ".$ilDB->quote($a_target_ref_id,
'integer').
" ".
 
  225                        "AND target_type != 'st' ";
 
  239                return $this->condition_reference_type = 
$a_type;               
 
  250                return (
int) $this->condition_reference_type;
 
  256                $this->error_message = $a_msg;
 
  268                return $this->target_ref_id = $a_target_ref_id;
 
  284                return $this->target_obj_id = $a_target_obj_id;
 
  300                return $this->target_type = $a_target_type;
 
  316                return $this->trigger_ref_id = $a_trigger_ref_id;
 
  332                return $this->trigger_obj_id = $a_trigger_obj_id;
 
  348                return $this->trigger_type = $a_trigger_type;
 
  364                return $this->
operator = $a_operator;
 
  380                return $this->value = $a_value;
 
  397                $this->obligatory = $a_obl;
 
  411                $this->hidden_status = $a_status;
 
  425                $this->validation = $a_validate;
 
  435                global $objDefinition;
 
  437                $trigger_types =  array(
'crs',
'exc',
'tst',
'sahs', 
'svy', 
'lm', 
'iass');
 
  439                foreach($objDefinition->getPlugins() as $p_type => $p_info)
 
  441                        if(@include_once $p_info[
'location'].
'/class.ilObj'.$p_info[
'class_name'].
'Access.php')
 
  443                                include_once 
'./Services/AccessControl/interfaces/interface.ilConditionHandling.php';
 
  444                                $name = 
'ilObj'.$p_info[
'class_name'].
'Access';
 
  445                                $refection = 
new ReflectionClass($name);
 
  446                                if($refection->implementsInterface(
'ilConditionHandling'))
 
  448                                        $trigger_types[] = $p_type;
 
  454                $active_triggers = array();
 
  455                foreach($trigger_types as $type)
 
  459                                $active_triggers[] = $type;
 
  466                return $active_triggers;
 
  477                global $objDefinition;
 
  482                                return array(
'not_member');
 
  485                $class = $objDefinition->getClassName(
$a_type);
 
  487                $full_class = 
"ilObj".$class.
"Access";
 
  488                include_once(
$location.
"/class.".$full_class.
".php");
 
  490                include_once 
'./Services/AccessControl/interfaces/interface.ilConditionHandling.php';
 
  492                $reflection = 
new ReflectionClass($full_class);
 
  493                if(!$reflection->implementsInterface(
'ilConditionHandling'))
 
  499                $operators = call_user_func(
 
  500                                array($full_class, 
'getConditionOperators'),
 
  505                include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
 
  509                        include_once(
"Services/Object/classes/class.ilObjectLP.php");
 
  512                                array_unshift($operators,self::OPERATOR_LP);
 
  528                $next_id = 
$ilDB->nextId(
'conditions');
 
  529                $query = 
'INSERT INTO conditions (condition_id,target_ref_id,target_obj_id,target_type,'.
 
  530                        'trigger_ref_id,trigger_obj_id,trigger_type,operator,value,ref_handling,obligatory,hidden_status) '.
 
  532                        $ilDB->quote($next_id,
'integer').
','.
 
  540                        $ilDB->quote($this->
getValue(),
'text').
", ".
 
  548                if ($this->validation && !$this->
validate())
 
  560                $query = 
"SELECT * FROM conditions ".
 
  561                        "WHERE target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
" ".
 
  562                        "AND target_obj_id = ".$ilDB->quote($this->
getTargetObjId(),
'integer').
" ".
 
  563                        "AND trigger_ref_id = ".$ilDB->quote($this->
getTriggerRefId(),
'integer').
" ".
 
  564                        "AND trigger_obj_id = ".$ilDB->quote($this->
getTriggerObjId(),
'integer').
" ".
 
  565                        "AND operator = ".$ilDB->quote($this->
getOperator(),
'text');
 
  568                return $res->numRows() ? true : 
false;
 
  577                $query = 
"UPDATE conditions SET ".
 
  578                        "target_ref_id = ".$ilDB->quote($this->
getTargetRefId(),
'integer').
", ".
 
  579                        "operator = ".$ilDB->quote($this->
getOperator(),
'text').
", ".
 
  580                        "value = ".$ilDB->quote($this->
getValue(),
'text').
", ".
 
  582                        'obligatory = '.$this->db->quote($this->
getObligatory(),
'integer').
' '.
 
  583                        "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  600                $query = 
'UPDATE conditions SET '.
 
  601                                'hidden_status = '.$ilDB->quote($a_status,
'integer').
' '.
 
  602                                'WHERE target_ref_id = '.$ilDB->quote($this->
getTargetRefId(),
'integer');
 
  603                $ilDB->manipulate(
$query);
 
  617                $query = 
"UPDATE conditions SET ".
 
  618                        'obligatory = '.$ilDB->quote($a_status,
'integer').
' '.
 
  619                        "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  629        function delete($a_ref_id)
 
  633                $query = 
"DELETE FROM conditions WHERE ".
 
  634                        "target_ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ".
 
  635                        "OR trigger_ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
  648                $query = 
"DELETE FROM conditions WHERE ".
 
  649                        "target_obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
 
  650                        "OR trigger_obj_id = ".$ilDB->quote($a_obj_id,
'integer');
 
  663                $query = 
"DELETE FROM conditions ".
 
  664                        "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  678                $query = 
"SELECT * FROM conditions ".
 
  679                        "WHERE trigger_obj_id = ".$ilDB->quote($a_trigger_id,
'integer').
" ".
 
  680                        " AND trigger_type = ".$ilDB->quote($a_trigger_obj_type,
'text');
 
  685                        $tmp_array[
'id']                        = 
$row->condition_id;
 
  686                        $tmp_array[
'target_ref_id'] = 
$row->target_ref_id;
 
  687                        $tmp_array[
'target_obj_id'] = 
$row->target_obj_id;
 
  688                        $tmp_array[
'target_type']       = 
$row->target_type;
 
  689                        $tmp_array[
'trigger_ref_id'] = 
$row->trigger_ref_id;
 
  690                        $tmp_array[
'trigger_obj_id'] = 
$row->trigger_obj_id;
 
  691                        $tmp_array[
'trigger_type']      = 
$row->trigger_type;
 
  692                        $tmp_array[
'operator']          = 
$row->operator;
 
  693                        $tmp_array[
'value']                     = 
$row->value;
 
  694                        $tmp_array[
'ref_handling']  = 
$row->ref_handling;
 
  695                        $tmp_array[
'obligatory']        = 
$row->obligatory;
 
  696                        $tmp_array[
'hidden_status'] = 
$row->hidden_status;
 
  720                if ($a_target_type == 
"")
 
  726                if (isset(self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  729                        return self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  734                if (isset(self::$cond_target_rows[$a_target_type.
":".$a_target_obj_id]))
 
  736                        $rows = self::$cond_target_rows[$a_target_type.
":".$a_target_obj_id];
 
  741                        $query = 
"SELECT * FROM conditions ".
 
  742                                "WHERE target_obj_id = ".$ilDB->quote($a_target_obj_id,
'integer').
" ".
 
  743                                " AND target_type = ".$ilDB->quote($a_target_type,
'text');
 
  755                foreach ($rows as 
$row)
 
  757                        if (
$row[
"ref_handling"] == self::UNIQUE_CONDITIONS)
 
  759                                if (
$row[
"target_ref_id"] != $a_target_ref_id)
 
  770                self::$cond_for_target_cache[$a_target_ref_id.
":".$a_target_obj_id.
":".
 
  786                if (is_array($a_obj_ids) && count($a_obj_ids) > 0)
 
  788                        $res = 
$ilDB->query(
"SELECT * FROM conditions ".
 
  789                                "WHERE ".
$ilDB->in(
"target_obj_id", $a_obj_ids, 
false, 
"integer").
 
  790                                " AND target_type = ".$ilDB->quote(
$a_type,
'text'));
 
  794                                self::$cond_target_rows[
$a_type.
":".
$row[
"target_obj_id"]][]
 
  798                        foreach ($a_obj_ids as $obj_id)
 
  800                                if (!is_array(self::$cond_target_rows[
$a_type.
":".$obj_id]))
 
  802                                        self::$cond_target_rows[
$a_type.
":".$obj_id] = array();
 
  812                $query = 
"SELECT * FROM conditions ".
 
  813                        "WHERE condition_id = ".$ilDB->quote($a_id,
'integer');
 
  818                        $tmp_array[
'id']                        = 
$row->condition_id;
 
  819                        $tmp_array[
'target_ref_id'] = 
$row->target_ref_id;
 
  820                        $tmp_array[
'target_obj_id'] = 
$row->target_obj_id;
 
  821                        $tmp_array[
'target_type']       = 
$row->target_type;
 
  822                        $tmp_array[
'trigger_ref_id'] = 
$row->trigger_ref_id;
 
  823                        $tmp_array[
'trigger_obj_id'] = 
$row->trigger_obj_id;
 
  824                        $tmp_array[
'trigger_type']      = 
$row->trigger_type;
 
  825                        $tmp_array[
'operator']          = 
$row->operator;
 
  826                        $tmp_array[
'value']                     = 
$row->value;
 
  827                        $tmp_array[
'ref_handling']  = 
$row->ref_handling;
 
  828                        $tmp_array[
'obligatory']        = 
$row->obligatory;
 
  829                        $tmp_array[
'hidden_status'] = 
$row->hidden_status;
 
  845                global 
$ilUser, $objDefinition;
 
  847                $a_usr_id = $a_usr_id ? $a_usr_id : 
$ilUser->getId();
 
  852                if($condition[
'operator'] == self::OPERATOR_LP)
 
  854                        include_once 
'./Services/Tracking/classes/class.ilLPStatus.php';
 
  858                switch($condition[
'trigger_type'])
 
  861                                include_once 
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
 
  865                $class = $objDefinition->getClassName($condition[
'trigger_type']);
 
  866                $location = $objDefinition->getLocation($condition[
'trigger_type']);
 
  867                $full_class = 
"ilObj".$class.
"Access";
 
  868                include_once(
$location.
"/class.".$full_class.
".php");
 
  870                $fullfilled = call_user_func(
 
  871                                array($full_class, 
'checkCondition'),
 
  872                                $condition[
'trigger_obj_id'],
 
  873                                $condition[
'operator'],
 
  892                        if($con[
'obligatory'])
 
  911                $query = 
'SELECT max(num_obligatory) obl from conditions WHERE '.
 
  912                        'target_ref_id = '.$ilDB->quote($a_target_ref_id,
'integer').
' '.
 
  913                        'AND target_obj_id = '.$ilDB->quote($a_target_obj_id,
'integer').
' '.
 
  914                        'GROUP BY (num_obligatory)';
 
  942                        $set_obl = $all[0][
'num_obligatory'];
 
  947                        $set_obl < count($all) and
 
  948                        $set_obl > (count($all) - count($opt)  + 1))
 
  955                        $result = count($all) - count($opt) + 1;
 
  977                $query = 
'UPDATE conditions '.
 
  978                        'SET num_obligatory = '.$ilDB->quote($a_num,
'integer').
' '.
 
  979                        'WHERE target_ref_id = '.$ilDB->quote($a_target_ref_id,
'integer').
' '.
 
  980                        'AND target_obj_id = '.$ilDB->quote($a_target_obj_id,
'integer');
 
  992                $a_usr_id = $a_usr_id ? $a_usr_id : 
$ilUser->getId();
 
 1002                include_once 
'./Services/Container/classes/class.ilMemberViewSettings.php';
 
 1014                        if($tree->isDeleted($condition[
'trigger_ref_id']))
 
 1023                                if($passed >= $num_required)
 
 1030                                if(!count($optional))
 
 1050                $query = 
"SELECT * FROM conditions WHERE ".
 
 1051                        "trigger_ref_id = ".$ilDB->quote($trigger_obj->getRefId(),
'integer').
" ".
 
 1052                        "AND target_ref_id = ".$ilDB->quote($target_obj->getRefId(),
'integer');
 
 1055                if(
$res->numRows() > 1)
 
 1057                        $this->
setErrorMessage($this->lng->txt(
'condition_already_assigned'));
 
 1059                        unset($trigger_obj);
 
 1065                $this->target_obj_id = $target_obj->getId();
 
 1070                        unset($trigger_obj);
 
 1081                        if($condition[
'trigger_obj_id'] == $this->target_obj_id and $condition[
'operator'] == $this->
getOperator())
 
 1083                                $this->circle = 
true;
 
 1088                                $this->
checkCircle($condition[
'trigger_ref_id'],$condition[
'trigger_obj_id']);
 
 1091                return $this->circle;
 
 1096                include_once 
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
 
 1098                $mappings = $cwo->getMappings();
 
 1104                        if($mappings[$con[
'trigger_ref_id']])
 
 1111                                $newCondition->setTargetRefId($a_target_ref_id);
 
 1112                                $newCondition->setTargetObjId($target_obj);
 
 1113                                $newCondition->setTargetType($target_typ);
 
 1115                                $trigger_ref = $mappings[$con[
'trigger_ref_id']];
 
 1119                                $newCondition->setTriggerRefId($trigger_ref);
 
 1120                                $newCondition->setTriggerObjId($trigger_obj);
 
 1121                                $newCondition->setTriggerType($trigger_typ);
 
 1122                                $newCondition->setOperator($con[
'operator']);
 
 1123                                $newCondition->setValue($con[
'value']);
 
 1124                                $newCondition->setReferenceHandlingType($con[
'ref_handling']);
 
 1125                                $newCondition->setObligatory($con[
'obligatory']);
 
 1128                                $newCondition->setHiddenStatus(self::lookupHiddenStatusByTarget($a_src_ref_id));
 
 1130                                if($newCondition->storeCondition())
 
An exception for terminatinating execution or to throw for unit testing.
Handles conditions for accesses to different ILIAS objects.
getTargetType()
get target obj type
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
setTargetType($a_target_type)
set target object type
static _getCondition($a_id)
setTargetObjId($a_target_obj_id)
set target object id
getTriggerRefId()
get target ref id
setTriggerRefId($a_trigger_ref_id)
set trigger ref id
getTriggerTypes()
get all possible trigger types NOT STATIC @access public
getTargetRefId()
get target ref id
getTriggerType()
get trigger obj type
__construct()
constructor @access public
getOperator()
get operator
deleteCondition($a_id)
delete condition
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
getOperatorsByTargetType($a_type)
Get operators by target type.
getReferenceHandlingType()
get reference handling type
static _checkCondition($a_id, $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
getObligatory()
Get obligatory status.
static _deleteTargetConditionsByRefId($a_target_ref_id)
Delete conditions by target ref id Note: only conditions on the target type are deleted Conditions on...
storeCondition()
store new condition in database NOT STATIC @access public
static _adjustMovedObjectConditions($a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
setTargetRefId($a_target_ref_id)
set target ref id
setOperator($a_operator)
set operator
enableAutomaticValidation($a_validate=true)
enable automated validation
setReferenceHandlingType($a_type)
set reference handling type
static _getDistinctTargetRefIds()
Get all target ref ids.
setObligatory($a_obl)
Set obligatory status.
static cloneDependencies($a_src_ref_id, $a_target_ref_id, $a_copy_id)
static saveNumberOfRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_num)
Save number of obigatory triggers.
static $cond_for_target_cache
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
setTriggerType($a_trigger_type)
set trigger object type
updateHiddenStatus($a_status)
Update hidden status @global type $ilDB.
checkCircle($a_ref_id, $a_obj_id)
getTargetObjId()
get target obj id
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
deleteByObjId($a_obj_id)
delete all trigger and target entries This method is called from ilObject::delete() if an object is r...
static lookupHiddenStatusByTarget($a_target_ref_id)
Lookup hidden status @global type $ilDB.
setHiddenStatus($a_status)
updateCondition($a_id)
update condition
setTriggerObjId($a_trigger_obj_id)
set trigger object id
const OPERATOR_NOT_FINISHED
getTriggerObjId()
get trigger obj id
const OPERATOR_NOT_MEMBER
static _isReferenceHandlingOptional($a_type)
is reference handling optional
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
setValue($a_value)
set value
static preloadConditionsForTargetRecords($a_type, $a_obj_ids)
Preload conditions for target records.
static lookupObligatoryConditionsOfTarget($a_target_ref_id, $a_target_obj_id)
Lookup obligatory conditions of target.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
static getInstance()
Get instance.
static _checkCondition($trigger_obj_id, $operator, $value, $a_usr_id=0)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static isSupportedObjectType($a_type)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type