protected function initQuestionForm($a_read_only = false) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion")); $form->setTitle($lng->txt("obj_poll")); $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question"); $question->setRequired(true); $question->setCols(40); $question->setRows(2); $question->setValue($this->object->getQuestion()); $question->setDisabled($a_read_only); $form->addItem($question); $dimensions = " (" . ilObjPoll::getImageSize() . "px)"; $img = new ilImageFileInputGUI($lng->txt("poll_image") . $dimensions, "image"); $img->setDisabled($a_read_only); $form->addItem($img); // show existing file $file = $this->object->getImageFullPath(true); if ($file) { $img->setImage($file); } $anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode"); $anonymous->setRequired(true); $option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0); $option->setInfo($lng->txt("poll_mode_anonymous_info")); $anonymous->addOption($option); $option = new ilRadioOption($lng->txt("poll_mode_personal"), 1); $option->setInfo($lng->txt("poll_mode_personal_info")); $anonymous->addOption($option); $anonymous->setValue($this->object->getNonAnonymous()); $anonymous->setDisabled($a_read_only); $form->addItem($anonymous); $nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers"); $nanswers->setRequired(true); $nanswers->setMinValue(1); $nanswers->setSize(3); $nanswers->setValue($this->object->getMaxNumberOfAnswers()); $nanswers->setDisabled($a_read_only); $form->addItem($nanswers); $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers"); $answers->setRequired(true); $answers->setMulti(true, true); $answers->setDisabled($a_read_only); $form->addItem($answers); $multi_answers = array(); foreach ($this->object->getAnswers() as $idx => $item) { if (!$idx) { $answers->setValue($item["answer"]); } $multi_answers[] = $item["answer"]; } $answers->setMultiValues($multi_answers); if (!$a_read_only) { $form->addCommandButton("saveQuestion", $lng->txt("save")); } return $form; }
/** * Init form table for new role assignments * * @param string mode edit | create * @param object object of ilLDAPRoleAsssignmentRule * @access protected * */ protected function initFormRoleAssignments($a_mode) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); switch ($a_mode) { case 'edit': $this->form->setTitle($this->lng->txt('ldap_edit_role_ass_rule')); $this->form->addCommandButton('updateRoleAssignment', $this->lng->txt('save')); $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel')); break; case 'create': $this->form->setTitle($this->lng->txt('ldap_add_role_ass_rule')); $this->form->addCommandButton('addRoleAssignment', $this->lng->txt('ldap_btn_add_role_ass')); $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel')); break; } // Role Selection $role = new ilRadioGroupInputGUI($this->lng->txt('ldap_ilias_role'), 'role_name'); $role->setRequired(true); $global = new ilRadioOption($this->lng->txt('ldap_global_role'), 0); $role->addOption($global); $role_select = new ilSelectInputGUI('', 'role_id'); $role_select->setOptions($this->prepareGlobalRoleSelection()); $global->addSubItem($role_select); $local = new ilRadioOption($this->lng->txt('ldap_local_role'), 1); $role->addOption($local); include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php'; $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject'); $role_search->setSize(40); $local->addSubItem($role_search); $role->setInfo($this->lng->txt('ldap_role_name_info')); $this->form->addItem($role); // Update options $update = new ilNonEditableValueGUI($this->lng->txt('ldap_update_roles'), 'update_roles'); $update->setValue($this->lng->txt('ldap_check_role_assignment')); $add = new ilCheckboxInputGUI('', 'add_missing'); $add->setOptionTitle($this->lng->txt('ldap_add_missing')); $update->addSubItem($add); $remove = new ilCheckboxInputGUI('', 'remove_deprecated'); $remove->setOptionTitle($this->lng->txt('ldap_remove_deprecated')); $update->addSubItem($remove); $this->form->addItem($update); // Assignment Type $group = new ilRadioGroupInputGUI($this->lng->txt('ldap_assignment_type'), 'type'); #$group->setValue($current_rule->getType()); $group->setRequired(true); // Option by group $radio_group = new ilRadioOption($this->lng->txt('ldap_role_by_group'), ilLDAPRoleAssignmentRule::TYPE_GROUP); $dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'), 'dn'); #$dn->setValue($current_rule->getDN()); $dn->setSize(32); $dn->setMaxLength(512); $dn->setInfo($this->lng->txt('ldap_role_grp_dn_info')); $radio_group->addSubItem($dn); $at = new ilTextInputGUI($this->lng->txt('ldap_role_grp_at'), 'at'); #$at->setValue($current_rule->getMemberAttribute()); $at->setSize(16); $at->setMaxLength(128); $radio_group->addSubItem($at); $isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_role_grp_isdn'), 'isdn'); #$isdn->setChecked($current_rule->isMemberAttributeDN()); $isdn->setInfo($this->lng->txt('ldap_group_member_info')); $radio_group->addSubItem($isdn); $radio_group->setInfo($this->lng->txt('ldap_role_grp_info')); $group->addOption($radio_group); // Option by Attribute $radio_attribute = new ilRadioOption($this->lng->txt('ldap_role_by_attribute'), ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE); $name = new ilTextInputGUI($this->lng->txt('ldap_role_at_name'), 'name'); #$name->setValue($current_rule->getAttributeName()); $name->setSize(32); $name->setMaxLength(128); #$name->setInfo($this->lng->txt('ldap_role_at_name_info')); $radio_attribute->addSubItem($name); // Radio Attribute $val = new ilTextInputGUI($this->lng->txt('ldap_role_at_value'), 'value'); #$val->setValue($current_rule->getAttributeValue()); $val->setSize(32); $val->setMaxLength(128); #$val->setInfo($this->lng->txt('ldap_role_at_value_info')); $radio_attribute->addSubItem($val); $radio_attribute->setInfo($this->lng->txt('ldap_role_at_info')); $group->addOption($radio_attribute); // Option by Plugin $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins(); $pl = new ilRadioOption($this->lng->txt('ldap_plugin'), 3); $pl->setInfo($this->lng->txt('ldap_plugin_info')); $pl->setDisabled(!$pl_active); $id = new ilNumberInputGUI($this->lng->txt('ldap_plugin_id'), 'plugin_id'); $id->setDisabled(!$pl_active); $id->setSize(3); $id->setMaxLength(3); $id->setMaxValue(999); $id->setMinValue(1); $pl->addSubItem($id); $group->addOption($pl); $this->form->addItem($group); }
/** * Init form settings */ protected function dInitFormTreeSettings(ilPropertyFormGUI $form = null) { include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php'; if ($form instanceof ilPropertyFormGUI) { return $form; } include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php'; $assignment = new ilECSNodeMappingAssignment($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], 0); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'dEditTree')); $form->setTitle($this->lng->txt('general_settings')); $form->addCommandButton('dUpdateTreeSettings', $this->lng->txt('save')); $form->addCommandButton('dTrees', $this->lng->txt('cancel')); $form->setTableWidth('30%'); // CMS id (readonly) include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php'; $cmsid = new ilNumberInputGUI($this->lng->txt('ecs_cms_id'), 'cmsid'); $cmsid->setValue(ilECSCmsData::lookupCmsId(ilECSCmsTree::lookupRootId((int) $_REQUEST['tid']))); $cmsid->setDisabled(true); $cmsid->setSize(7); $cmsid->setMaxLength(12); $form->addItem($cmsid); $mapping_status = ilECSMappingUtils::lookupMappingStatus($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid']); $mapping_advanced = $mapping_status != ilECSMappingUtils::MAPPED_MANUAL ? true : false; // Status (readonly) $status = new ilNonEditableValueGUI($this->lng->txt('status'), ''); $status->setValue(ilECSMappingUtils::mappingStatusToString($mapping_status)); $form->addItem($status); // title update $title = new ilCheckboxInputGUI($this->lng->txt('ecs_title_updates'), 'title'); $title->setValue(1); $title->setChecked($assignment->isTitleUpdateEnabled()); #$title->setInfo($this->lng->txt('ecs_title_update_info')); $form->addItem($title); $position = new ilCheckboxInputGUI($this->lng->txt('ecs_position_updates'), 'position'); $position->setDisabled(!$mapping_advanced); $position->setChecked($mapping_advanced && $assignment->isPositionUpdateEnabled()); $position->setValue(1); #$position->setInfo($this->lng->txt('ecs_position_update_info')); $form->addItem($position); $tree = new ilCheckboxInputGUI($this->lng->txt('ecs_tree_updates'), 'tree'); $tree->setDisabled(!$mapping_advanced); $tree->setChecked($mapping_advanced && $assignment->isTreeUpdateEnabled()); $tree->setValue(1); #$tree->setInfo($this->lng->txt('ecs_tree_update_info')); $form->addItem($tree); return $form; }
/** * @param array $row */ public function fillRow(array $row) { $short_name = new ilTextInputGUI('', 'mark_short_' . $row['mark_id']); $short_name->setValue($row['mark_short']); $short_name->setDisabled(!$this->is_editable); $short_name->setSize(10); $official_name = new ilTextInputGUI('', 'mark_official_' . $row['mark_id']); $official_name->setSize(20); $official_name->setDisabled(!$this->object->canEditMarks()); $official_name->setValue($row['mark_official']); $percentage = new ilNumberInputGUI('', 'mark_percentage_' . $row['mark_id']); $percentage->allowDecimals(true); $percentage->setValue($row['mark_percentage']); $percentage->setSize(10); $percentage->setDisabled(!$this->is_editable); $percentage->setMinValue(0); $percentage->setMaxValue(100); $this->tpl->setVariable('VAL_MARK_ID', $row['mark_id']); $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'marks[]', $row['mark_id'], !$this->is_editable)); $this->tpl->setVariable('VAL_SHORT_NAME', $short_name->render()); $this->tpl->setVariable('VAL_OFFICIAL_NAME', $official_name->render()); $this->tpl->setVariable('VAL_PERCENTAGE', $percentage->render()); $this->tpl->setVariable('VAL_PASSED_CHECKBOX', ilUtil::formCheckbox((bool) $row['mark_passed'], 'passed_' . $row['mark_id'], '1', !$this->is_editable)); }
/** * @param assFormulaQuestionUnitCategory $category * @param assFormulaQuestionUnit $unit * @return ilPropertyFormGUI */ protected function initUnitForm(assFormulaQuestionUnitCategory $category = null, assFormulaQuestionUnit $unit = null) { if ($this->unit_form instanceof ilPropertyFormGUI) { return $this->unit_form; } $unit_in_use = false; if ($unit instanceof assFormulaQuestionUnit && $this->repository->isUnitInUse($unit->getId())) { $unit_in_use = true; } $this->unit_form = new ilPropertyFormGUI(); $title = new ilTextInputGUI($this->lng->txt('unit'), 'unit_title'); $title->setDisabled($unit_in_use); $title->setRequired(true); $this->unit_form->addItem($title); $baseunit = new ilSelectInputGUI($this->lng->txt('baseunit'), 'base_unit'); $items = $this->repository->getCategorizedUnits(); $options = array(); $category_name = ''; $new_category = false; foreach ((array) $items as $item) { if ($unit instanceof assFormulaQuestionUnit && $unit->getId() == $item->getId()) { continue; } /** * @var $item assFormulaQuestionUnitCategory|assFormulaQuestionUnitCategory */ if ($item instanceof assFormulaQuestionUnitCategory) { if ($category_name != $item->getDisplayString()) { $new_category = true; $category_name = $item->getDisplayString(); } continue; } $options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : ''); $new_category = false; } $baseunit->setDisabled($unit_in_use); $baseunit->setOptions(array(0 => $this->lng->txt('no_selection')) + $options); $this->unit_form->addItem($baseunit); $factor = new ilNumberInputGUI($this->lng->txt('factor'), 'factor'); $factor->setRequired(true); $factor->setSize(3); $factor->setMinValue(0); $factor->allowDecimals(true); $factor->setDisabled($unit_in_use); $this->unit_form->addItem($factor); if (null === $unit) { $this->unit_form->setTitle($this->lng->txt('new_unit')); $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'addUnit')); $this->unit_form->addCommandButton('addUnit', $this->lng->txt('save')); } else { $this->ctrl->setParameter($this, 'unit_id', $unit->getId()); if ($unit_in_use) { $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'showUnitsOfCategory')); } else { $this->unit_form->addCommandButton('saveUnit', $this->lng->txt('save')); $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'saveUnit')); } $this->unit_form->setTitle(sprintf($this->lng->txt('un_sel_cat_sel_unit'), $category->getDisplayString(), $unit->getDisplayString())); } $this->unit_form->addCommandButton('showUnitsOfCategory', $this->lng->txt('cancel')); return $this->unit_form; }
/** * @param ilPropertyFormGUI $form */ private function addTestRunProperties(ilPropertyFormGUI $form) { // section header test run $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_settings_header_test_run")); $form->addItem($header); // max. number of passes $limitPasses = new ilCheckboxInputGUI($this->lng->txt("tst_limit_nr_of_tries"), 'limitPasses'); $limitPasses->setInfo($this->lng->txt("tst_nr_of_tries_desc")); $limitPasses->setChecked($this->testOBJ->getNrOfTries() > 0); $nr_of_tries = new ilNumberInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->allowDecimals(false); $nr_of_tries->setMinValue(1); $nr_of_tries->setMinvalueShouldBeGreater(false); $nr_of_tries->setValue($this->testOBJ->getNrOfTries() ? $this->testOBJ->getNrOfTries() : 1); $nr_of_tries->setRequired(true); if ($this->testOBJ->participantDataExist()) { $limitPasses->setDisabled(true); $nr_of_tries->setDisabled(true); } $limitPasses->addSubItem($nr_of_tries); $form->addItem($limitPasses); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->setValue(1); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilNumberInputGUI($this->lng->txt("tst_processing_time_duration"), 'processing_time'); $processingtime->allowDecimals(false); $processingtime->setMinValue(1); $processingtime->setMinvalueShouldBeGreater(false); $processingtime->setValue($this->testOBJ->getProcessingTimeAsMinutes()); $processingtime->setSize(5); $processingtime->setSuffix($this->lng->txt('minutes')); $processingtime->setInfo($this->lng->txt("tst_processing_time_duration_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $examIdInPass = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_pass'), 'examid_in_test_pass'); $examIdInPass->setInfo($this->lng->txt('examid_in_test_pass_desc')); $examIdInPass->setChecked($this->testOBJ->isShowExamIdInTestPassEnabled()); $form->addItem($examIdInPass); }
protected function initFormRoleAssignment($a_mode = 'default') { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'cancel')); $this->form->setTitle($this->lng->txt('shib_role_ass_table')); if ($a_mode == 'default') { $this->form->setTitle($this->lng->txt('shib_role_ass_table')); $this->form->addCommandButton('addRoleAssignmentRule', $this->lng->txt('shib_new_rule')); $this->form->addCommandButton('settings', $this->lng->txt('cancel')); } else { $this->form->setTitle($this->lng->txt('shib_update_role_ass_table')); $this->form->addCommandButton('updateRoleAssignmentRule', $this->lng->txt('save')); $this->form->addCommandButton('roleAssignment', $this->lng->txt('cancel')); } // Role selection $role = new ilRadioGroupInputGUI($this->lng->txt('shib_role_name'), 'role_name'); $role->setRequired(true); $global = new ilRadioOption($this->lng->txt('shib_global_role'), 0); $role->addOption($global); $role_select = new ilSelectInputGUI('', 'role_id'); $role_select->setOptions($this->prepareRoleSelect()); $global->addSubItem($role_select); $local = new ilRadioOption($this->lng->txt('shib_local_role'), 1); $role->addOption($local); include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php'; $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject'); $role_search->setSize(40); $local->addSubItem($role_search); include_once './Services/AccessControl/classes/class.ilRoleAutoComplete.php'; $role->setInfo($this->lng->txt('shib_role_name_info')); $this->form->addItem($role); // Update options $update = new ilNonEditableValueGUI($this->lng->txt('shib_update_roles'), 'update_roles'); $update->setValue($this->lng->txt('shib_check_role_assignment')); $add = new ilCheckboxInputGUI('', 'add_missing'); $add->setOptionTitle($this->lng->txt('shib_add_missing')); $add->setValue(1); $update->addSubItem($add); $remove = new ilCheckboxInputGUI('', 'remove_deprecated'); $remove->setOptionTitle($this->lng->txt('shib_remove_deprecated')); $remove->setValue(1); $update->addSubItem($remove); $this->form->addItem($update); // Assignment type $kind = new ilRadioGroupInputGUI($this->lng->txt('shib_assignment_type'), 'kind'); $kind->setValue(1); $kind->setRequired(true); $attr = new ilRadioOption($this->lng->txt('shib_attribute'), 1); $attr->setInfo($this->lng->txt('shib_attr_info')); $name = new ilTextInputGUI($this->lng->txt('shib_attribute_name'), 'attr_name'); $name->setSize(32); $attr->addSubItem($name); $value = new ilTextInputGUI($this->lng->txt('shib_attribute_value'), 'attr_value'); $value->setSize(32); $attr->addSubItem($value); $kind->addOption($attr); $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins(); $pl = new ilRadioOption($this->lng->txt('shib_plugin'), 2); $pl->setInfo($this->lng->txt('shib_plugin_info')); $pl->setDisabled(!$pl_active); $id = new ilNumberInputGUI($this->lng->txt('shib_plugin_id'), 'plugin_id'); $id->setDisabled(!$pl_active); $id->setSize(3); $id->setMaxLength(3); $id->setMaxValue(999); $id->setMinValue(1); $pl->addSubItem($id); $kind->addOption($pl); $this->form->addItem($kind); }
private function buildResultSkillPointsInputField() { $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points'); $questResultSkillPoints->setRequired(true); $questResultSkillPoints->setSize(4); $questResultSkillPoints->setMinvalueShouldBeGreater(false); $questResultSkillPoints->setMinValue(1); $questResultSkillPoints->allowDecimals(false); $questResultSkillPoints->setValue($this->assignment->getSkillPoints()); if (!$this->isManipulationEnabled()) { $questResultSkillPoints->setDisabled(true); } return $questResultSkillPoints; }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("asstextsubset"); $this->addBasicQuestionFormProperties($form); // number of requested answers $correctanswers = new ilNumberInputGUI($this->lng->txt("nr_of_correct_answers"), "correctanswers"); $correctanswers->setMinValue(1); $correctanswers->setDecimals(0); $correctanswers->setSize(3); $correctanswers->setValue($this->object->getCorrectAnswers()); $correctanswers->setRequired(true); $form->addItem($correctanswers); // maximum available points $points = new ilNumberInputGUI($this->lng->txt("maximum_points"), "points"); $points->setMinValue(0.25); $points->setSize(6); $points->setDisabled(true); $points->setValue($this->object->getMaximumPoints()); $points->setRequired(false); $form->addItem($points); // text rating $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating"); $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive")); if (!$this->getSelfAssessmentEditingMode()) { $text_options["l1"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"); $text_options["l2"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"); $text_options["l3"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"); $text_options["l4"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"); $text_options["l5"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"); } $textrating->setOptions($text_options); $textrating->setValue($this->object->getTextRating()); $form->addItem($textrating); // Choices include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php"; $choices = new ilAnswerWizardInputGUI($this->lng->txt("answers"), "answers"); $choices->setRequired(true); $choices->setQuestionObject($this->object); $choices->setSingleline(true); $choices->setAllowMove(false); if ($this->object->getAnswerCount() == 0) { $this->object->addAnswer("", 0, 0); } $choices->setValues($this->object->getAnswers()); $form->addItem($choices); $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $form->setValuesByPost(); $points->setValue($this->object->getMaximumPoints()); $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("QUESTION_DATA", $form->getHTML()); } return $errors; }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // number of requested answers $correctanswers = new ilNumberInputGUI($this->lng->txt("nr_of_correct_answers"), "correctanswers"); $correctanswers->setMinValue(1); $correctanswers->setDecimals(0); $correctanswers->setSize(3); $correctanswers->setValue($this->object->getCorrectAnswers()); $correctanswers->setRequired(true); $form->addItem($correctanswers); // maximum available points $points = new ilNumberInputGUI($this->lng->txt("maximum_points"), "points"); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(true); $points->setSize(6); $points->setDisabled(true); $points->setValue($this->object->getMaximumPoints()); $points->setRequired(false); $form->addItem($points); // text rating $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating"); $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive")); if (!$this->object->getSelfAssessmentEditingMode()) { $text_options["l1"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"); $text_options["l2"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"); $text_options["l3"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"); $text_options["l4"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"); $text_options["l5"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"); } $textrating->setOptions($text_options); $textrating->setValue($this->object->getTextRating()); $form->addItem($textrating); return $form; }