/** * Init form */ protected function initForm() { $this->setFormAction($this->ctrl->getFormAction($this->parent_gui)); $title = sprintf($this->pl->txt('edit_setting'), $this->pl->txt("setting_id_{$this->identifier}")); $this->setTitle($title); $item = new ilHiddenInputGUI('identifier'); $item->setValue($this->identifier); $this->addItem($item); $item = $this->getInputByIdentifier(); if ($item !== null) { $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->type->getSettingByIdentifier($this->identifier)->getEditableIn()); $this->addItem($item); $this->addCommandButton('updateSetting', $this->lng->txt('save')); }
/** * Init form */ protected function initForm() { $this->setFormAction($this->ctrl->getFormAction($this->parent_gui)); $title = $this->isNew ? $this->pl->txt('add_new_type') : $this->pl->txt('edit_type'); $this->setTitle($title); $item = new ilTextInputGUI($this->lng->txt('title'), 'title'); $item->setRequired(true); $item->setValue($this->type->getTitle()); $this->addItem($item); $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $item->setValue($this->type->getDescription()); $this->addItem($item); $item = new ilMultiSelectInputGUI($this->lng->txt('languages'), 'languages'); $item->setWidth(self::WIDTH_MULTISELECT_INPUT); $langs = $this->lng->getInstalledLanguages(); $options = array(); foreach ($langs as $lang_code) { $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}"); } $item->setOptions($options); $item->setValue($this->type->getLanguages()); $item->setRequired(true); $this->addItem($item); $item = new ilMultiSelectInputGUI($this->lng->txt('roles'), 'roles'); $item->setWidth(self::WIDTH_MULTISELECT_INPUT); $roles = $this->rbac->getRolesByFilter(ilRbacReview::FILTER_ALL, 0, ''); $options = array(); $hide_roles = array(14, 5); foreach ($roles as $role) { if (strpos($role['title'], 'il_') === 0 || in_array($role['obj_id'], $hide_roles)) { // Don't show auto-generated roles. If this takes to much performance, write query... continue; } $options[$role['obj_id']] = $role['title']; } $item->setOptions($options); $item->setValue($this->type->getRoles()); $item->setInfo($this->pl->txt('roles_info')); $this->addItem($item); $item = new ilMultiSelectInputGUI($this->pl->txt('available_objects'), 'available_objects'); $item->setWidth(self::WIDTH_MULTISELECT_INPUT); $options = array(); foreach (srCertificateType::getAllAvailableObjectTypes() as $type) { $options[$type] = $type; } $item->setOptions($options); $item->setValue($this->type->getAvailableObjects()); $item->setRequired(true); $item->setInfo($this->pl->txt('available_objects_info')); $this->addItem($item); $this->addCommandButton('saveType', $this->lng->txt('save')); }
/** * 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); } }