/** * Init your form * */ protected function initForm() { $title = $this->setting->getId() ? sprintf($this->pl->txt('edit_setting'), $this->setting->getIdentifier()) : $this->pl->txt('add_new_custom_setting'); $this->setTitle($title); $item = new ilHiddenInputGUI('custom_setting_id'); $item->setValue($this->setting->getId()); $this->addItem($item); $item = new ilTextInputGUI($this->pl->txt('identifier'), 'identifier'); $item->setRequired(true); $item->setValue($this->setting->getIdentifier()); $item->setInfo(sprintf($this->pl->txt('identifier_info'), srCertificatePlaceholder::REGEX_VALID_IDENTIFIER)); $this->addItem($item); $item = new ilRadioGroupInputGUI($this->pl->txt('custom_setting_type'), 'setting_type_id'); $item->setRequired(true); $option = new ilRadioOption($this->pl->txt('custom_setting_type_' . srCertificateCustomTypeSetting::SETTING_TYPE_BOOLEAN), srCertificateCustomTypeSetting::SETTING_TYPE_BOOLEAN); $item->addOption($option); $option = new ilRadioOption($this->pl->txt('custom_setting_type_' . srCertificateCustomTypeSetting::SETTING_TYPE_SELECT), srCertificateCustomTypeSetting::SETTING_TYPE_SELECT); $subitem = new ilTextAreaInputGUI($this->pl->txt('custom_setting_type_2_data'), 'data'); $subitem->setValue($this->setting->getData()); $subitem->setInfo($this->pl->txt('custom_setting_type_2_data_info')); $option->addSubItem($subitem); $item->setValue($this->setting->getSettingTypeId()); $item->addOption($option); $this->addItem($item); $item = new ilTextInputGUI($this->pl->txt('default_value'), "value"); $item->setInfo($this->pl->txt('custom_setting_default_value_info')); $item->setValue($this->setting->getValue()); $this->addItem($item); $item = new ilMultiSelectInputGUI($this->pl->txt('editable_in'), 'editable_in'); $options = array(); foreach (srCertificateType::getAllAvailableObjectTypes() as $type) { $options[$type] = $type; } $item->setOptions($options); $item->setValue($this->setting->getEditableIn()); $this->addItem($item); // Update definitions, add settings if (!$this->setting->getId()) { $item = new ilCheckboxInputGUI($this->pl->txt('update_cert_definitions'), 'update_definitions'); $item->setInfo($this->pl->txt('custom_setting_update_cert_definitions_info')); $this->addItem($item); } // Label per language /** @var srCertificateType $type */ $type = $this->setting->getId() ? srCertificateType::find($this->setting->getTypeId()) : srCertificateType::find((int) $_GET['type_id']); foreach ($type->getLanguages() as $lang_code) { $this->addLabelInput($lang_code); } }