/** * Init form */ protected function initForm() { $type = $this->placeholder->getCertificateType(); $this->setFormAction($this->ctrl->getFormAction($this->parent_gui)); $title = $this->placeholder->getId() ? $this->pl->txt('edit_placeholder') : $this->pl->txt('add_placeholder'); $this->setTitle($title); $item = new ilTextInputGUI($this->pl->txt('identifier'), 'identifier'); $item->setRequired(true); $item->setValue($this->placeholder->getIdentifier()); $item->setInfo(sprintf($this->pl->txt('identifier_info'), srCertificatePlaceholder::REGEX_VALID_IDENTIFIER)); $this->addItem($item); $item = new ilNumberInputGUI($this->pl->txt('max_characters'), 'max_characters'); $item->setRequired(true); $item->setSize(2); $item->setInfo($this->pl->txt('max_characters_info')); $item->setValue($this->placeholder->getMaxCharactersValue()); $this->addItem($item); $item = new ilCheckboxInputGUI($this->pl->txt('mandatory'), 'mandatory'); if ($this->placeholder->getIsMandatory()) { $item->setChecked(true); } $this->addItem($item); $item = new ilMultiSelectInputGUI($this->pl->txt('editable_in'), 'editable_in'); $options = array(); foreach ($type->getAllAvailableObjectTypes() as $obj_type) { $options[$obj_type] = $obj_type; } $item->setOptions($options); $item->setValue($this->placeholder->getEditableIn()); $this->addItem($item); $item = new ilHiddenInputGUI('placeholder_id'); $item->setValue($this->placeholder->getId()); $this->addItem($item); if (!$this->placeholder->getId()) { $item = new ilCheckboxInputGUI($this->pl->txt('update_cert_definitions'), 'update_definitions'); $item->setInfo($this->pl->txt('update_cert_definitions_info')); $this->addItem($item); } foreach ($type->getLanguages() as $lang_code) { $this->addLanguageInput($lang_code); } $command = $this->placeholder->getId() ? 'updatePlaceholder' : 'createPlaceholder'; $this->addCommandButton($command, $this->lng->txt('save')); }