1 <?php declare(strict_types=1);
73 $this->check_input_called = $status;
79 protected function initForm() :
void 81 if ($this->assignment->getId() > 0) {
82 $this->
setTitle($this->lng->txt(
'tos_form_edit_criterion_head'));
84 $this->
setTitle($this->lng->txt(
'tos_form_attach_criterion_head'));
90 $document->setValue($this->document->getTitle());
93 $criteriaSelection =
new ilRadioGroupInputGUI($this->lng->txt(
'tos_form_criterion'),
'criterion');
95 $criteriaSelection->setValue($this->assignment->getCriterionId());
98 foreach ($this->criterionTypeFactory->getTypesByIdentMap() as $criterion) {
100 if (!$this->assignment->getId() && $first) {
101 $criteriaSelection->setValue($criterion->getTypeIdent());
105 $criterionGui = $criterion->ui($this->lng);
106 if ($this->assignment->getCriterionId() == $criterion->getTypeIdent()) {
107 $criterionGui->appendOption(
109 $this->assignment->getCriterionValue()
115 $this->
addItem($criteriaSelection);
126 return strlen($this->translatedError) > 0;
149 $this->criterionTypeFactory,
155 if (!$uniqueAssignmentConstraint->accepts($this->assignment)) {
156 $this->
getItemByPostVar(
'criterion')->setAlert($this->lng->txt(
'tos_criterion_assignment_must_be_unique_insert'));
157 if ($this->assignment->getId() > 0) {
158 $this->
getItemByPostVar(
'criterion')->setAlert($this->lng->txt(
'tos_criterion_assignment_must_be_unique_update'));
161 $this->translatedError = $this->lng->txt(
'form_input_not_valid');
166 if (!$this->assignment->getId()) {
167 $this->document->attachCriterion($this->assignment);
169 $this->document->save();
184 $criterionType = $this->criterionTypeFactory->findByTypeIdent($this->
getInput(
'criterion'));
185 $criterionGui = $criterionType->ui($this->lng);
187 $this->assignment->setCriterionId($criterionType->getTypeIdent());
188 $this->assignment->setCriterionValue($criterionGui->getConfigByForm($this));
190 if ($this->assignment->getId() > 0) {
191 $this->assignment->setLastModifiedUsrId($this->actor->getId());
193 $this->assignment->setOwnerUsrId($this->actor->getId());
197 $this->translatedError = $this->lng->txt(
'form_input_not_valid');
Class ilTermsOfServiceCriterionConfig.
Class ilTermsOfServiceDocumentCriterionAssignment.
Class ilTermsOfServiceDocument.
This class represents a non editable value in a property form.
__construct(Container $dic, ilPlugin $plugin)
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
Interface ilTermsOfServiceCriterionTypeFactoryInterface.