/** * Save obligatory settings */ protected function saveObligatorySettings() { $form = $this->showObligatoryForm(); if ($form->checkInput()) { $old_mode = $form->getInput("old_list_mode"); switch ($form->getInput("list_mode")) { case "all": if ($old_mode != "all") { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; $optional_conditions = ilConditionHandler::getOptionalConditionsOfTarget($this->getTargetRefId(), $this->getTargetId(), $this->getTargetType()); // Set all optional conditions to obligatory foreach ((array) $optional_conditions as $item) { ilConditionHandler::updateObligatory($item["condition_id"], true); } } break; case "subset": $num_req = $form->getInput('required'); if ($old_mode != "subset") { $all_conditions = ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(), $this->getTargetId(), $this->getTargetType()); foreach ($all_conditions as $item) { ilConditionHandler::updateObligatory($item["condition_id"], false); } $num_req = 1; } ilConditionHandler::saveNumberOfRequiredTriggers($this->getTargetRefId(), $this->getTargetId(), $num_req); break; } $cond = new ilConditionHandler(); $cond->setTargetRefId($this->getTargetRefId()); $cond->updateHiddenStatus((int) $form->getInput('hidden')); ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'listConditions'); } $form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_check_input')); $this->tpl->setContent($form->getHTML()); }