61 parent::__construct();
71 $this->check_input_called = $status;
77 protected function initForm()
79 if ($this->assignment->getId() > 0) {
80 $this->
setTitle($this->lng->txt(
'tos_form_edit_criterion_head'));
82 $this->
setTitle($this->lng->txt(
'tos_form_attach_criterion_head'));
87 $document = new \ilNonEditableValueGUI($this->lng->txt(
'tos_document'));
88 $document->setValue($this->document->getTitle());
91 $criteriaSelection = new \ilRadioGroupInputGUI($this->lng->txt(
'tos_form_criterion'),
'criterion');
92 $criteriaSelection->setRequired(
true);
93 $criteriaSelection->setValue($this->assignment->getCriterionId());
96 foreach ($this->criterionTypeFactory->getTypesByIdentMap() as $criterion) {
98 if (!$this->assignment->getId() && $first) {
99 $criteriaSelection->setValue($criterion->getTypeIdent());
103 $criterionGui = $criterion->ui($this->lng);
104 if ($this->assignment->getCriterionId() == $criterion->getTypeIdent()) {
105 $criterionGui->appendOption(
107 $this->assignment->getCriterionValue()
113 $this->
addItem($criteriaSelection);
124 return strlen($this->translatedError);
146 $this->criterionTypeFactory,
148 new \
ILIAS\Data\Factory(),
152 if (!$uniqueAssignmentConstraint->accepts($this->assignment)) {
153 $this->
getItemByPostVar(
'criterion')->setAlert($this->lng->txt(
'tos_criterion_assignment_must_be_unique_insert'));
154 if ($this->assignment->getId() > 0) {
155 $this->
getItemByPostVar(
'criterion')->setAlert($this->lng->txt(
'tos_criterion_assignment_must_be_unique_update'));
158 $this->translatedError = $this->lng->txt(
'form_input_not_valid');
163 if (!$this->assignment->getId()) {
164 $this->document->attachCriterion($this->assignment);
166 $this->document->save();
181 $criterionType = $this->criterionTypeFactory->findByTypeIdent($this->
getInput(
'criterion'));
182 $criterionGui = $criterionType->ui($this->lng);
184 $this->assignment->setCriterionId($criterionType->getTypeIdent());
185 $this->assignment->setCriterionValue($criterionGui->getConfigByForm($this));
187 if ($this->assignment->getId() > 0) {
188 $this->assignment->setLastModifiedUsrId($this->actor->getId());
190 $this->assignment->setOwnerUsrId($this->actor->getId());
194 $this->translatedError = $this->lng->txt(
'form_input_not_valid');
Class ilTermsOfServiceCriterionConfig.
Class ilTermsOfServiceDocumentCriterionAssignment.
Class ilTermsOfServiceDocument.
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
Interface ilTermsOfServiceCriterionTypeFactoryInterface.