/** * Creates an output of the edit form for the question * * @access public */ function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $orderingtype = array_key_exists('ordering_type', $_POST) ? $_POST['ordering_type'] : $this->object->getOrderingType(); if (strcmp($this->ctrl->getCmd(), 'changeToText') == 0) { $orderingtype = OQ_TERMS; } if (strcmp($this->ctrl->getCmd(), 'changeToPictures') == 0) { $orderingtype = OQ_PICTURES; } $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE); $form->setTableWidth("100%"); $form->setId("ordering"); // Edit mode $hidden = new ilHiddenInputGUI("ordering_type"); $hidden->setValue($orderingtype); $form->addItem($hidden); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); if (!$this->getSelfAssessmentEditingMode()) { $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height"); $element_height->setValue($this->object->getElementHeight()); $element_height->setRequired(false); $element_height->setMaxLength(6); $element_height->setMinValue(20); $element_height->setSize(6); $element_height->setInfo($this->lng->txt("element_height_info")); $form->addItem($element_height); } if ($orderingtype == OQ_PICTURES) { $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry"); $geometry->setValue($this->object->getThumbGeometry()); $geometry->setRequired(true); $geometry->setMaxLength(6); $geometry->setMinValue(20); $geometry->setSize(6); $geometry->setInfo($this->lng->txt("thumb_geometry_info")); $form->addItem($geometry); } if (count($this->object->getAnswers()) == 0) { $this->object->addAnswer(); } // Answers if ($orderingtype == OQ_PICTURES) { include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php"; $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setQuestionObject($this->object); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } $answers->setValues($answervalues); $form->addItem($answers); } else { $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } ksort($answervalues); $answers->setValues($answervalues); $form->addItem($answers); } // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); if (true || !$this->getSelfAssessmentEditingMode()) { if ($orderingtype == OQ_PICTURES) { $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); } else { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); } } $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("asstextquestion"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // maxchars $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setSize(5); if ($this->object->getMaxNumOfChars() > 0) { $maxchars->setValue($this->object->getMaxNumOfChars()); } $maxchars->setInfo($this->lng->txt("description_maxchars")); $form->addItem($maxchars); if (!$this->getSelfAssessmentEditingMode()) { if ($this->object->getAnswerCount() == 0) { $this->object->addAnswer("", 0, 0, 0); } $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode'); $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc')); $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc')); $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc')); $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc')); $scoringMode->addOption($scoringOptionNone); $scoringMode->addOption($scoringOptionAnyKeyword); $scoringMode->addOption($scoringOptionAllKeyword); $scoringMode->addOption($scoringOptionOneKeyword); $scoringMode->setRequired(true); $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non'); require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php"; // Without Keywords $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points"); $nonKeywordPoints->setValue($this->object->getPoints()); $nonKeywordPoints->setRequired(TRUE); $nonKeywordPoints->setSize(3); $nonKeywordPoints->setMinValue(0.0); $nonKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionNone->addSubItem($nonKeywordPoints); // Any Keyword $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword"); $anyKeyword->setRequired(TRUE); $anyKeyword->setQuestionObject($this->object); $anyKeyword->setSingleline(TRUE); $anyKeyword->setValues($this->object->getAnswers()); $scoringOptionAnyKeyword->addSubItem($anyKeyword); // All Keywords $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword"); $allKeyword->setRequired(TRUE); //$allKeyword->setQuestionObject($this->object); //$allKeyword->setSingleline(TRUE); $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionAllKeyword->addSubItem($allKeyword); $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points"); $allKeywordPoints->setValue($this->object->getPoints()); $allKeywordPoints->setRequired(TRUE); $allKeywordPoints->setSize(3); $allKeywordPoints->setMinValue(0.0); $allKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionAllKeyword->addSubItem($allKeywordPoints); // One Keywords $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword"); $oneKeyword->setRequired(TRUE); //$oneKeyword->setQuestionObject($this->object); //$oneKeyword->setSingleline(TRUE); $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionOneKeyword->addSubItem($oneKeyword); $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points"); $oneKeywordPoints->setValue($this->object->getPoints()); $oneKeywordPoints->setRequired(TRUE); $oneKeywordPoints->setSize(3); $oneKeywordPoints->setMinValue(0.0); $oneKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionOneKeyword->addSubItem($oneKeywordPoints); $form->addItem($scoringMode); } $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; }
public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form) { $orderingtype = $this->getOrderingTypeFromPost(); if (count($this->object->getAnswers()) == 0) { $this->object->addAnswer(); } if ($orderingtype == OQ_PICTURES) { $answerImageUpload = $this->getAnswerImageFileUploadWizardFormProperty(); if ($this->uploadAlert !== null) { $answerImageUpload->setAlert($this->uploadAlert); } $form->addItem($answerImageUpload); } else { if ($orderingtype == OQ_NESTED_TERMS || $orderingtype == OQ_NESTED_PICTURES) { require_once 'Modules/TestQuestionPool/classes/class.ilNestedOrderingGUI.php'; $answers = new ilNestedOrderingGUI($this->lng->txt("answers"), "answers"); $answers->setOrderingType($orderingtype); $answers->setObjAnswersArray($this->object->getAnswers()); if ($orderingtype == OQ_NESTED_PICTURES) { $answers->setImagePath($this->object->getImagePath()); $answers->setImagePathWeb($this->object->getImagePathWeb()); $answers->setThumbPrefix($this->object->getThumbPrefix()); } $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $form->addItem($answers); } else { $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers"); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } ksort($answervalues); $answers->setValues($answervalues); $answers->setAllowMove(TRUE); $answers->setRequired(TRUE); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $form->addItem($answers); } } return $form; }
/** * Init field form * * @param string $a_mode * @return ilPropertyFormGUI */ function initForm($a_mode = "create") { global $ilCtrl, $lng; include_once "Services/Membership/classes/class.ilMemberAgreement.php"; if (ilMemberAgreement::_hasAgreements()) { $lng->loadLanguageModule("ps"); ilUtil::sendInfo($lng->txt("ps_warning_modify")); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $name = new ilTextInputGUI($lng->txt("field_name"), "name"); $name->setRequired(true); $form->addItem($name); // type $radg = new ilRadioGroupInputGUI($lng->txt("field_type"), "field_type"); $radg->setRequired(true); $op1 = new ilRadioOption($lng->txt("udf_type_text"), UDF_TYPE_TEXT); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("udf_type_select"), UDF_TYPE_SELECT); $radg->addOption($op2); $op3 = new ilRadioOption($lng->txt("udf_type_wysiwyg"), UDF_TYPE_WYSIWYG); $radg->addOption($op3); $form->addItem($radg); // select values $se_mu = new ilTextWizardInputGUI($lng->txt("value"), "selvalue"); $se_mu->setRequired(true); $se_mu->setSize(32); $se_mu->setMaxLength(128); $se_mu->setValues(array('')); $op2->addSubItem($se_mu); // access $acc = new ilCheckboxGroupInputGUI($lng->txt("access"), "access"); $acc_values = array(); foreach ($this->getAccessOptions() as $id => $caption) { $opt = new ilCheckboxOption($caption, $id); $acc->addOption($opt); if ($this->field_definition && $this->field_definition[$id]) { $acc_values[] = $id; } } $form->addItem($acc); if ($a_mode == "create") { $radg->setValue(UDF_TYPE_TEXT); $form->setTitle($lng->txt('add_new_user_defined_field')); $form->addCommandButton("create", $lng->txt("save")); $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel")); } else { $name->setValue($this->field_definition["field_name"]); $radg->setValue($this->field_definition["field_type"]); $radg->setDisabled(true); $acc->setValue($acc_values); switch ($this->field_definition["field_type"]) { case UDF_TYPE_SELECT: $se_mu->setValue($this->field_definition["field_values"]); $form->setTitle($lng->txt("udf_update_select_field")); break; case UDF_TYPE_TEXT: $form->setTitle($lng->txt("udf_update_text_field")); break; case UDF_TYPE_WYSIWYG: $form->setTitle($lng->txt("udf_update_wysiwyg_field")); break; } $form->addCommandButton("update", $lng->txt("save")); $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel")); } return $form; }
/** * Init field form * * @param string $a_mode * @return ilPropertyFormGUI */ function initForm($a_mode = "create") { global $ilCtrl, $lng; include_once "Services/Membership/classes/class.ilMemberAgreement.php"; if (ilMemberAgreement::_hasAgreements()) { $lng->loadLanguageModule("ps"); ilUtil::sendInfo($lng->txt("ps_warning_modify")); } if ($this->field_definition) { $perms = $this->permissions->hasPermissions(ilUDFPermissionHelper::CONTEXT_FIELD, $this->field_definition["field_id"], array(array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY, ilUDFPermissionHelper::SUBACTION_FIELD_TITLE), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY, ilUDFPermissionHelper::SUBACTION_FIELD_PROPERTIES), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_PERSONAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_REGISTRATION), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_LOCAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_COURSES), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_GROUPS), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CHANGEABLE_PERSONAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CHANGEABLE_LOCAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_REQUIRED), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_EXPORT), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_SEARCHABLE), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CERTIFICATE))); $perm_map = self::getAccessPermissions(); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $name = new ilTextInputGUI($lng->txt("field_name"), "name"); $name->setRequired(true); $form->addItem($name); if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY][ilUDFPermissionHelper::SUBACTION_FIELD_TITLE]) { $name->setDisabled(true); } // type $radg = new ilRadioGroupInputGUI($lng->txt("field_type"), "field_type"); $radg->setRequired(true); $op1 = new ilRadioOption($lng->txt("udf_type_text"), UDF_TYPE_TEXT); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("udf_type_select"), UDF_TYPE_SELECT); $radg->addOption($op2); $op3 = new ilRadioOption($lng->txt("udf_type_wysiwyg"), UDF_TYPE_WYSIWYG); $radg->addOption($op3); $form->addItem($radg); // select values $se_mu = new ilTextWizardInputGUI($lng->txt("value"), "selvalue"); $se_mu->setRequired(true); $se_mu->setSize(32); $se_mu->setMaxLength(128); $se_mu->setValues(array('')); $op2->addSubItem($se_mu); if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY][ilUDFPermissionHelper::SUBACTION_FIELD_PROPERTIES]) { $se_mu->setDisabled(true); $se_mu->setRequired(false); } // access $acc = new ilCheckboxGroupInputGUI($lng->txt("access"), "access"); $acc_values = array(); foreach ($this->getAccessOptions() as $id => $caption) { $opt = new ilCheckboxOption($caption, $id); $acc->addOption($opt); if ($this->field_definition && $this->field_definition[$id]) { $acc_values[] = $id; } if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS][$perm_map[$id]]) { $opt->setDisabled(true); } } $form->addItem($acc); if ($a_mode == "create") { $radg->setValue(UDF_TYPE_TEXT); $form->setTitle($lng->txt('add_new_user_defined_field')); $form->addCommandButton("create", $lng->txt("save")); $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel")); } else { $name->setValue($this->field_definition["field_name"]); $radg->setValue($this->field_definition["field_type"]); $radg->setDisabled(true); $acc->setValue($acc_values); switch ($this->field_definition["field_type"]) { case UDF_TYPE_SELECT: $se_mu->setValue($this->field_definition["field_values"]); $form->setTitle($lng->txt("udf_update_select_field")); break; case UDF_TYPE_TEXT: $form->setTitle($lng->txt("udf_update_text_field")); break; case UDF_TYPE_WYSIWYG: $form->setTitle($lng->txt("udf_update_wysiwyg_field")); break; } $form->addCommandButton("update", $lng->txt("save")); $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel")); } return $form; }
public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form) { $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode'); $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc')); $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc')); $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc')); $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc')); $scoringMode->addOption($scoringOptionNone); $scoringMode->addOption($scoringOptionAnyKeyword); $scoringMode->addOption($scoringOptionAllKeyword); $scoringMode->addOption($scoringOptionOneKeyword); $scoringMode->setRequired(true); $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non'); if ($this->object->getAnswerCount() == 0) { $this->object->addAnswer("", 1, 0, 0); } require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php"; // Without Keywords $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points"); $nonKeywordPoints->allowDecimals(true); $nonKeywordPoints->setValue($this->object->getPoints()); $nonKeywordPoints->setRequired(TRUE); $nonKeywordPoints->setSize(3); $nonKeywordPoints->setMinValue(0.0); $nonKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionNone->addSubItem($nonKeywordPoints); // Any Keyword $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword"); $anyKeyword->setRequired(TRUE); $anyKeyword->setQuestionObject($this->object); $anyKeyword->setSingleline(TRUE); $anyKeyword->setValues($this->object->getAnswers()); $scoringOptionAnyKeyword->addSubItem($anyKeyword); // All Keywords $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword"); $allKeyword->setRequired(TRUE); //$allKeyword->setQuestionObject($this->object); //$allKeyword->setSingleline(TRUE); $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionAllKeyword->addSubItem($allKeyword); $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points"); $allKeywordPoints->allowDecimals(true); $allKeywordPoints->setValue($this->object->getPoints()); $allKeywordPoints->setRequired(TRUE); $allKeywordPoints->setSize(3); $allKeywordPoints->setMinValue(0.0); $allKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionAllKeyword->addSubItem($allKeywordPoints); // One Keywords $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword"); $oneKeyword->setRequired(TRUE); //$oneKeyword->setQuestionObject($this->object); //$oneKeyword->setSingleline(TRUE); $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionOneKeyword->addSubItem($oneKeyword); $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points"); $oneKeywordPoints->allowDecimals(true); $oneKeywordPoints->setValue($this->object->getPoints()); $oneKeywordPoints->setRequired(TRUE); $oneKeywordPoints->setSize(3); $oneKeywordPoints->setMinValue(0.0); $oneKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionOneKeyword->addSubItem($oneKeywordPoints); $form->addItem($scoringMode); }
/** * Show objective creation form */ protected function initSimpleObjectiveForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('crs_loc_form_create_objectives')); $form->setFormAction($this->ctrl->getFormAction($this)); $txt = new ilTextWizardInputGUI($this->lng->txt('crs_objectives'), 'objectives'); $txt->setValues(array(0 => '')); $txt->setRequired(true); $form->addItem($txt); $form->addCommandButton('saveObjectiveCreation', $this->lng->txt('save')); return $form; }
/** * Init/create property form for fields * @return */ protected function initFieldForm($a_mode) { if ($this->form instanceof ilPropertyFormGUI) { return true; } include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); switch ($a_mode) { case self::MODE_CREATE: $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('ps_cdf_add_field')); $this->form->addCommandButton('saveField', $this->lng->txt('save')); $this->form->addCommandButton('listFields', $this->lng->txt('cancel')); break; case self::MODE_UPDATE: $this->ctrl->setParameter($this, 'field_id', (int) $_REQUEST['field_id']); $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('ps_cdf_edit_field')); $this->form->addCommandButton('updateField', $this->lng->txt('save')); $this->form->addCommandButton('listFields', $this->lng->txt('cancel')); break; } // Name $na = new ilTextInputGUI($this->lng->txt('ps_cdf_name'), 'na'); $na->setSize(32); $na->setMaxLength(255); $na->setRequired(true); $this->form->addItem($na); // Type $ty = new ilRadioGroupInputGUI($this->lng->txt('ps_field_type'), 'ty'); $ty->setRequired(true); $this->form->addItem($ty); // Text type $ty_te = new ilRadioOption($this->lng->txt('ps_type_txt_long'), IL_CDF_TYPE_TEXT); $ty->addOption($ty_te); // Select Type $ty_se = new ilRadioOption($this->lng->txt('ps_type_select_long'), IL_CDF_TYPE_SELECT); $ty->addOption($ty_se); // Select Type Values $ty_se_mu = new ilTextWizardInputGUI($this->lng->txt('ps_cdf_value'), 'va'); $ty_se_mu->setRequired(true); $ty_se_mu->setSize(32); $ty_se_mu->setMaxLength(128); $ty_se->addSubItem($ty_se_mu); // Required $re = new ilCheckboxInputGUI($this->lng->txt('ps_cdf_required'), 're'); $re->setValue(1); $this->form->addItem($re); }