3 declare(strict_types=1);
    63         $this->
ctrl = $DIC->ctrl();
    64         $this->
lng = $DIC->language();
    65         $this->
lng->loadLanguageModule(
'rbac');
    66         $this->
lng->loadLanguageModule(
'cond');
    67         $this->tpl = $DIC->ui()->mainTemplate();
    68         $this->tree = $DIC->repositoryTree();
    69         $this->
access = $DIC->access();
    70         $this->
toolbar = $DIC->toolbar();
    71         $this->conditionUtil = $DIC->conditions()->util();
    73         $this->
http = $DIC->http();
    78             if ($target_obj !== null) {
    89         if ($this->
http->wrapper()->query()->has(
'condition_id')) {
    90             return $this->
http->wrapper()->query()->retrieve(
   100         if ($this->
http->wrapper()->post()->has(
'conditions')) {
   101             return SplFixedArray::fromArray(
   102                 $this->
http->wrapper()->post()->retrieve(
   104                     $this->
refinery->kindlyTo()->listOf(
   110         return new SplFixedArray(0);
   115         if ($this->
http->wrapper()->post()->has(
'item_ids')) {
   116             return SplFixedArray::fromArray(
   117                 $this->
http->wrapper()->post()->retrieve(
   119                     $this->
refinery->kindlyTo()->listOf(
   125         return new SplFixedArray(0);
   130         if ($this->
http->wrapper()->post()->has(
'obl')) {
   131             return SplFixedArray::fromArray(
   132                 $this->
http->wrapper()->post()->retrieve(
   134                     $this->
refinery->kindlyTo()->listOf(
   140         return new SplFixedArray(0);
   145         return $this->
http->wrapper()->post()->retrieve(
   148                 $this->refinery->kindlyTo()->string(),
   149                 $this->
refinery->always(self::LIST_MODE_UNDEFINED)
   156         if ($this->
http->wrapper()->query()->has(
'source_id')) {
   157             return $this->
http->wrapper()->query()->retrieve(
   169         $lng = $DIC->language();
   170         switch ($a_operator) {
   179                 return $lng->
txt(
'condition_' . $a_operator);
   207         if (!$this->
access->checkAccess(
'write', 
'', $this->getTargetRefId())) {
   208             $ilErr->raiseError($this->
lng->txt(
'permission_denied'), 
$ilErr->WARNING);
   211         $next_class = $this->
ctrl->getNextClass($this);
   212         $cmd = $this->
ctrl->getCmd();
   213         switch ($next_class) {
   225         $this->automatic_validation = $a_status;
   235         $this->target_id = $a_target_id;
   245         $this->target_ref_id = $a_target_ref_id;
   255         $this->target_type = $a_target_type;
   265         $this->target_title = $a_target_title;
   286             $this->conditionUtil->isUnderParentControl($this->getTargetRefId())
   288             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cond_under_parent_control"));
   292         $this->
toolbar->addButton($this->
lng->txt(
'add_condition'), $this->
ctrl->getLinkTarget($this, 
'selector'));
   293         $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.list_conditions.html', 
'Services/AccessControl');
   301         if (count($optional_conditions)) {
   302             if ($list_mode === self::LIST_MODE_UNDEFINED) {
   303                 $list_mode = self::LIST_MODE_SUBSET;
   305         } elseif ($list_mode === self::LIST_MODE_UNDEFINED) {
   306             $list_mode = self::LIST_MODE_ALL;
   318                 $this->tpl->setVariable(
'TABLE_SETTINGS', $form->getHTML());
   323         $table->setConditions(
   331         $h = $table->getHTML();
   332         $this->tpl->setVariable(
'TABLE_CONDITIONS', $h);
   338         if ($form !== null && $form->checkInput()) {
   339             $old_mode = $form->getInput(
"old_list_mode");
   340             switch ($form->getInput(
"list_mode")) {
   342                     if ($old_mode !== 
"all") {
   349                         foreach ($optional_conditions as $item) {
   356                     $num_req = $form->getInput(
'required');
   357                     if ($old_mode !== 
"subset") {
   363                         foreach ($all_conditions as $item) {
   377             $cond->updateHiddenStatus((
bool) $form->getInput(
'hidden'));
   379             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   380             $this->
ctrl->redirect($this, 
'listConditions');
   383         $form->setValuesByPost();
   384         $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   385         $this->tpl->setContent($form->getHTML());
   397         if (count($obligatory_ids) > count($all_conditions) - 2) {
   398             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"rbac_precondition_minimum_optional"), 
true);
   399             $this->
ctrl->redirect($this, 
'listConditions');
   402         foreach ($all_conditions as $item) {
   404             if (in_array($item[
'condition_id'], $obligatory_ids->toArray(), 
true)) {
   418         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   419         $this->
ctrl->redirect($this, 
'listConditions');
   423         string $list_mode = self::LIST_MODE_ALL
   431         $form->setFormAction($this->
ctrl->getFormAction($this, 
'listConditions'));
   432         $form->setTitle($this->
lng->txt(
'precondition_obligatory_settings'));
   433         $form->addCommandButton(
'saveObligatorySettings', $this->
lng->txt(
'save'));
   437         $hide->setValue(
"1");
   438         $hide->setInfo($this->
lng->txt(
'rbac_precondition_hide_info'));
   439         $form->addItem($hide);
   442         $form->addItem($mode);
   445         $mall = 
new ilRadioOption($this->
lng->txt(
"rbac_precondition_mode_all"), 
"all");
   446         $mall->
setInfo($this->
lng->txt(
"rbac_precondition_mode_all_info"));
   447         $mode->addOption($mall);
   449         if (count($all) > 1) {
   451             $max = count($all) - 1;
   453             $msubset = 
new ilRadioOption($this->
lng->txt(
"rbac_precondition_mode_subset"), 
"subset");
   454             $msubset->
setInfo($this->
lng->txt(
"rbac_precondition_mode_subset_info"));
   455             $mode->addOption($msubset);
   458             $obl->setInfo($this->
lng->txt(
'precondition_num_optional_info'));
   464             $obl->setValue($num_required > 0 ? (
string) $num_required : null);
   465             $obl->setRequired(
true);
   467             $obl->setMinValue($min);
   468             $obl->setMaxValue($max);
   469             $msubset->addSubItem($obl);
   473         $old_mode->setValue($list_mode);
   474         $form->addItem($old_mode);
   482         if (!$condition_id) {
   483             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   487         $this->
ctrl->setParameter($this, 
'condition_id', $condition_id);
   491             $form = $this->
initFormCondition($condition[
'trigger_ref_id'], $condition_id, 
'edit');
   493         $this->tpl->setContent($form->getHTML());
   499         if (!$condition_id) {
   500             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   509             $condition[
'trigger_ref_id'],
   514         if (!$form->checkInput()) {
   515             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   520         $condition_handler->setOperator((
string) $form->getInput(
'operator'));
   521         $condition_handler->setObligatory((
bool) $form->getInput(
'obligatory'));
   523         $condition_handler->setValue(
'');
   526                 $condition_handler->setReferenceHandlingType((
int) $form->getInput(
'ref_handling'));
   533         $condition_handler->updateCondition($condition[
'id']);
   536         if ($condition[
'trigger_type'] === 
'sahs') {
   538             $collection = $olp->getCollectionInstance();
   540                 $collection->delete();
   543             if (count($item_ids)) { 
   544                 $collection->activateEntries($item_ids->toArray());
   548         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   549         $this->
ctrl->redirect($this, 
'listConditions');
   555         if (!count($condition_ids)) {
   556             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'));
   563         $cgui->setFormAction($this->
ctrl->getFormAction($this, 
"listConditions"));
   564         $cgui->setHeaderText($this->
lng->txt(
"rbac_condition_delete_sure"));
   565         $cgui->setCancel($this->
lng->txt(
"cancel"), 
"listConditions");
   566         $cgui->setConfirm($this->
lng->txt(
"delete"), 
"delete");
   569         foreach ($condition_ids as $condition_id) {
   573                 " (" . $this->
lng->txt(
"condition") . 
": " .
   574                 $this->
lng->txt(
'condition_' . $condition[
'operator']) . 
")";
   576             $alt = $this->
lng->txt(
'obj_' . $condition[
'trigger_type']);
   578             $cgui->addItem(
"conditions[]", (
string) $condition_id, $title, $icon, $alt);
   581         $this->tpl->setContent($cgui->getHTML());
   584     public function delete(): 
void   587         if (!count($condition_ids)) {
   588             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'));
   593         foreach ($condition_ids as $condition_id) {
   594             $this->ch_obj->deleteCondition($condition_id);
   597         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'condition_deleted'), 
true);
   598         $this->
ctrl->redirect($this, 
'listConditions');
   612             count($conditions) === 1 &&
   613             count($optional_conditions) > 0
   616             foreach ($conditions as $condition) {
   625             $num_obligatory == count($conditions)
   628             foreach ($conditions as $condition) {
   632             $num_obligatory > count($conditions)
   638                 count($conditions) - 1
   645         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"condition_select_object"));
   648         $exp->setTypeWhiteList(array_merge(
   650             array(
"root", 
"cat", 
"grp", 
"fold", 
"crs", 
"prg")
   656         if (!$exp->handleCommand()) {
   657             $this->tpl->setContent($exp->getHTML());
   665             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   672         $this->tpl->setContent($form->getHTML());
   682             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'));
   688         if (!$form->checkInput()) {
   689             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   694         $this->ch_obj->setTargetObjId($this->
getTargetId());
   699                 $this->ch_obj->setReferenceHandlingType((
int) $form->getInput(
'ref_handling'));
   708         if ($trigger_obj !== null) {
   709             $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
   710             $this->ch_obj->setTriggerObjId($trigger_obj->getId());
   711             $this->ch_obj->setTriggerType($trigger_obj->getType());
   713         $this->ch_obj->setOperator($form->getInput(
'operator'));
   714         $this->ch_obj->setObligatory((
bool) $form->getInput(
'obligatory'));
   716         $this->ch_obj->setValue(
'');
   719         if ($this->ch_obj->getTriggerType() === 
'sahs') {
   721             $collection = $olp->getCollectionInstance();
   723                 $collection->delete();
   727             if (count($items_ids)) { 
   728                 $collection->activateEntries($items_ids->toArray());
   732         if (!$this->ch_obj->storeCondition()) {
   733             $this->tpl->setOnScreenMessage(
'failure', $this->ch_obj->getErrorMessage(), 
true);
   735             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'added_new_condition'), 
true);
   737         $this->
ctrl->redirect($this, 
'listConditions');
   748             if ($condition[
'operator'] === 
'not_member') {
   752             $cond[] = $condition;
   759         int $a_condition_id = 0,
   760         string $a_mode = 
'add'   767         $this->
ctrl->setParameter($this, 
'source_id', $a_source_id);
   768         $form->setFormAction($this->
ctrl->getFormAction($this));
   772         $form->addItem($info_source);
   776         $form->addItem($info_target);
   779         if ($a_condition_id) {
   780             $obl->setValue((
string) (
bool) $condition[
'obligatory']);
   784         $form->addItem($obl);
   789         if ($a_mode === 
'add') {
   790             $operators[
''] = $this->
lng->txt(
'select_one');
   792         foreach ($ch_obj->getOperatorsByTriggerType($trigger_type) as $operator) {
   793             $operators[$operator] = $this->
lng->txt(
'condition_' . $operator);
   795         $sel->setValue($condition[
'operator'] ?? 
'');
   796         $sel->setOptions($operators);
   797         $sel->setRequired(
true);
   798         $form->addItem($sel);
   805                 $this->
lng->txt(
'cond_ref_shared'),
   806                 (string) ilConditionHandler::SHARED_CONDITIONS
   808             $rad_opt->addOption($opt2);
   811                 $this->
lng->txt(
'cond_ref_unique'),
   814             $rad_opt->addOption($opt1);
   816             $form->addItem($rad_opt);
   820         if ($trigger_type === 
'sahs') {
   821             $this->
lng->loadLanguageModule(
'trac');
   824             $cus->
setInfo($this->
lng->txt(
'trac_lp_determination_info_sco'));
   825             $cus->setRequired(
true);
   828             $collection = $olp->getCollectionInstance();
   831                 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
   833                     if ($collection->isAssignedEntry($item_id)) {
   834                         $checked[] = $item_id;
   836                     $cus->addOption($sco);
   839             $cus->setValue($checked);
   840             $form->addItem($cus);
   845                 $form->setTitle($this->
lng->txt(
'rbac_edit_condition'));
   846                 $form->addCommandButton(
'updateCondition', $this->
lng->txt(
'save'));
   847                 $form->addCommandButton(
'listConditions', $this->
lng->txt(
'cancel'));
   852                 $form->setTitle($this->
lng->txt(
'add_condition'));
   853                 $form->addCommandButton(
'assign', $this->
lng->txt(
'save'));
   854                 $form->addCommandButton(
'selector', $this->
lng->txt(
'back'));
 
Interface GlobalHttpState. 
 
static get(string $a_var)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilGlobalTemplateInterface $tpl
 
class ilConditionHandlerGUI 
 
initConditionIdFromQuery()
 
static _getCondition(int $a_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
bool $automatic_validation
 
static _isReferenceHandlingOptional(string $a_type)
 
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
static lookupObligatoryConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id)
 
setTargetRefId(int $a_target_ref_id)
 
static updateObligatory(int $a_id, bool $a_status)
Toggle condition obligatory status. 
 
static calculatePersistedRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, string $a_target_obj_type='', bool $a_force_update=false)
 
__construct(int $a_ref_id=null)
 
showObligatoryForm(string $list_mode=self::LIST_MODE_ALL)
 
ilObjectDefinition $objectDefinition
 
loadLanguageModule(string $a_module)
Load language module. 
 
assign()
assign new trigger condition to target 
 
static lookupPersistedHiddenStatusByTarget(int $a_target_ref_id)
 
setTargetTitle(string $a_target_title)
 
setTargetId(int $a_target_id)
 
setAutomaticValidation(bool $a_status)
 
static _lookupObjId(int $ref_id)
 
ilConditionHandler $ch_obj
 
static saveNumberOfRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, int $a_num)
 
parses the objects.xml it handles the xml-description of all ilias objects 
 
static http()
Fetches the global http state from ILIAS. 
 
add(?ilPropertyFormGUI $form=null)
 
static _lookupTitle(int $obj_id)
 
ilConditionUtil $conditionUtil
 
Condition utility object Wraps some ilConditionHandler methods (which will become deprecated) Depende...
 
adjustConditionsAfterDeletion()
 
initConditionsIdsFromPost()
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static translateOperator(int $a_obj_id, string $a_operator)
 
static getPersistedOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
 
setTargetType(string $a_target_type)
 
edit(?ilPropertyFormGUI $form=null)
 
initFormCondition(int $a_source_id, int $a_condition_id=0, string $a_mode='add')
 
isTargetReferenced()
Check if target has refernce id. 
 
initObligatoryItemsFromPost()
 
static _lookupType(int $id, bool $reference=false)
 
const LIST_MODE_UNDEFINED
 
static getInstance(int $obj_id)
 
setBackButtons(array $a_btn_arr)
 
static set(string $a_var, $a_val)
Set a value. 
 
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object 
 
static _mode2Text(int $a_mode)