public function addToForm() { $def = $this->getADT()->getCopyOfDefinition(); $number = new ilNumberInputGUI($this->getTitle(), $this->getElementId()); $number->setSize(10); $number->setDecimals($def->getDecimals()); $this->addBasicFieldProperties($number, $def); $min = $def->getMin(); if ($min !== null) { $number->setMinValue($min); } $max = $def->getMax(); if ($max !== null) { $number->setMaxValue($max); $length = strlen($max) + $def->getDecimals() + 1; $number->setSize($length); $number->setMaxLength($length); } $suffix = $def->getSuffix(); if ($suffix !== null) { $number->setSuffix($suffix); } $number->setValue($this->getADT()->getNumber()); $this->addToParentElement($number); }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // maximum number of characters $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setRequired(false); $maxchars->setSize(5); $maxchars->setDecimals(0); $a_form->addItem($maxchars); // textwidth $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth"); $textwidth->setRequired(true); $textwidth->setSize(3); $textwidth->setDecimals(0); $textwidth->setMinValue(10); $a_form->addItem($textwidth); // textheight $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight"); $textheight->setRequired(true); $textheight->setSize(3); $textheight->setDecimals(0); $textheight->setMinValue(1); $a_form->addItem($textheight); // values if ($this->object->getMaxChars() > 0) { $maxchars->setValue($this->object->getMaxChars()); } $textwidth->setValue($this->object->getTextWidth()); $textheight->setValue($this->object->getTextHeight()); }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // orientation $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation"); $orientation->setRequired(false); $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0)); $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1)); $a_form->addItem($orientation); // minimum answers $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers"); $minanswers->setValue(1); $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option")); $minanswers->setRequired(FALSE); $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers"); $nranswers->setSize(5); $nranswers->setDecimals(0); $nranswers->setRequired(false); $nranswers->setMinValue(1); $minanswers->addSubItem($nranswers); $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers"); $nrmaxanswers->setSize(5); $nrmaxanswers->setDecimals(0); $nrmaxanswers->setRequired(false); $nrmaxanswers->setMinValue(1); $minanswers->addSubItem($nrmaxanswers); $a_form->addItem($minanswers); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(false); $answers->setAllowMove(true); $answers->setShowWizard(false); $answers->setShowSavePhrase(false); $answers->setUseOtherAnswer(true); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer')); $answers->setDisabledScale(false); $a_form->addItem($answers); // values $orientation->setValue($this->object->getOrientation()); $minanswers->setChecked($this->object->use_min_answers); $nranswers->setValue($this->object->nr_min_answers); $nrmaxanswers->setValue($this->object->nr_max_answers); if (!$this->object->getCategories()->getCategoryCount()) { $this->object->getCategories()->addCategory(""); } $answers->setValues($this->object->getCategories()); }
/** * Initializes the preview settings form. */ private function initPreviewSettingsForm() { global $ilCtrl, $lng; require_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("settings")); require_once "Services/Preview/classes/class.ilPreviewSettings.php"; // drag and drop file upload in repository $chk_prop = new ilCheckboxInputGUI($lng->txt("enable_preview"), "enable_preview"); $chk_prop->setValue('1'); $chk_prop->setChecked(ilPreviewSettings::isPreviewEnabled()); $chk_prop->setInfo($lng->txt('enable_preview_info')); $form->addItem($chk_prop); $num_prop = new ilNumberInputGUI($lng->txt("max_previews_per_object"), "max_previews_per_object"); $num_prop->setDecimals(0); $num_prop->setMinValue(1); $num_prop->setMinvalueShouldBeGreater(false); $num_prop->setMaxValue(ilPreviewSettings::MAX_PREVIEWS_MAX); $num_prop->setMaxvalueShouldBeLess(false); $num_prop->setMaxLength(5); $num_prop->setSize(10); $num_prop->setValue(ilPreviewSettings::getMaximumPreviews()); $num_prop->setInfo($lng->txt('max_previews_per_object_info')); $form->addItem($num_prop); // command buttons $form->addCommandButton('savePreviewSettings', $lng->txt('save')); $form->addCommandButton('view', $lng->txt('cancel')); return $form; }
/** * 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); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); // orientation $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation"); $orientation->setRequired(false); $orientation->setValue($this->object->getOrientation()); $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0)); $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1)); $form->addItem($orientation); // minimum answers $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers"); $minanswers->setValue(1); $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option")); $minanswers->setChecked($this->object->use_min_answers); $minanswers->setRequired(FALSE); $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers"); $nranswers->setSize(5); $nranswers->setDecimals(0); $nranswers->setRequired(false); $nranswers->setMinValue(1); $nranswers->setValue($this->object->nr_min_answers); $minanswers->addSubItem($nranswers); $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers"); $nrmaxanswers->setSize(5); $nrmaxanswers->setDecimals(0); $nrmaxanswers->setRequired(false); $nrmaxanswers->setMinValue(1); $nrmaxanswers->setValue($this->object->nr_max_answers); $minanswers->addSubItem($nrmaxanswers); $form->addItem($minanswers); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(false); $answers->setAllowMove(true); $answers->setShowWizard(false); $answers->setShowSavePhrase(false); $answers->setUseOtherAnswer(true); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer')); if (!$this->object->getCategories()->getCategoryCount()) { $this->object->getCategories()->addCategory(""); } $answers->setValues($this->object->getCategories()); $answers->setDisabledScale(false); $form->addItem($answers); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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 ($nranswers->getValue() > $answers->getCategoryCount()) { $nrmaxanswers->setAlert($this->lng->txt('err_minvalueganswers')); if (!$errors) { ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $errors = true; } if ($nrmaxanswers->getValue() > 0 && ($nrmaxanswers->getValue() > $answers->getCategoryCount() || $nrmaxanswers->getValue() < $nranswers->getValue())) { $nrmaxanswers->setAlert($this->lng->txt('err_maxvaluegeminvalue')); if (!$errors) { ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $errors = true; } if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * 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()); $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline; if ($checkonly) { $isSingleline = $_POST['types'] == 0 ? true : false; } if ($isSingleline) { $form->setMultipart(TRUE); } else { $form->setMultipart(FALSE); } $form->setTableWidth("100%"); $form->setId("asssinglechoice"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // shuffle $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } if (!$this->getSelfAssessmentEditingMode()) { // Answer types $types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types"); $types->setRequired(false); $types->setValue($isSingleline ? 0 : 1); $types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline'))); $form->addItem($types); } if ($isSingleline) { // thumb size $thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size"); $thumb_size->setMinValue(20); $thumb_size->setDecimals(0); $thumb_size->setSize(6); $thumb_size->setInfo($this->lng->txt('thumb_size_info')); $thumb_size->setValue($this->object->getThumbSize()); $thumb_size->setRequired(false); $form->addItem($thumb_size); } // Choices include_once "./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php"; $choices = new ilSingleChoiceWizardInputGUI($this->lng->txt("answers"), "choice"); $choices->setRequired(true); $choices->setQuestionObject($this->object); $choices->setSingleline($isSingleline); $choices->setAllowMove(false); if ($this->getSelfAssessmentEditingMode()) { $choices->setSize(40); $choices->setMaxLength(800); } 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(); $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; }
/** * Creates an output of the edit form for the question */ public function editQuestion() { 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("essay"); // 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); // maximum number of characters $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setRequired(false); $maxchars->setSize(5); if ($this->object->getMaxChars() > 0) { $maxchars->setValue($this->object->getMaxChars()); } $maxchars->setDecimals(0); $form->addItem($maxchars); // textwidth $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth"); $textwidth->setRequired(true); $textwidth->setSize(3); $textwidth->setValue($this->object->getTextWidth()); $textwidth->setDecimals(0); $textwidth->setMinValue(10); $form->addItem($textwidth); // textheight $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight"); $textheight->setRequired(true); $textheight->setSize(3); $textheight->setValue($this->object->getTextHeight()); $textheight->setDecimals(0); $textheight->setMinValue(1); $form->addItem($textheight); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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; }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $form->addItem($points); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_attributes")); $form->addItem($header); // java applet $javaapplet = $this->object->getJavaAppletFilename(); $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName'); $applet->setSuffixes(array('jar', 'class')); $applet->setRequired(false); if (strlen($javaapplet)) { $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet'); $filename->setValue($javaapplet); $applet->addSubItem($filename); $delete = new ilCheckboxInputGUI('', 'delete_applet'); $delete->setOptionTitle($this->lng->txt('delete')); $delete->setValue(1); $applet->addSubItem($delete); } $form->addItem($applet); // Code $code = new ilTextInputGUI($this->lng->txt("code"), "java_code"); $code->setValue($this->object->getJavaCode()); $code->setRequired(TRUE); $form->addItem($code); if (!strlen($javaapplet)) { // Archive $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive"); $archive->setValue($this->object->getJavaArchive()); $archive->setRequired(false); $form->addItem($archive); // Codebase $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase"); $codebase->setValue($this->object->getJavaCodebase()); $codebase->setRequired(false); $form->addItem($codebase); } // Width $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width"); $width->setDecimals(0); $width->setSize(6); $width->setMinValue(50); $width->setMaxLength(6); $width->setValue($this->object->getJavaWidth()); $width->setRequired(TRUE); $form->addItem($width); // Height $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height"); $height->setDecimals(0); $height->setSize(6); $height->setMinValue(50); $height->setMaxLength(6); $height->setValue($this->object->getJavaHeight()); $height->setRequired(TRUE); $form->addItem($height); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_parameters")); $form->addItem($header); include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php"; $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp"); $values = array(); for ($i = 0; $i < $this->object->getParameterCount(); $i++) { $param = $this->object->getParameter($i); array_push($values, array($param['name'], $param['value'])); } if (count($values) == 0) { array_push($values, array("", "")); } $kvp->setKeyName($this->lng->txt('name')); $kvp->setValueName($this->lng->txt('value')); $kvp->setValues($values); $form->addItem($kvp); }
/** * 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(true); $form->setTableWidth("100%"); $form->setId("assjavaapplet"); $this->addBasicQuestionFormProperties($form); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $form->addItem($points); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_attributes")); $form->addItem($header); // java applet $javaapplet = $this->object->getJavaAppletFilename(); $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName'); $applet->setSuffixes(array('jar', 'class')); $applet->setRequired(false); if (strlen($javaapplet)) { $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet'); $filename->setValue($javaapplet); $applet->addSubItem($filename); $delete = new ilCheckboxInputGUI('', 'delete_applet'); $delete->setOptionTitle($this->lng->txt('delete')); $delete->setValue(1); $applet->addSubItem($delete); } $form->addItem($applet); // Code $code = new ilTextInputGUI($this->lng->txt("code"), "java_code"); $code->setValue($this->object->getJavaCode()); $code->setRequired(TRUE); $form->addItem($code); if (!strlen($javaapplet)) { // Archive $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive"); $archive->setValue($this->object->getJavaArchive()); $archive->setRequired(false); $form->addItem($archive); // Codebase $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase"); $codebase->setValue($this->object->getJavaCodebase()); $codebase->setRequired(false); $form->addItem($codebase); } // Width $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width"); $width->setDecimals(0); $width->setSize(6); $width->setMinValue(50); $width->setMaxLength(6); $width->setValue($this->object->getJavaWidth()); $width->setRequired(TRUE); $form->addItem($width); // Height $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height"); $height->setDecimals(0); $height->setSize(6); $height->setMinValue(50); $height->setMaxLength(6); $height->setValue($this->object->getJavaHeight()); $height->setRequired(TRUE); $form->addItem($height); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_parameters")); $form->addItem($header); include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php"; $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp"); $values = array(); for ($i = 0; $i < $this->object->getParameterCount(); $i++) { $param = $this->object->getParameter($i); array_push($values, array($param['name'], $param['value'])); } if (count($values) == 0) { array_push($values, array("", "")); } $kvp->setKeyName($this->lng->txt('name')); $kvp->setValueName($this->lng->txt('value')); $kvp->setValues($values); $form->addItem($kvp); $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $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("QUESTION_DATA", $form->getHTML()); } return $errors; }
/** * 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(TRUE); $form->setTableWidth("100%"); $form->setId("assnumeric"); $this->addBasicQuestionFormProperties($form); // maxchars $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setSize(10); $maxchars->setDecimals(0); $maxchars->setMinValue(1); $maxchars->setRequired(true); if ($this->object->getMaxChars() > 0) { $maxchars->setValue($this->object->getMaxChars()); } $form->addItem($maxchars); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("range")); $form->addItem($header); // lower bound $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit"); $lower_limit->setSize(25); $lower_limit->setMaxLength(20); $lower_limit->setRequired(true); $lower_limit->setValue($this->object->getLowerLimit()); $form->addItem($lower_limit); // upper bound $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit"); $upper_limit->setSize(25); $upper_limit->setMaxLength(20); $upper_limit->setRequired(true); $upper_limit->setValue($this->object->getUpperLimit()); $form->addItem($upper_limit); $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $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("QUESTION_DATA", $form->getHTML()); } return $errors; }
/** * 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(true); $subtype->setValue($this->object->getSubtype()); $form->addItem($subtype); // #10652 $opt = new ilRadioOption($this->lng->txt('non_ratio'), 3, $this->lng->txt("metric_subtype_description_interval")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3"); if ($this->object->getSubtype() == 3) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3"); if ($this->object->getSubtype() == 3) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), 4, $this->lng->txt("metric_subtype_description_rationonabsolute")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4"); if ($this->object->getSubtype() == 4) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $minimum->setMinValue(0); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4"); if ($this->object->getSubtype() == 4) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), 5, $this->lng->txt("metric_subtype_description_ratioabsolute")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5"); if ($this->object->getSubtype() == 5) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $minimum->setMinValue(0); $minimum->setDecimals(0); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5"); $maximum->setDecimals(0); if ($this->object->getSubtype() == 5) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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; }
/** * 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; }
/** * ilPropertyFormGUI initialisation * * @access private */ private function initAdobeSettingsForm() { /** * @var $ilCtrl ilCtrl * @var $lng $lng */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; require_once './Services/Authentication/classes/class.ilAuthUtils.php'; $this->tabs->setTabActive('editAdobeSettings'); $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveAdobeSettings')); $this->form->setTitle($this->getPluginObject()->txt('adobe_settings')); $this->form->addCommandButton('saveAdobeSettings', $lng->txt('save')); $this->form->addCommandButton('cancelAdobeSettings', $lng->txt('cancel')); $form_server = new ilTextInputGUI($lng->txt('server'), 'server'); $form_server->setRequired(true); $form_server->setInfo($this->getPluginObject()->txt('xavc_host_info')); $this->form->addItem($form_server); $form_port = new ilNumberInputGUI($lng->txt('port'), 'port'); $form_port->setSize(5); $form_port->setMaxLength(5); $form_port->setInfo($this->getPluginObject()->txt('xavc_port_info')); $this->form->addItem($form_port); $form_login = new ilTextInputGUI($lng->txt('login'), 'login'); $form_login->setRequired(true); $this->form->addItem($form_login); $form_passwd = new ilPasswordInputGUI($lng->txt('password'), 'password'); $form_passwd->setRequired(true); $form_passwd->setRetype(false); $this->form->addItem($form_passwd); //Address to SWITCH Cave Server $form_cave = new ilTextInputGUI($this->getPluginObject()->txt('cave'), 'cave'); $form_cave->setRequired(true); // you can choose the mode for the creation of user-accounts at AdobeServer: the AC-Loginname could be the users-email-address or the ilias-loginname $radio_group = new ilRadioGroupInputGUI($this->getPluginObject()->txt('user_assignment_mode'), 'user_assignment_mode'); $radio_option_1 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_email'), 'assign_user_email'); $radio_group->addOption($radio_option_1); $radio_option_2 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_ilias_login'), 'assign_ilias_login'); $radio_group->addOption($radio_option_2); $radio_option_3 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_switch_aai_login'), 'assign_breezeSession'); $radio_option_3->addSubItem($form_cave); $radio_group->addOption($radio_option_3); $radio_group->setInfo($this->getPluginObject()->txt('assignment_info')); $radio_option_4 = new ilRadioOption($this->getPluginObject()->txt('assign_users_with_email_dfn'), 'assign_dfn_email'); $radio_group->addOption($radio_option_4); if (ilAdobeConnectServer::getSetting('user_assignment_mode') != NULL) { $radio_group->setDisabled(true); } $this->form->addItem($radio_group); $auth_radio_grp = new ilRadioGroupInputGUI($this->getPluginObject()->txt('auth_mode'), 'auth_mode'); $auth_radio_opt_1 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_password'), 'auth_mode_password'); $auth_radio_grp->addOption($auth_radio_opt_1); $auth_radio_opt_2 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_header'), 'auth_mode_header'); $form_x_user_id = new ilTextInputGUI($this->getPluginObject()->txt('x_user_id_header_var'), 'x_user_id'); $form_x_user_id->setInfo($this->getPluginObject()->txt('xavc_x_user_id_info')); $auth_radio_opt_2->addSubItem($form_x_user_id); $auth_radio_grp->addOption($auth_radio_opt_2); $auth_radio_opt_3 = new ilRadioOption($this->getPluginObject()->txt('auth_mode_switchaai'), 'auth_mode_switchaai'); $switchaai_checkbox_grp = new ilCheckboxGroupInputGUI($this->getPluginObject()->txt('auth_mode_switchaai_accounts'), 'auth_mode_switchaai_account_type'); $switchaai_checkbox_grp->addOption(new ilCheckboxOption($this->getPluginObject()->txt('auth_mode_switchaai_local'), AUTH_LOCAL)); $switchaai_checkbox_grp->addOption(new ilCheckboxOption($this->getPluginObject()->txt('auth_mode_switchaai_ldap'), AUTH_LDAP)); $auth_radio_opt_3->addSubItem($switchaai_checkbox_grp); $auth_radio_grp->addOption($auth_radio_opt_3); $form_auth_mode_dfn = new ilRadioOption($this->getPluginObject()->txt('auth_mode_dfn'), 'auth_mode_dfn'); $auth_radio_grp->addOption($form_auth_mode_dfn); $auth_radio_grp->setInfo($this->getPluginObject()->txt('authentification_mode_info')); $this->form->addItem($auth_radio_grp); $form_lead_time = new ilNumberInputGUI($this->getPluginObject()->txt('schedule_lead_time'), 'schedule_lead_time'); $form_lead_time->setDecimals(0); $form_lead_time->setMinValue(0); $form_lead_time->setRequired(true); $form_lead_time->setSize(5); $form_lead_time->setInfo($this->getPluginObject()->txt('schedule_lead_time_info')); $this->form->addItem($form_lead_time); $head_line = new ilFormSectionHeaderGUI(); $head_line->setTitle($this->getPluginObject()->txt('presentation_server_settings')); $this->form->addItem($head_line); $form_fe_server = new ilTextInputGUI($this->getPluginObject()->txt('presentation_server'), 'presentation_server'); $form_fe_server->setRequired(true); $form_fe_server->setInfo($this->getPluginObject()->txt('xavc_presentation_host_info')); $this->form->addItem($form_fe_server); $form_fe_port = new ilNumberInputGUI($this->getPluginObject()->txt('presentation_port'), 'presentation_port'); $form_fe_port->setSize(5); $form_fe_port->setMaxLength(5); $form_fe_port->setInfo($this->getPluginObject()->txt('xavc_presentation_port_info')); $this->form->addItem($form_fe_port); }
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; }
/** * @param ilPropertyFormGUI $form * @return ilPropertyFormGUI */ public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form) { // shuffle answers $shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_answers_enabled"); $shuffleAnswers->setChecked($this->object->isShuffleAnswersEnabled()); $form->addItem($shuffleAnswers); if (!$this->object->getSelfAssessmentEditingMode()) { // answer mode (single-/multi-line) $answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type'); $answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng)); $answerType->setValue($this->object->getAnswerType()); $form->addItem($answerType); } if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType())) { // thumb size $thumbSize = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_size'); $thumbSize->setSuffix($this->lng->txt("thumb_size_unit_pixel")); $thumbSize->setInfo($this->lng->txt('thumb_size_info')); $thumbSize->setDecimals(false); $thumbSize->setMinValue(20); $thumbSize->setSize(6); $thumbSize->setValue($this->object->getThumbSize()); $form->addItem($thumbSize); } // option label $optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label'); $optionLabel->setInfo($this->lng->txt('option_label_info')); $optionLabel->setRequired(true); $optionLabel->setValue($this->object->getOptionLabel()); foreach ($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText) { $option = new ilRadioOption($labelText, $labelValue); $optionLabel->addOption($option); if ($this->object->isCustomOptionLabel($labelValue)) { $customLabelTrue = new ilTextInputGUI($this->lng->txt('option_label_custom_true'), 'option_label_custom_true'); $customLabelTrue->setValue($this->object->getCustomTrueOptionLabel()); $option->addSubItem($customLabelTrue); $customLabelFalse = new ilTextInputGUI($this->lng->txt('option_label_custom_false'), 'option_label_custom_false'); $customLabelFalse->setValue($this->object->getCustomFalseOptionLabel()); $option->addSubItem($customLabelFalse); } } $form->addItem($optionLabel); // points $points = new ilNumberInputGUI($this->lng->txt('points'), 'points'); $points->setRequired(true); $points->setSize(3); $points->allowDecimals(true); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $points->setValue($this->object->getPoints()); $form->addItem($points); // score partial solution $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled'); $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info')); $scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled()); $form->addItem($scorePartialSolution); return $form; }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // subtype $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type"); $subtype->setRequired(true); $a_form->addItem($subtype); // #10652 $opt = new ilRadioOption($this->lng->txt('non_ratio'), SurveyMetricQuestion::SUBTYPE_NON_RATIO, $this->lng->txt("metric_subtype_description_interval")); $subtype->addOption($opt); // minimum value $minimum1 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3"); $minimum1->setRequired(false); $minimum1->setSize(6); $opt->addSubItem($minimum1); // maximum value $maximum1 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3"); $maximum1->setRequired(false); $maximum1->setSize(6); $opt->addSubItem($maximum1); $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE, $this->lng->txt("metric_subtype_description_rationonabsolute")); $subtype->addOption($opt); // minimum value $minimum2 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4"); $minimum2->setRequired(false); $minimum2->setSize(6); $minimum2->setMinValue(0); $opt->addSubItem($minimum2); // maximum value $maximum2 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4"); $maximum2->setRequired(false); $maximum2->setSize(6); $opt->addSubItem($maximum2); $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE, $this->lng->txt("metric_subtype_description_ratioabsolute")); $subtype->addOption($opt); // minimum value $minimum3 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5"); $minimum3->setRequired(false); $minimum3->setSize(6); $minimum3->setMinValue(0); $minimum3->setDecimals(0); $opt->addSubItem($minimum3); // maximum value $maximum3 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5"); $maximum3->setDecimals(0); $maximum3->setRequired(false); $maximum3->setSize(6); $opt->addSubItem($maximum3); // values $subtype->setValue($this->object->getSubtype()); switch ($this->object->getSubtype()) { case SurveyMetricQuestion::SUBTYPE_NON_RATIO: $minimum1->setValue($this->object->getMinimum()); $maximum1->setValue($this->object->getMaximum()); break; case SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE: $minimum2->setValue($this->object->getMinimum()); $maximum2->setValue($this->object->getMaximum()); break; case SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE: $minimum3->setValue($this->object->getMinimum()); $maximum3->setValue($this->object->getMaximum()); break; } }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // shuffle $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } if (!$this->object->getSelfAssessmentEditingMode()) { $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline; // Answer types $types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types"); $types->setRequired(false); $types->setValue($isSingleline ? 0 : 1); $types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline'))); $form->addItem($types); } if ($isSingleline) { // thumb size $thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size"); $thumb_size->setMinValue(20); $thumb_size->setDecimals(0); $thumb_size->setSize(6); $thumb_size->setInfo($this->lng->txt('thumb_size_info')); $thumb_size->setValue($this->object->getThumbSize()); $thumb_size->setRequired(false); $form->addItem($thumb_size); return $isSingleline; } return $isSingleline; }
/** * 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); } }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // maxchars $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setInfo($this->lng->txt('qpl_maxchars_info_numeric_question')); $maxchars->setSize(10); $maxchars->setDecimals(0); $maxchars->setMinValue(1); $maxchars->setRequired(true); if ($this->object->getMaxChars() > 0) { $maxchars->setValue($this->object->getMaxChars()); } $form->addItem($maxchars); }
/** * Init the form for Learning progress settings */ protected function initFormLPSettings() { global $ilSetting, $lng, $ilCtrl; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->txt('lp_settings')); $rg = new ilRadioGroupInputGUI($this->txt('lp_mode'), 'lp_mode'); $rg->setRequired(true); $rg->setValue($this->object->getLPMode()); $ro = new ilRadioOption($this->txt('lp_inactive'), ilObjExternalContent::LP_INACTIVE, $this->txt('lp_inactive_info')); $rg->addOption($ro); $ro = new ilRadioOption($this->txt('lp_active'), ilObjExternalContent::LP_ACTIVE, $this->txt('lp_active_info')); $ni = new ilNumberInputGUI($this->txt('lp_threshold'), 'lp_threshold'); $ni->setMinValue(0); $ni->setMaxValue(1); $ni->setDecimals(2); $ni->setSize(4); $ni->setRequired(true); $ni->setValue($this->object->getLPThreshold()); $ni->setInfo($this->txt('lp_threshold_info')); $ro->addSubItem($ni); $rg->addOption($ro); $form->addItem($rg); $form->addCommandButton('updateLPSettings', $lng->txt('save')); $this->form = $form; }