/** * Init category mapping form * @return */ protected function initCategoryMappingForm($a_mode = 'add') { global $ilDB; if (is_object($this->form)) { return true; } include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php'; $this->form = new ilPropertyFormGUI(); if ($a_mode == 'add') { $this->form->setTitle($this->lng->txt('ecs_new_category_mapping')); $this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping')); $this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save')); $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel')); } else { $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping')); $this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping')); $this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save')); $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel')); } $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id'); $imp->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'import_id'); $tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId()); if ($this->settings->getImportId()) { $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId())); } $imp->setHTML($tpl->get()); $imp->setInfo($this->lng->txt('ecs_import_id_info')); $this->form->addItem($imp); include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php'; $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field'); $select->setValue($this->rule->getFieldName()); $select->setRequired(true); $select->setOptions(ilECSCategoryMapping::getPossibleFields()); $this->form->addItem($select); // Value $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type'); $value->setValue($this->rule->getMappingType()); $value->setRequired(true); $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), ilECSCategoryMappingRule::TYPE_FIXED); $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info')); $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value'); $fixed_val->setValue($this->rule->getMappingValue()); $fixed_val->setMaxLength(255); $fixed_val->setSize(40); $fixed_val->setRequired(true); $fixed->addSubItem($fixed_val); $value->addOption($fixed); $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), ilECSCategoryMappingRule::TYPE_DURATION); $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info')); $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin'); $dur_start->setDate($this->rule->getDateRangeStart()); $duration->addSubItem($dur_start); $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end'); $dur_end->setDate($this->rule->getDateRangeEnd()); $duration->addSubItem($dur_end); $value->addOption($duration); $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), ilECSCategoryMappingRule::TYPE_BY_TYPE); $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info')); $options = ilECSUtils::getPossibleRemoteTypes(true); $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type'); $types->setOptions($options); $types->setValue($this->rule->getByType()); $types->setRequired(true); $type->addSubitem($types); $value->addOption($type); $this->form->addItem($value); }
private function initForm() { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save')); $this->form_gui->setTitle($this->lng->txt('ldap_configure')); $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active'); $active->setValue(1); $this->form_gui->addItem($active); $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds'); $ds->setValue(1); $ds->setInfo($this->lng->txt('ldap_as_ds_info')); $this->form_gui->addItem($ds); $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name'); $servername->setRequired(true); $servername->setInfo($this->lng->txt('ldap_server_name_info')); $servername->setSize(32); $servername->setMaxLength(32); $this->form_gui->addItem($servername); $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url'); $serverurl->setRequired(true); $serverurl->setInfo($this->lng->txt('ldap_server_url_info')); $serverurl->setSize(64); $serverurl->setMaxLength(255); $this->form_gui->addItem($serverurl); $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version'); $version->setOptions(array(2 => 2, 3 => 3)); $version->setInfo($this->lng->txt('ldap_server_version_info')); $this->form_gui->addItem($version); $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn'); $basedsn->setRequired(true); $basedsn->setSize(64); $basedsn->setMaxLength(255); $this->form_gui->addItem($basedsn); $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals'); $referrals->setValue(1); $referrals->setInfo($this->lng->txt('ldap_referrals_info')); $this->form_gui->addItem($referrals); $section_security = new ilFormSectionHeaderGUI(); $section_security->setTitle($this->lng->txt('ldap_server_security_settings')); $this->form_gui->addItem($section_security); $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls'); $tls->setValue(1); $this->form_gui->addItem($tls); $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type'); $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), IL_LDAP_BIND_ANONYMOUS); $binding->addOption($anonymous); $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), IL_LDAP_BIND_USER); $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn'); $dn->setSize(64); $dn->setMaxLength(255); $user->addSubItem($dn); $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass'); $pass->setSkipSyntaxCheck(true); $pass->setSize(12); $pass->setMaxLength(36); $user->addSubItem($pass); $binding->addOption($user); $this->form_gui->addItem($binding); $section_auth = new ilFormSectionHeaderGUI(); $section_auth->setTitle($this->lng->txt('ldap_authentication_settings')); $this->form_gui->addItem($section_auth); $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base'); $search_base->setInfo($this->lng->txt('ldap_search_base_info')); $search_base->setSize(64); $search_base->setMaxLength(255); $this->form_gui->addItem($search_base); $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope'); $user_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub'))); $user_scope->setInfo($this->lng->txt('ldap_user_scope_info')); $this->form_gui->addItem($user_scope); $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute'); $user_attribute->setSize(16); $user_attribute->setMaxLength(64); $user_attribute->setRequired(true); $this->form_gui->addItem($user_attribute); $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter'); $filter->setInfo($this->lng->txt('ldap_filter_info')); $filter->setSize(64); $filter->setMaxLength(512); $this->form_gui->addItem($filter); $section_restrictions = new ilFormSectionHeaderGUI(); $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions')); $this->form_gui->addItem($section_restrictions); $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn'); $group_dn->setInfo($this->lng->txt('ldap_group_dn_info')); $group_dn->setSize(64); $group_dn->setMaxLength(255); $this->form_gui->addItem($group_dn); $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope'); $group_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub'))); $group_scope->setInfo($this->lng->txt('ldap_group_scope_info')); $this->form_gui->addItem($group_scope); $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter'); $group_filter->setInfo($this->lng->txt('ldap_group_filter_info')); $group_filter->setSize(64); $group_filter->setMaxLength(255); $this->form_gui->addItem($group_filter); $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member'); $group_member->setInfo($this->lng->txt('ldap_group_member_info')); $group_member->setSize(32); $group_member->setMaxLength(255); $this->form_gui->addItem($group_member); $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn'); #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info')); $this->form_gui->addItem($group_member_isdn); #$group_member->addSubItem($group_member_isdn); $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group'); $group->setInfo($this->lng->txt('ldap_group_name_info')); $group->setSize(32); $group->setMaxLength(255); $this->form_gui->addItem($group); $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute'); $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info')); $group_atrr->setSize(16); $group_atrr->setMaxLength(64); $this->form_gui->addItem($group_atrr); $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional'); $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional')); $group_optional->setInfo($this->lng->txt('ldap_group_optional_info')); $group_optional->setValue(1); $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter'); $group_user_filter->setSize(64); $group_user_filter->setMaxLength(255); $group_optional->addSubItem($group_user_filter); $this->form_gui->addItem($group_optional); $section_sync = new ilFormSectionHeaderGUI(); $section_sync->setTitle($this->lng->txt('ldap_user_sync')); $this->form_gui->addItem($section_sync); $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync')); $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login'); $sync_on_login->setValue(1); $ci_gui->addSubItem($sync_on_login); $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron'); $sync_per_cron->setValue(1); $ci_gui->addSubItem($sync_per_cron); $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info')); $this->form_gui->addItem($ci_gui); $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role'); $global_role->setOptions($this->prepareRoleSelect(false)); $global_role->setInfo($this->lng->txt('ldap_global_role_info')); $this->form_gui->addItem($global_role); $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration'); $migr->setInfo($this->lng->txt('auth_ldap_migration_info')); $migr->setValue(1); $this->form_gui->addItem($migr); include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php"; ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_LDAP, $this->form_gui, ilAdministrationSettingsFormHandler::getSettingsGUIInstance("auth")); $this->form_gui->addCommandButton('save', $this->lng->txt('save')); }
/** * Init settings form */ protected function initFormCSettings() { include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php'; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('settings')); // individual course allocation $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled'); $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled()); $form->addItem($check); // add default container $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat'); $imp->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'default_cat'); $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory(); $tpl->setVariable('PROPERTY_VALUE', $default); if ($default) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $imp->setHtml($tpl->get()); $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info')); $form->addItem($imp); // all in one category $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone'); $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled()); $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info')); $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat'); $allinone_cat->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'allinone_cat'); $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory(); $tpl->setVariable('PROPERTY_VALUE', $cat); if ($cat) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $allinone_cat->setHtml($tpl->get()); $allinone->addSubItem($allinone_cat); $form->addItem($allinone); // multiple attributes $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple'); $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled()); // attribute selection include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php'; $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts'); $attributes->setMulti(true); $attributes->setValue(ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getAttributeValues()); $attributes->setRequired(true); $attributes->setOptions(ilECSMappingUtils::getCourseMappingFieldSelectOptions()); $multiple->addSubItem($attributes); $form->addItem($multiple); // role mapping $rm = new ilFormSectionHeaderGUI(); $rm->setTitle($this->lng->txt('ecs_role_mappings')); $form->addItem($rm); $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings(); include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) { $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), $name); $role_map->setValue($mapping_defs[$name]); $role_map->setSize(32); $role_map->setMaxLength(64); $role_map->setRequired($info['required']); $form->addItem($role_map); } $form->addCommandButton('cUpdateSettings', $this->lng->txt('save')); $form->addCommandButton('cSettings', $this->lng->txt('cancel')); return $form; }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // subtype $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type"); $subtype->setRequired(false); $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr"); foreach ($subtypes as $idx => $st) { $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx)); } $a_form->addItem($subtype); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_appearance")); $a_form->addItem($header); // column separators $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators"); $column_separators->setValue(1); $column_separators->setInfo($this->lng->txt("matrix_column_separators_description")); $column_separators->setRequired(false); $a_form->addItem($column_separators); // row separators $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators"); $row_separators->setValue(1); $row_separators->setInfo($this->lng->txt("matrix_row_separators_description")); $row_separators->setRequired(false); $a_form->addItem($row_separators); // neutral column separators $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator"); $neutral_column_separator->setValue(1); $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description")); $neutral_column_separator->setRequired(false); $a_form->addItem($neutral_column_separator); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_columns")); $a_form->addItem($header); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $columns = new ilCategoryWizardInputGUI("", "columns"); $columns->setRequired(false); $columns->setAllowMove(true); $columns->setShowWizard(true); $columns->setShowNeutralCategory(true); $columns->setDisabledScale(false); $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer')); $columns->setCategoryText($this->lng->txt('matrix_standard_answers')); $columns->setShowSavePhrase(true); $a_form->addItem($columns); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_column_settings")); $a_form->addItem($header); // bipolar adjectives $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives")); $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description")); // left pole $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1"); $bipolar1->setRequired(false); $bipolar->addSubItem($bipolar1); // right pole $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2"); $bipolar2->setRequired(false); $bipolar->addSubItem($bipolar2); $a_form->addItem($bipolar); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_rows")); $a_form->addItem($header); // matrix rows include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php"; $rows = new ilMatrixRowWizardInputGUI("", "rows"); $rows->setRequired(false); $rows->setAllowMove(true); $rows->setLabelText($this->lng->txt('label')); $rows->setUseOtherAnswer(true); $a_form->addItem($rows); // values $subtype->setValue($this->object->getSubtype()); $column_separators->setChecked($this->object->getColumnSeparators()); $row_separators->setChecked($this->object->getRowSeparators()); $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator()); if (!$this->object->getColumnCount()) { $this->object->columns->addCategory(""); } $columns->setValues($this->object->getColumns()); $bipolar1->setValue($this->object->getBipolarAdjective(0)); $bipolar2->setValue($this->object->getBipolarAdjective(1)); if ($this->object->getRowCount() == 0) { $this->object->getRows()->addCategory(""); } $rows->setValues($this->object->getRows()); }
/** * Init the form to change the settings value type * * @return object property form to change settings type */ function initSettingsTypeForm() { include_once "./Services/Administration/classes/class.ilSetting.php"; $type = ilSetting::_getValueType(); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setId("settings_type"); $form->setTitle($this->lng->txt("settings_type")); $form->setFormAction("setup.php?cmd=gateway"); $item = new ilNonEditableValueGUI($this->lng->txt('settings_type_current')); $item->setValue(strtoupper($type)); if ($type == "clob") { $item->setInfo($this->lng->txt('settings_info_clob')); $form->addCommandButton("showLongerSettings", $this->lng->txt("settings_show_longer")); $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_text")); } else { $item->setInfo($this->lng->txt('settings_info_text')); $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_clob")); } $form->addItem($item); if (is_array($this->longer_settings)) { $item = new ilCustomInputGUI($this->lng->txt('settings_longer_values')); if (count($this->longer_settings)) { foreach ($this->longer_settings as $row) { $subitem = new ilCustomInputGUI(sprintf($this->lng->txt('settings_key_info'), $row['module'], $row['keyword'])); $subitem->setInfo($row['value']); $item->addSubItem($subitem); } } else { $item->setHTML($this->lng->txt('settings_no_longer_values')); } $form->addItem($item); } return $form; }
/** * {@inheritdoc} */ public function buildForm(ilPropertyFormGUI $form) { /** * @var $lng ilLanguage */ global $lng; $header = new ilFormSectionHeaderGUI(); $header->setTitle($lng->txt('passwd_encoder_' . $this->getName())); $form->addItem($header); $salt = new ilCustomInputGUI($lng->txt('passwd_encoder_bcrypt_client_salt'), 'bcrypt_salt'); $info = array($lng->txt('passwd_encoder_client_bcrypt_salt_info')); if (!$this->isBcryptSupported()) { $info[] = sprintf($lng->txt('passwd_encoder_client_bcrypt_salt_info_php537'), PHP_VERSION); } if (1 == count($info)) { $salt->setInfo(current($info)); } else { $salt->setInfo('<ul><li>' . implode('</li><li>', $info) . '</li></ul>'); } $salt->setHtml($this->getClientSaltLocation()); $form->addItem($salt); }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("multiplechoice"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setValue($this->object->label); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setValue($this->object->getDescription()); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7"); $form->addItem($question); // subtype $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type"); $subtype->setRequired(false); $subtype->setValue($this->object->getSubtype()); $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr"); foreach ($subtypes as $idx => $st) { $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx)); } $form->addItem($subtype); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_appearance")); $form->addItem($header); // column separators $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators"); $column_separators->setValue(1); $column_separators->setInfo($this->lng->txt("matrix_column_separators_description")); $column_separators->setChecked($this->object->getColumnSeparators()); $column_separators->setRequired(false); $form->addItem($column_separators); // row separators $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators"); $row_separators->setValue(1); $row_separators->setInfo($this->lng->txt("matrix_row_separators_description")); $row_separators->setChecked($this->object->getRowSeparators()); $row_separators->setRequired(false); $form->addItem($row_separators); // neutral column separators $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator"); $neutral_column_separator->setValue(1); $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description")); $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator()); $neutral_column_separator->setRequired(false); $form->addItem($neutral_column_separator); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_columns")); $form->addItem($header); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $columns = new ilCategoryWizardInputGUI("", "columns"); $columns->setRequired(false); $columns->setAllowMove(true); $columns->setShowWizard(true); $columns->setShowNeutralCategory(true); $columns->setDisabledScale(false); $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer')); $columns->setCategoryText($this->lng->txt('matrix_standard_answers')); $columns->setShowSavePhrase(true); if (!$this->object->getColumnCount()) { $this->object->columns->addCategory(""); } $columns->setValues($this->object->getColumns()); $form->addItem($columns); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_column_settings")); $form->addItem($header); // bipolar adjectives $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives")); $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description")); // left pole $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1"); $bipolar1->setValue($this->object->getBipolarAdjective(0)); $bipolar1->setRequired(false); $bipolar->addSubItem($bipolar1); // right pole $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2"); $bipolar2->setValue($this->object->getBipolarAdjective(1)); $bipolar2->setRequired(false); $bipolar->addSubItem($bipolar2); $form->addItem($bipolar); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_rows")); $form->addItem($header); // matrix rows include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php"; $rows = new ilMatrixRowWizardInputGUI("", "rows"); $rows->setRequired(false); $rows->setAllowMove(true); $rows->setLabelText($this->lng->txt('label')); $rows->setUseOtherAnswer(true); if ($this->object->getRowCount() == 0) { $this->object->getRows()->addCategory(""); } $rows->setValues($this->object->getRows()); $form->addItem($rows); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) { $form->setValuesByPost(); $errors = !$form->checkInput(); $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * Init the form to add or edit a type * * @param string xml data of input */ private function initFormDefinition($a_xml = null) { global $lng, $ilCtrl; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if (!isset($a_xml)) { $a_xml = $this->type->getXML(); } $form = new ilPropertyFormGUI(); $form->setId('edit_xml'); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->txt('type_definition')); $item = new ilCustomInputGUI(''); $tpl = new ilTemplate('tpl.edit_xml.html', true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/ExternalContent/"); $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($a_xml)); $item->setHTML($tpl->get()); $item->setInfo($this->txt('type_definition_info')); $form->addItem($item); $form->addCommandButton('submitFormDefinition', $lng->txt('save')); $this->form = $form; }
/** * add the properties of a question part to the form * * @param object form object to extend * @param object question part object * @param integer counter of the question part */ private function initPartProperties($form, $part_obj = null, $counter = "1") { // Use a dummy part object for a new booking definition if (!isset($part_obj)) { $part_obj = new assAccountingQuestionPart($this->object); } // Part identifier (is 0 for a new part) $item = new ilHiddenInputGUI("parts[]"); $item->setValue($part_obj->getPartId()); $form->addItem($item); // Title $item = new ilFormSectionHeaderGUI(); $item->setTitle($this->plugin->txt('accounting_table') . ' ' . $counter); $form->addItem($item); // Position $item = new ilNumberInputGUI($this->plugin->txt('position'), 'position_' . $part_obj->getPartId()); $item->setSize(2); $item->setDecimals(1); $item->SetInfo($this->plugin->txt('position_info')); if ($part_obj->getPartId()) { $item->setValue(sprintf("%01.1f", $part_obj->getPosition())); } $form->addItem($item); // Text $item = new ilTextAreaInputGUI($this->plugin->txt("question_part"), 'text_' . $part_obj->getPartId()); $item->setValue($this->object->prepareTextareaOutput($part_obj->getText())); $item->setRows(10); $item->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { $item->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $item->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $item->addPlugin("latex"); $item->addButton("latex"); $item->addButton("pastelatex"); $item->setRTESupport($this->object->getId(), "qpl", "assessment"); } else { $item->setRteTags(self::getSelfAssessmentTags()); $item->setUseTagsForRteOnly(false); } $form->addItem($item); // Booking XML definition $item = new ilCustomInputGUI($this->plugin->txt('booking_xml')); $item->setInfo($this->plugin->txt('booking_xml_info')); $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html'); $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($part_obj->getBookingXML())); $tpl->setVariable("NAME", 'booking_xml_' . $part_obj->getPartId()); $item->setHTML($tpl->get()); // Booking file $subitem = new ilFileInputGUI($this->plugin->txt('booking_file'), "booking_file_" . $part_obj->getPartId()); $subitem->setSuffixes(array('xml')); $item->addSubItem($subitem); // Download button if (strlen($part_obj->getBookingXML())) { $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html'); $this->ctrl->setParameter($this, 'xmltype', 'booking'); $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId()); $tpl->setCurrentBlock('button'); $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml')); $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_booking_xml')); $tpl->ParseCurrentBlock(); $subitem = new ilcustomInputGUI(''); $subitem->setHTML($tpl->get()); $item->addSubItem($subitem); } $form->addItem($item); // Delete Button if ($part_obj->getPartId()) { $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html'); $tpl->setCurrentBlock('button'); $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId()); $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'deletePart')); $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('delete_accounting_table')); $tpl->ParseCurrentBlock(); $item = new ilcustomInputGUI(); $item->setHTML($tpl->get()); $form->addItem($item); } }
protected function showtlt() { global $lng, $ilCtrl, $tpl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "showtlt")); $form->setTitle($lng->txt("learning_progress")); $form->setDescription($lng->txt("trac_collection_tlt_learner_info")); $coll_items = array(); include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->getObjId()); $collection = $olp->getCollectionInstance(); if ($collection) { $coll_items = $collection->getItems(); $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles } include_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $class = ilLPStatusFactory::_getClassById($this->getObjId(), ilLPObjSettings::LP_MODE_COLLECTION_TLT); $info = $class::_getStatusInfo($this->getObjId(), true); foreach ($coll_items as $item_id) { $field = new ilCustomInputGUI($possible_items[$item_id]["title"]); // lp status $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (isset($info["completed"][$item_id]) && in_array($ilUser->getId(), $info["completed"][$item_id])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (isset($info["in_progress"][$item_id]) && in_array($ilUser->getId(), $info["in_progress"][$item_id])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status); $text = ilLearningProgressBaseGUI::_getStatusText($status); $field->setHtml(ilUtil::img($path, $text)); // stats $spent = 0; if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) { $spent = $info["tlt_users"][$item_id][$ilUser->getId()]; } $needed = $info["tlt"][$item_id]; if ($needed) { $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"), ilFormat::_secondsToString($spent), ilFormat::_secondsToString($needed), min(100, round(abs($spent) / $needed * 100)))); } $form->addItem($field); } $tpl->setContent($form->getHTML()); }
function initForm() { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save')); $this->form_gui->setTitle($this->lng->txt('reg_settings_header')); $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type'); $reg_type->addOption(new ilRadioOption($this->lng->txt('reg_disabled'), IL_REG_DISABLED)); $option = new ilRadioOption($this->lng->txt('reg_direct'), IL_REG_DIRECT); $option->setInfo($this->lng->txt('reg_direct_info')); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_DIRECT); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_approve'), IL_REG_APPROVE); $option->setInfo($this->lng->txt('reg_approve_info')); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_APPROVE); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_type_confirmation'), IL_REG_ACTIVATION); $option->setInfo($this->lng->txt('reg_type_confirmation_info')); $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time'); $lt->setSize(5); $lt->setMaxLength(5); $lt->setMinValue(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE); $lt->setRequired(true); $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info')); $lt->setSuffix($this->lng->txt('seconds')); $option->addSubItem($lt); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_ACTIVATION); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('registration_reg_type_codes'), IL_REG_CODES); $option->setInfo($this->lng->txt('registration_reg_type_codes_info')); $reg_type->addOption($option); $this->form_gui->addItem($reg_type); $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd'); $pwd_gen->setValue(1); $pwd_gen->setInfo($this->lng->txt('reg_info_pwd')); $this->form_gui->addItem($pwd_gen); require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym'); $cap->setInfo($this->lng->txt('adm_captcha_anonymous_reg')); $cap->setValue(1); if (!ilCaptchaUtil::checkFreetype()) { $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage()); } $this->form_gui->addItem($cap); $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver'); $approver->setSize(32); $approver->setMaxLength(50); $approver->setInfo($this->lng->txt('reg_notification_info')); $this->form_gui->addItem($approver); $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type'); $option = new ilRadioOption($this->lng->txt('reg_fixed'), IL_REG_ROLES_FIXED); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editRoles'); $list->setHtml($this->__parseRoleList($this->__prepareRoleList(), $edit)); $option->addSubItem($list); $roles->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_email'), IL_REG_ROLES_EMAIL); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments'); $list->setHtml($this->__parseRoleList($this->__prepareAutomaticRoleList(), $edit)); $option->addSubItem($list); $roles->addOption($option); $roles->setInfo($this->lng->txt('registration_codes_override_global_info')); $this->form_gui->addItem($roles); $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation'); $limit->setValue(1); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations'); $list->setHtml($this->__parseRoleList($this->__prepareAccessLimitationRoleList(), $edit)); $list->setInfo($this->lng->txt('registration_codes_override_global_info')); $limit->addSubItem($list); $this->form_gui->addItem($limit); $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains'); $domains->setInfo($this->lng->txt('reg_allowed_domains_info')); $this->form_gui->addItem($domains); $this->form_gui->addCommandButton('save', $this->lng->txt('save')); }
/** * Init properties form * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) * @param array (assoc) form values * @access protected */ protected function initForm($a_mode, $a_values = array()) { if (is_object($this->form)) { return true; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($a_mode != "create") { $item = new ilCustomInputGUI($this->lng->txt('type'), ''); $item->setHtml($this->object->typedef->getTitle()); $item->setInfo($this->object->typedef->getDescription()); $this->form->addItem($item); } $item = new ilTextInputGUI($this->lng->txt('title'), 'title'); $item->setSize(40); $item->setMaxLength(128); $item->setRequired(true); $item->setInfo($this->txt('xxco_title_info')); $item->setValue($a_values['title']); $this->form->addItem($item); $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $item->setInfo($this->txt('xxco_description_info')); $item->setRows(2); $item->setCols(80); $item->setValue($a_values['description']); $this->form->addItem($item); if ($a_mode == "create") { $item = new ilRadioGroupInputGUI($this->lng->txt('type'), 'type_id'); $item->setRequired(true); $types = ilExternalContentType::_getTypesData(false, ilExternalContentType::AVAILABILITY_CREATE); foreach ($types as $type) { $option = new ilRadioOption($type['title'], $type['type_id'], $type['description']); $item->addOption($option); } $this->form->addItem($item); $this->form->setTitle($this->txt('xxco_new')); $this->form->addCommandButton(!$this->checkCreationMode() ? 'update' : 'save', $this->lng->txt('save')); $this->form->addCommandButton('cancelCreate', $this->lng->txt("cancel")); } else { $item = new ilCheckboxInputGUI($this->lng->txt('online'), 'online'); $item->setInfo($this->txt("xxco_online_info")); $item->setValue("1"); if ($a_values['online']) { $item->setChecked(true); } $this->form->addItem($item); // add the type specific fields $this->object->typedef->addFormElements($this->form, $a_values, "object"); $this->form->setTitle($this->lng->txt('settings')); $this->form->addCommandButton("update", $this->lng->txt("save")); $this->form->addCommandButton("view", $this->lng->txt("cancel")); if ($this->object->typedef->getMetaDataUrl()) { $this->form->addCommandButton("refreshMeta", $this->lng->txt("xxco_refresh_meta_data")); } } }