3 declare(strict_types=1);
    73         $this->
ctrl = $DIC->ctrl();
    74         $this->
lng = $DIC->language();
    75         $this->
lng->loadLanguageModule(
'rbac');
    76         $this->
lng->loadLanguageModule(
'cond');
    77         $this->tpl = $DIC->ui()->mainTemplate();
    78         $this->tree = $DIC->repositoryTree();
    79         $this->
access = $DIC->access();
    80         $this->
toolbar = $DIC->toolbar();
    81         $this->conditionUtil = $DIC->conditions()->util();
    83         $this->
http = $DIC->http();
    85         $this->ui_factory = $DIC->ui()->factory();
    86         $this->ui_renderer = $DIC->ui()->renderer();
    90             if ($target_obj !== null) {
   102         if ($this->
http->wrapper()->query()->has(
'condition_id')) {
   103             return $this->
http->wrapper()->query()->retrieve(
   113         if ($this->
http->wrapper()->post()->has(
'conditions')) {
   114             return SplFixedArray::fromArray(
   115                 $this->
http->wrapper()->post()->retrieve(
   117                     $this->
refinery->kindlyTo()->listOf(
   123         return new SplFixedArray(0);
   128         if ($this->
http->wrapper()->post()->has(
'item_ids')) {
   129             return SplFixedArray::fromArray(
   130                 $this->
http->wrapper()->post()->retrieve(
   132                     $this->
refinery->kindlyTo()->listOf(
   138         return new SplFixedArray(0);
   143         if ($this->
http->wrapper()->post()->has(
'obl')) {
   144             return SplFixedArray::fromArray(
   145                 $this->
http->wrapper()->post()->retrieve(
   147                     $this->
refinery->kindlyTo()->listOf(
   153         return new SplFixedArray(0);
   158         return $this->
http->wrapper()->post()->retrieve(
   161                 $this->refinery->kindlyTo()->string(),
   162                 $this->
refinery->always(self::LIST_MODE_UNDEFINED)
   169         if ($this->
http->wrapper()->query()->has(
'source_id')) {
   170             return $this->
http->wrapper()->query()->retrieve(
   178     public static function translateOperator(
int $a_obj_id, 
string $a_operator, 
string $value = 
''): string
   182         $lng = $DIC->language();
   183         switch ($a_operator) {
   188                 return $lng->
txt(
'condition_' . $a_operator) . 
': ' .
   193                 $value_arr = unserialize($value);
   194                 if ($value_arr !== 
false) {
   199                     $postfix .= $value_arr[
'min_percentage'] . 
' - ' . $value_arr[
'max_percentage'] . 
'%';
   201                 return $lng->
txt(
'condition_' . $a_operator) . $postfix;
   205                 return $lng->
txt(
'condition_' . $a_operator);
   233         if (!$this->
access->checkAccess(
'write', 
'', $this->getTargetRefId())) {
   234             $ilErr->raiseError($this->
lng->txt(
'permission_denied'), 
$ilErr->WARNING);
   237         $next_class = $this->
ctrl->getNextClass($this);
   238         $cmd = $this->
ctrl->getCmd();
   239         switch ($next_class) {
   251         $this->automatic_validation = $a_status;
   261         $this->target_id = $a_target_id;
   271         $this->target_ref_id = $a_target_ref_id;
   281         $this->target_type = $a_target_type;
   291         $this->target_title = $a_target_title;
   311         string $list_mode = self::LIST_MODE_ALL
   319         $form->setFormAction($this->
ctrl->getFormAction($this, 
'listConditions'));
   320         $form->setTitle($this->
lng->txt(
'precondition_obligatory_settings'));
   321         $form->addCommandButton(
'saveObligatorySettings', $this->
lng->txt(
'save'));
   325         $hide->setValue(
"1");
   326         $hide->setInfo($this->
lng->txt(
'rbac_precondition_hide_info'));
   327         $form->addItem($hide);
   330         $form->addItem($mode);
   333         $mall = 
new ilRadioOption($this->
lng->txt(
"rbac_precondition_mode_all"), 
"all");
   334         $mall->
setInfo($this->
lng->txt(
"rbac_precondition_mode_all_info"));
   335         $mode->addOption($mall);
   337         if (count($all) > 1) {
   339             $max = count($all) - 1;
   341             $msubset = 
new ilRadioOption($this->
lng->txt(
"rbac_precondition_mode_subset"), 
"subset");
   342             $msubset->
setInfo($this->
lng->txt(
"rbac_precondition_mode_subset_info"));
   343             $mode->addOption($msubset);
   346             $obl->setInfo($this->
lng->txt(
'precondition_num_optional_info'));
   352             $obl->setValue($num_required > 0 ? (
string) $num_required : null);
   353             $obl->setRequired(
true);
   355             $obl->setMinValue($min);
   356             $obl->setMaxValue($max);
   357             $msubset->addSubItem($obl);
   361         $old_mode->setValue($list_mode);
   362         $form->addItem($old_mode);
   370         if (!$condition_id) {
   371             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   375         $this->
ctrl->setParameter($this, 
'condition_id', $condition_id);
   379             $form = $this->
initFormCondition($condition[
'trigger_ref_id'], $condition_id, 
'edit');
   381         $this->tpl->setContent($form->getHTML());
   387         if (!$condition_id) {
   388             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   397             $condition[
'trigger_ref_id'],
   402         if (!$form->checkInput()) {
   403             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   408         $condition_handler->setOperator((
string) $form->getInput(
'operator'));
   409         $condition_handler->setObligatory((
bool) $form->getInput(
'obligatory'));
   411         $condition_handler->setValue(
'');
   414                 $condition_handler->setReferenceHandlingType((
int) $form->getInput(
'ref_handling'));
   421         $condition_handler->updateCondition($condition[
'id']);
   424         if ($condition[
'trigger_type'] === 
'sahs') {
   426             $collection = $olp->getCollectionInstance();
   428                 $collection->delete();
   431             if (count($item_ids)) { 
   432                 $collection->activateEntries($item_ids->toArray());
   436         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   437         $this->
ctrl->redirect($this, 
'listConditions');
   451             count($conditions) === 1 &&
   452             count($optional_conditions) > 0
   455             foreach ($conditions as $condition) {
   464             $num_obligatory == count($conditions)
   467             foreach ($conditions as $condition) {
   471             $num_obligatory > count($conditions)
   477                 count($conditions) - 1
   484         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"condition_select_object"));
   487         $exp->setTypeWhiteList(array_merge(
   489             array(
"root", 
"cat", 
"grp", 
"fold", 
"crs", 
"prg")
   495         if (!$exp->handleCommand()) {
   496             $this->tpl->setContent($exp->getHTML());
   504             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
   511         $this->tpl->setContent($form->getHTML());
   521             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'));
   527         if (!$form->checkInput()) {
   528             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   533         $this->ch_obj->setTargetObjId($this->
getTargetId());
   538                 $this->ch_obj->setReferenceHandlingType((
int) $form->getInput(
'ref_handling'));
   547         if ($trigger_obj !== null) {
   548             $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
   549             $this->ch_obj->setTriggerObjId($trigger_obj->getId());
   550             $this->ch_obj->setTriggerType($trigger_obj->getType());
   552         $this->ch_obj->setOperator($form->getInput(
'operator'));
   553         $this->ch_obj->setObligatory((
bool) $form->getInput(
'obligatory'));
   555         $this->ch_obj->setValue(
'');
   558         if ($this->ch_obj->getTriggerType() === 
'sahs') {
   560             $collection = $olp->getCollectionInstance();
   562                 $collection->delete();
   566             if (count($items_ids)) { 
   567                 $collection->activateEntries($items_ids->toArray());
   571         if (!$this->ch_obj->storeCondition()) {
   572             $this->tpl->setOnScreenMessage(
'failure', $this->ch_obj->getErrorMessage(), 
true);
   574             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'added_new_condition'), 
true);
   576         $this->
ctrl->redirect($this, 
'listConditions');
   587             if ($condition[
'operator'] === 
'not_member') {
   591             $cond[] = $condition;
   598         int $a_condition_id = 0,
   599         string $a_mode = 
'add'   606         $this->
ctrl->setParameter($this, 
'source_id', $a_source_id);
   607         $form->setFormAction($this->
ctrl->getFormAction($this));
   611         $form->addItem($info_source);
   615         $form->addItem($info_target);
   618         if ($a_condition_id) {
   619             $obl->setValue((
string) (
bool) $condition[
'obligatory']);
   623         $form->addItem($obl);
   628         if ($a_mode === 
'add') {
   629             $operators[
''] = $this->
lng->txt(
'select_one');
   631         foreach ($ch_obj->getOperatorsByTriggerType($trigger_type) as $operator) {
   632             $operators[$operator] = $this->
lng->txt(
'condition_' . $operator);
   634         $sel->setValue($condition[
'operator'] ?? 
'');
   635         $sel->setOptions($operators);
   636         $sel->setRequired(
true);
   637         $form->addItem($sel);
   644                 $this->
lng->txt(
'cond_ref_shared'),
   645                 (string) ilConditionHandler::SHARED_CONDITIONS
   647             $rad_opt->addOption($opt2);
   650                 $this->
lng->txt(
'cond_ref_unique'),
   653             $rad_opt->addOption($opt1);
   655             $form->addItem($rad_opt);
   659         if ($trigger_type === 
'sahs') {
   660             $this->
lng->loadLanguageModule(
'trac');
   663             $cus->
setInfo($this->
lng->txt(
'trac_lp_determination_info_sco'));
   664             $cus->setRequired(
true);
   667             $collection = $olp->getCollectionInstance();
   670                 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
   672                     if ($collection->isAssignedEntry($item_id)) {
   673                         $checked[] = $item_id;
   675                     $cus->addOption($sco);
   678             $cus->setValue($checked);
   679             $form->addItem($cus);
   684                 $form->setTitle($this->
lng->txt(
'rbac_edit_condition'));
   685                 $form->addCommandButton(
'updateCondition', $this->
lng->txt(
'save'));
   686                 $form->addCommandButton(
'listConditions', $this->
lng->txt(
'cancel'));
   691                 $form->setTitle($this->
lng->txt(
'add_condition'));
   692                 $form->addCommandButton(
'assign', $this->
lng->txt(
'save'));
   693                 $form->addCommandButton(
'selector', $this->
lng->txt(
'back'));
   706         $allow_optional_preconditions = (bool) count($optional_conditions);
   708             new ConditionTriggerProvider(
   713             $allow_optional_preconditions
   717         $add_condition_trigger_button = $this->ui_factory->button()->standard(
   718             $this->
lng->txt(
'add_condition'),
   719             $this->
ctrl->getLinkTarget($this, 
'selector')
   721         $add_condition_trigger_button = $this->ui_renderer->render($add_condition_trigger_button);
   726             $form_content = $this->ui_renderer->render([$form]);
   728         $this->tpl->setContent(
   729             $add_condition_trigger_button .
   737         $action = $this->
http->wrapper()->query()->retrieve(
   738             ConditionTriggerTableGUI::ACTION_TOKEN_NS,
   741                     $this->refinery->kindlyTo()->string(),
   750             default => $this->
ctrl->redirect($this, 
'listConditions')
   762         $compulsory_ids = $this->
http->wrapper()->query()->retrieve(
   763             ConditionTriggerTableGUI::ID_TOKEN_NS,
   766                     $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int()),
   772         if (count($compulsory_ids) > (count($all_conditions) - 2)) {
   773             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"rbac_precondition_minimum_optional"), 
true);
   774             $this->
ctrl->redirect($this, 
'listConditions');
   777         foreach ($all_conditions as $item) {
   779             if (in_array($item[
'condition_id'], $compulsory_ids)) {
   793         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   794         $this->
ctrl->redirect($this, 
'listConditions');
   799         $condition_trigger_ids = $this->
http->wrapper()->query()->retrieve(
   800             ConditionTriggerTableGUI::ID_TOKEN_NS,
   803                     $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int()),
   805                     $this->
refinery->custom()->transformation(
function ($var) {
   809                             (
string) $var[0] === 
'ALL_OBJECTS'   820         if ($condition_trigger_ids === [
'ALL_OBJECTS']) {
   821             $condition_trigger_ids = [];
   827                 $condition_trigger_ids[] = $condition[
'id'];
   832         foreach ($condition_trigger_ids as $condition_trigger_id) {
   834             $items[] = $this->ui_factory->modal()->interruptiveItem()->standard(
   835                 (
string) $condition_trigger_id,
   837                 ' (' . $this->
lng->txt(
'condition') . 
':' .
   838                 $this->
lng->txt(
'condition_' . $condition[
'operator']) . 
')'   842         $output = $this->ui_renderer->renderAsync(
   844                 $this->ui_factory->modal()->interruptive(
   845                     $this->
lng->txt(
'confirm'),
   846                     $this->
lng->txt(
'rbac_condition_delete_sure'),
   847                     $this->
ctrl->getFormAction($this, 
'deleteConditionTrigger')
   848                 )->withAffectedItems($items)
   852         $this->
http->saveResponse($this->
http->response()->withBody(
   853             Streams::ofString($output)
   855         $this->
http->sendResponse();
   856         $this->
http->close();
   861         $condition_trigger_ids = $this->
http->wrapper()->post()->retrieve(
   862             'interruptive_items',
   865                     $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int()),
   870         if (!count($condition_trigger_ids)) {
   871             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'));
   876         foreach ($condition_trigger_ids as $condition_id) {
   877             $this->ch_obj->deleteCondition($condition_id);
   880         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'condition_deleted'), 
true);
   881         $this->
ctrl->redirect($this, 
'listConditions');
   897         $old_status = $this->ui_factory->input()->field()->hidden()->withValue(
   898             (
string) (count($optional_conditions) ? self::LIST_MODE_SUBSET : self::LIST_MODE_ALL)
   901         $hidden = $this->ui_factory->input()->field()->checkbox(
   902             $this->
lng->txt(
'rbac_precondition_hide'),
   903             $this->
lng->txt(
'rbac_precondition_hide_info')
   906         $condition_mode_all = $this->ui_factory->input()->field()->group(
   908             $this->
lng->txt(
'rbac_precondition_mode_all'),
   909             $this->
lng->txt(
'rbac_precondition_mode_all_info')
   911         $list_mode_items[self::LIST_MODE_ALL] = $condition_mode_all;
   914         if (count($all_conditions) > 1) {
   920             $subset_limit[
'num_compulsory'] =
   921                 $this->ui_factory->input()
   924                                      $this->
lng->txt(
'precondition_num_obligatory'),
   925                                      $this->
lng->txt(
'precondition_num_optional_info')
   927                                  ->
withValue($num_required > 0 ? $num_required : null)
   928                                  ->withAdditionalTransformation(
   929                                      $this->
refinery->logical()->parallel(
   931                                              $this->
refinery->int()->isGreaterThan(0),
   932                                              $this->
refinery->int()->isLessThan(count($all_conditions))
   937         if (count($all_conditions) > 1) {
   938             $condition_mode_subset = $this->ui_factory->input()->field()->group(
   940                 $this->
lng->txt(
'rbac_precondition_mode_subset'),
   941                 $this->
lng->txt(
'rbac_precondition_mode_subset_info')
   943             $list_mode_items[self::LIST_MODE_SUBSET] = $condition_mode_subset;
   946         $list_mode = $this->ui_factory->input()->field()->switchableGroup(
   948             $this->
lng->txt(
'rbac_precondition_mode')
   954             )) ? self::LIST_MODE_SUBSET : self::LIST_MODE_ALL
   957         $main_section = $this->ui_factory->input()->field()->section(
   959                 'old_status' => $old_status,
   960                 'hidden_status' => $hidden,
   961                 'list_mode' => $list_mode
   963             $this->
lng->txt(
'precondition_obligatory_settings')
   965         $form = $this->ui_factory->input()->container()->form()->standard(
   966             $this->
ctrl->getFormAction($this, 
'saveCompulsoryForm'),
   968                 'compulsory_configuration' => $main_section
   972             $form = $form->withRequest($this->
http->request());
   980         $data = $form->getData();
   982             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   988         $cond->updateHiddenStatus(
$data[
'compulsory_configuration'][
'hidden_status']);
   990         $old_status = 
$data[
'compulsory_configuration'][
'old_status'];
   991         switch (
$data[
'compulsory_configuration'][
'list_mode'][0]) {
   992             case self::LIST_MODE_ALL:
   993                 if ($old_status != self::LIST_MODE_ALL) {
  1000                     foreach ($optional_conditions as $item) {
  1005             case self::LIST_MODE_SUBSET:
  1006                 $num_required = 
$data[
'compulsory_configuration'][
'list_mode'][1][
'num_compulsory'];
  1007                 if ($old_status != self::LIST_MODE_SUBSET) {
  1013                     foreach ($all_conditions as $item) {
  1024         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
  1025         $this->
ctrl->redirect($this, 
'listConditions');
  1032             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
  1036         $this->
ctrl->setParameter($this, 
'source_id', $source_id);
  1038         $this->tpl->setContent($this->ui_renderer->render([$form]));
  1043         if ($this->
http->wrapper()->query()->has(ConditionTriggerTableGUI::ID_TOKEN_NS)) {
  1044             $condition_id = $this->
http->wrapper()->query()->retrieve(
  1045                 ConditionTriggerTableGUI::ID_TOKEN_NS,
  1048                         $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int()),
  1053             $condition_id = end($condition_id);
  1057         if (!$condition_id) {
  1058             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
  1063         $this->
ctrl->setParameter($this, 
'condition_id', $condition_id);
  1066             $condition[
'trigger_ref_id'],
  1070         $this->tpl->setContent($this->ui_renderer->render([$form]));
  1080         if ($mode == 
'edit') {
  1081             $main_section_items[
'obligatory'] = $this->ui_factory->input()->field()->hidden()
  1082                 ->withValue($condition[
'obligatory']);
  1086         foreach ($condition_handler->getOperatorsByTriggerType($trigger_type) as $operator) {
  1087             switch ($operator) {
  1089                     $group_items[$operator] = $this->ui_factory->input()->field()->group(
  1097                         $this->
lng->txt(
'condition_' . $operator)
  1102                     $this->
lng->loadLanguageModule(
'trac');
  1105                     $label = $this->
lng->txt(
'condition_' . $operator) . 
': ' .
  1107                     $group_items[$operator] = $this->ui_factory->input()->field()->group([], $label);
  1111                     $group_items[$operator] = $this->ui_factory->input()->field()->group(
  1113                         $this->
lng->txt(
'condition_' . $operator)
  1118         $main_section_items[
'operator'] = $this->ui_factory->input()->field()->switchableGroup(
  1120             $this->
lng->txt(
'condition')
  1121         )->withRequired(
true);
  1122         if ($mode == 
'edit') {
  1123             $main_section_items[
'operator'] = $main_section_items[
'operator']->withValue((
string) ($condition[
'operator']));
  1127         $main_section = $this->ui_factory->input()->field()->section(
  1128             $main_section_items,
  1132         $form = $this->ui_factory->input()->container()->form()->standard(
  1133             $this->
ctrl->getLinkTarget($this, $mode === 
'add' ? 
'saveConditionTrigger' : 
'updateConditionTrigger'),
  1135                 'condition_configuration' => $main_section
  1138         if ($with_request) {
  1139             $form = $form->withRequest($this->
http->request());
  1150                 $select_options = [];
  1153                     $select_options[$objective_id] = $objective->getTitle();
  1155                 $this->
lng->loadLanguageModule(
'crs');
  1156                 $sections[
'objective'] = $this->ui_factory->input()->field()->select(
  1157                     $this->
lng->txt(
'crs_objectives'),
  1159                 )->withRequired(
true);
  1160                 if ($stored_objective_id > 0) {
  1161                     $sections[
'objective'] = $sections[
'objective']->withValue($stored_objective_id);
  1165         $sections[
'min'] = $this->ui_factory->input()->field()->numeric(
  1166             $this->
lng->txt(
'precondition_operator_range_min'),
  1168             $this->
refinery->logical()->parallel(
  1170                     $this->
refinery->int()->isGreaterThanOrEqual(0),
  1171                     $this->
refinery->int()->isLessThanOrEqual(100)
  1174         )->withRequired(
true)
  1175          ->withValue($stored_min);
  1176         $sections[
'max'] = $this->ui_factory->input()->field()->numeric(
  1177             $this->
lng->txt(
'precondition_operator_range_max'),
  1179             $this->
refinery->logical()->parallel(
  1181                     $this->
refinery->int()->isGreaterThan(0),
  1182                     $this->
refinery->int()->isLessThanOrEqual(100)
  1185         )->withRequired(
true)
  1186          ->withValue($stored_max);
  1187         return $this->ui_factory->input()->field()->section(
  1190         )->withAdditionalTransformation(
  1191             $this->
refinery->custom()->constraint(
  1192                 function ($min_max) {
  1193                     return $min_max[
'min'] < $min_max[
'max'];
  1195                 $this->
lng->txt(
'precondition_operator_range_err_min_max')
  1207                 'objective' => $data[
'condition_configuration'][
'operator'][1][
'result_range_percentage'][
'objective'] ?? null,
  1208                 'min_percentage' => $data[
'condition_configuration'][
'operator'][1][
'result_range_percentage'][
'min'],
  1209                 'max_percentage' => $data[
'condition_configuration'][
'operator'][1][
'result_range_percentage'][
'max']
  1217         if (($condition[
'value'] ?? 
'') === 
'') {
  1220         $value_arr = unserialize($condition[
'value']);
  1221         if ($value_arr === 
false) {
  1225             $value_arr[
'objective'] ?? 0,
  1226             $value_arr[
'min_percentage'] ?? 0,
  1227             $value_arr[
'max_percentage'] ?? 0
  1234         if (!$condition_id) {
  1235             $this->tpl->setOnScreenMessage(
'failure', 
"Missing id: condition_id");
  1241         $data = $form->getData();
  1243             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
  1250         $condition_handler->setOperator(
$data[
'condition_configuration'][
'operator'][0]);
  1251         $condition_handler->setObligatory((
bool) 
$data[
'condition_configuration'][
'obligatory']);
  1254         $condition_handler->updateCondition($condition_id);
  1255         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
  1256         $this->
ctrl->redirect($this, 
'listConditions');
  1294             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_condition_selected'), 
true);
  1295             $this->
ctrl->redirect($this, 
'listConditions');
  1300         $data = $form->getData();
  1302             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
  1312         if ($trigger instanceof 
ilObject) {
  1313             $condition->setTriggerRefId($trigger->getRefId());
  1314             $condition->setTriggerObjId($trigger->getId());
  1315             $condition->setTriggerType($trigger->getType());
  1317         $condition->setOperator(
$data[
'condition_configuration'][
'operator'][0]);
  1318         $condition->setObligatory((
bool) (
$data[
'condition_configuration'][
'obligatory'] ?? 
true));
  1322         if (!$condition->storeCondition()) {
  1323             $this->tpl->setOnScreenMessage(
'failure', $condition->getErrorMessage(), 
true);
  1325             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'added_new_condition'), 
true);
  1327         $this->
ctrl->redirect($this, 
'listConditions');
 
confirmDeleteConditionTrigger()
 
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
 
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...
 
const OPERATOR_RESULT_RANGE_PERCENTAGE
 
editConditionTrigger(bool $with_request=false)
 
bool $automatic_validation
 
static _isReferenceHandlingOptional(string $a_type)
 
static translateOperator(int $a_obj_id, string $a_operator, string $value='')
 
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 _getObjectiveIds(int $course_id, bool $a_activated_only=false)
 
handleConditionTriggerTableActions()
 
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)
 
static http()
Fetches the global http state from ILIAS. 
 
initCompulsoryForm(bool $with_request=false)
 
addConditionTrigger(bool $with_request=false)
 
add(?ilPropertyFormGUI $form=null)
 
static _lookupTitle(int $obj_id)
 
ilConditionUtil $conditionUtil
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
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 
 
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
 
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
 
const IL_CRS_VIEW_OBJECTIVE
 
initRangeConditionInputItem(int $trigger_ref_id, int $trigger_obj_id, array $condition)
 
extractValueOptionsFromInput(array $data)
 
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)
 
initConditionTriggerForm(bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
 
extractValueOptionsFromCondition(array $condition)
 
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 
 
listConditions(bool $load_form_with_request=false)
 
static _mode2Text(int $a_mode)