/** * Creates an output of the edit form for the question * @access public */ function editQuestion() { global $ilDB, $tpl; $plugin = $this->object->getPlugin(); $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("assJSMEQuestion"); // Basiseingabefelder: title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // points $points = new ilNumberInputGUI($plugin->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(10); $points->setMinValue(0.0); $form->addItem($points); // optionString for the JSME-Applet include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $optionString = new ilTextInputGUI($plugin->txt("optionString"), "optionString"); $optionString->setValue($this->object->getOptionString()); $form->addItem($optionString); // JSME-Applet for sampleSolution include_once "./Services/Form/classes/class.ilCustomInputGUI.php"; $sampleSolution = new ilCustomInputGUI($plugin->txt("sampleSolution"), "sampleSolution"); $template = $this->getJsmeOutputTemplate("", $this->object->getOptionString(), $this->object->getSampleSolution()); $sampleSolution->setHtml($template->get()); $form->addItem($sampleSolution); $form->addCommandButton('save', $plugin->txt("save")); $this->tpl->setVariable("QUESTION_DATA", $form->getHTML()); }
/** * Creates an output of the edit form for the question * * @param bool $checkonly * * @return bool */ 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); $this->populateQuestionSpecificFormPart($form); $this->populateAnswerSpecificFormPart($form); $this->populateTaxonomyFormSection($form); $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 initUploadForm() { global $ilCtrl, $lng; include_once "./Services/Form/classes/class.ilDragDropFileInputGUI.php"; include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; $this->form = new ilPropertyFormGUI(); $this->form->setId("upload"); $this->form->setMultipart(true); $this->form->setHideLabels(); $file = new ilDragDropFileInputGUI($lng->txt("cld_upload_flies"), "upload_files"); $file->setRequired(true); $this->form->addItem($file); $this->form->addCommandButton("uploadFiles", $lng->txt("upload")); $this->form->addCommandButton("cancelAll", $lng->txt("cancel")); $this->form->setTableWidth("100%"); $this->form->setTitle($lng->txt("upload_files_title")); $this->form->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $lng->txt('obj_file')); $this->form->setTitle($lng->txt("upload_files")); $this->form->setFormAction($ilCtrl->getFormAction($this, "uploadFiles")); $this->form->setTarget("cld_blank_target"); }
/** * Creates an output of the edit form for the question * * @param bool $checkonly * * @return bool */ 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("assmultiplechoice"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); $this->populateQuestionSpecificFormPart($form); $this->populateAnswerSpecificFormPart($form); $this->populateTaxonomyFormSection($form); $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; }
/** * Init Social Bookmark edit/create Form * * @param ilObjectGUI $formhandlerObject taken as form target * @param int $mode "create" / "edit" */ public static function _initForm($formhandlerObject, $mode = "create", $id = 0) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setMultipart(true); // File Title $in_title = new ilTextInputGUI($lng->txt("title"), "title"); $in_title->setMaxLength(128); $in_title->setSize(40); $in_title->setRequired(true); $form->addItem($in_title); // Link $in_link = new ilTextInputGUI($lng->txt("link"), "link"); $in_link->setMaxLength(300); $in_link->setSize(40); $in_link->setRequired(true); $in_link->setInfo($lng->txt('socialbm_link_description')); $form->addItem($in_link); // File $in_file = new ilFileInputGUI($lng->txt("file"), "image_file"); $in_file->setSuffixes(array('bmp', 'gif', 'jpg', 'jpeg', 'png')); $form->addItem($in_file); // Activate on submit $in_activate = new ilCheckboxInputGUI($lng->txt("activate"), "activate"); $in_activate->setValue('1'); $form->addItem($in_activate); // save and cancel commands if ($mode == "create") { $form->addCommandButton("createSocialBookmark", $lng->txt("create")); $form->addCommandButton("editSocialBookmarks", $lng->txt("cancel")); $form->setTitle($lng->txt("adm_social_bm_create")); $in_file->setRequired(true); } else { if ($mode == "update") { $in_hidden = new ilHiddenInputGUI("sbm_id", $id); $form->addItem($in_hidden); $form->addCommandButton("updateSocialBookmark", $lng->txt("update")); $form->addCommandButton("cancel", $lng->txt("cancel")); $form->setTitle($lng->txt("adm_social_bm_edit")); $in_file->setRequired(false); } } $form->setTableWidth("60%"); $form->setFormAction($ilCtrl->getFormAction($formhandlerObject)); return $form; }
/** * Initializes the upload form for multiple files. * * @return object The created property form. */ public function initMultiUploadForm() { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $dnd_form_gui = new ilPropertyFormGUI(); $dnd_form_gui->setMultipart(true); $dnd_form_gui->setHideLabels(); // file input include_once "Services/Form/classes/class.ilDragDropFileInputGUI.php"; $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files"); $dnd_input->setArchiveSuffixes(array("zip")); $dnd_input->setCommandButtonNames("uploadFiles", "cancel"); $dnd_form_gui->addItem($dnd_input); // add commands $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files")); $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel")); $dnd_form_gui->setTableWidth("100%"); $dnd_form_gui->setTarget($this->getTargetFrame("save")); $dnd_form_gui->setTitle($this->lng->txt("upload_files_title")); $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file')); $this->ctrl->setParameter($this, "new_type", "file"); $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles")); return $dnd_form_gui; }
/** * 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("assfileupload"); $this->addBasicQuestionFormProperties($form); // maxsize $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize"); $maxsize->setValue($this->object->getMaxSize()); $maxsize->setInfo($this->lng->txt("maxsize_info")); $maxsize->setSize(10); $maxsize->setMinValue(0); //mbecker: Quick fix for mantis bug 8595: Change size file $umf = get_cfg_var("upload_max_filesize"); // get the value for the maximal post data from the php.ini (if available) $pms = get_cfg_var("post_max_size"); //convert from short-string representation to "real" bytes $multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024); $umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if (count($umf_parts) == 2) { $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]]; } if (count($pms_parts) == 2) { $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]]; } // use the smaller one as limit $max_filesize = min($umf, $pms); if (!$max_filesize) { $max_filesize = max($umf, $pms); } $maxsize->setMaxValue($max_filesize); // end quick fix $maxsize->setRequired(FALSE); $form->addItem($maxsize); // allowedextensions $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions"); $allowedextensions->setInfo($this->lng->txt("allowedextensions_info")); $allowedextensions->setValue($this->object->getAllowedExtensions()); $allowedextensions->setRequired(FALSE); $form->addItem($allowedextensions); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(false); $form->addItem($points); $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission'); $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info')); $subcompl->setValue(1); $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled()); $form->addItem($subcompl); $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("assimagemap"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // image include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php"; $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image'); $image->setRequired(true); if (strlen($this->object->getImageFilename())) { $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename()); $image->setValue($this->object->getImageFilename()); $image->setAreas($this->object->getAnswers()); $assessmentSetting = new ilSetting("assessment"); $linecolor = strlen($assessmentSetting->get("imap_line_color")) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\""; $image->setLineColor($linecolor); $image->setImagePath($this->object->getImagePath()); $image->setImagePathWeb($this->object->getImagePathWeb()); } $form->addItem($image); // imagemapfile $imagemapfile = new ilFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile'); $imagemapfile->setRequired(false); $form->addItem($imagemapfile); $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 = ((strcmp($this->ctrl->getCmd(), "save") == 0) || (strcmp($this->ctrl->getCmd(), "saveEdit") == 0)) ? TRUE : 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("flash"); $this->addBasicQuestionFormProperties($form); // flash file $flash = new ilFlashFileInputGUI($this->lng->txt("flashfile"), "flash"); $flash->setRequired(TRUE); if (strlen($this->object->getApplet())) { $flash->setApplet($this->object->getApplet()); $flash->setAppletPathWeb($this->object->getFlashPathWeb()); } $flash->setWidth($this->object->getWidth()); $flash->setHeight($this->object->getHeight()); $flash->setParameters($this->object->getParameters()); $form->addItem($flash); if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } // 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); $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(FALSE); $form->setTableWidth("100%"); $form->setId("orderinghorizontal"); $this->addBasicQuestionFormProperties($form); // errortext $errortext = new ilTextAreaInputGUI($this->lng->txt("errortext"), "errortext"); $errortext->setValue(ilUtil::prepareFormOutput($this->object->getErrorText())); $errortext->setRequired(TRUE); $errortext->setInfo($this->lng->txt("errortext_info")); $errortext->setRows(10); $errortext->setCols(80); $form->addItem($errortext); if (!$this->getSelfAssessmentEditingMode()) { // textsize $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize"); $textsize->setValue(strlen($this->object->getTextSize()) ? $this->object->getTextSize() : 100.0); $textsize->setInfo($this->lng->txt("textsize_errortext_info")); $textsize->setSize(6); $textsize->setSuffix("%"); $textsize->setMinValue(10); $textsize->setRequired(true); $form->addItem($textsize); } if (count($this->object->getErrorData()) || $checkonly) { $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("errors_section")); $form->addItem($header); include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php"; $errordata = new ilErrorTextWizardInputGUI($this->lng->txt("errors"), "errordata"); $values = array(); $errordata->setKeyName($this->lng->txt('text_wrong')); $errordata->setValueName($this->lng->txt('text_correct')); $errordata->setValues($this->object->getErrorData()); $form->addItem($errordata); // points for wrong selection $points_wrong = new ilNumberInputGUI($this->lng->txt("points_wrong"), "points_wrong"); $points_wrong->setValue($this->object->getPointsWrong()); $points_wrong->setInfo($this->lng->txt("points_wrong_info")); $points_wrong->setSize(6); $points_wrong->setRequired(true); $form->addItem($points_wrong); } $form->addCommandButton("analyze", $this->lng->txt('analyze_errortext')); $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; }
/** * Material tab of the survey questions */ public function material($checkonly = FALSE) { global $rbacsystem, $ilTabs; $ilTabs->activateTab("material"); $add_html = ''; if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('add_material')); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("material"); // material $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType"); $material->setRequired(true); $material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm")); $material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st")); $material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg")); $material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo")); $form->addItem($material); $form->addCommandButton("addMaterial", $this->lng->txt("add")); $errors = false; if ($checkonly) { $form->setValuesByPost(); $errors = !$form->checkInput(); if ($errors) { $checkonly = false; } } $add_html = $form->getHTML(); } $mat_html = ""; if (count($this->object->getMaterial())) { include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php"; $table_gui = new ilSurveyMaterialsTableGUI($this, 'material', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false); $data = array(); foreach ($this->object->getMaterial() as $material) { switch ($material->type) { case 0: $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']); $type = $this->lng->txt('internal_link'); break; } $title = strlen($material->title) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material'); array_push($data, array('href' => $href, 'title' => $title, 'type' => $type)); } $table_gui->setData($data); $mat_html = $table_gui->getHTML(); } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html); } return $errors; }
/** * Questionpool properties */ public function propertiesObject() { $save = strcmp($this->ctrl->getCmd(), "save") == 0 ? true : false; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'properties')); $form->setTitle($this->lng->txt("properties")); $form->setMultipart(false); $form->setId("properties"); // online $online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online"); $online->setInfo($this->lng->txt("spl_online_property_description")); $online->setChecked($this->object->getOnline()); $form->addItem($online); $form->addCommandButton("saveProperties", $this->lng->txt("save")); if ($save) { $form->checkInput(); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); }
/** * 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 * * @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("assclozetest"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // Modify "instructive" question textbox... get rid of this crap asap. $q_item = $form->getItemByPostVar("question"); $q_item->setInfo($this->lng->txt("close_text_hint")); $q_item->setTitle($this->lng->txt("cloze_text")); $this->populateQuestionSpecificFormPart($form); $this->populateAnswerSpecificFormPart($form); $this->populateTaxonomyFormSection($form); $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 * * @param boolean add a new booking to the form */ private function initQuestionForm($add_booking = false) { 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("accqst"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } // accounts XML definition $item = new ilCustomInputGUI($this->plugin->txt('accounts_xml')); $item->setInfo($this->plugin->txt('accounts_xml_info')); $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html'); $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($this->object->getAccountsXML())); $tpl->setVariable("NAME", 'accounts_xml'); $item->setHTML($tpl->get()); // upload accounts definition $subitem = new ilFileInputGUI($this->plugin->txt('accounts_file'), 'accounts_file'); $subitem->setSuffixes(array('xml')); $item->addSubItem($subitem); // download accounts definition if (strlen($this->object->getAccountsXML())) { $this->ctrl->setParameter($this, 'xmltype', 'accounts'); $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html'); $tpl->setCurrentBlock('button'); $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml')); $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_accounts_xml')); $tpl->ParseCurrentBlock(); $subitem = new ilcustomInputGUI(''); $subitem->setHTML($tpl->get()); $item->addSubItem($subitem); } $form->addItem($item); // add the existing booking parts $parts = $this->object->getParts(); $i = 1; foreach ($parts as $part_obj) { $this->initPartProperties($form, $part_obj, $i++); if ($part_obj->getPartId() == 0) { // new booking is already posted $add_booking = false; } } // add a new booking part if (count($parts) == 0 or $add_booking == true) { $this->initPartProperties($form, null, $i); } else { $form->addCommandButton('saveAddBooking', $this->plugin->txt('add_booking')); } $this->populateTaxonomyFormSection($form); $this->addQuestionFormCommandButtons($form); $this->form = $form; }
public function phraseEditor($checkonly = FALSE) { $save = strcmp($this->ctrl->getCmd(), "saveEditPhrase") == 0 ? TRUE : FALSE; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'phraseEditor')); $form->setTitle($this->lng->txt('edit_phrase')); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("phraseeditor"); $phrase_id = $_GET['p_id']; // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->getPhraseTitle($phrase_id)); $title->setRequired(TRUE); $form->addItem($title); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(true); $answers->setAllowMove(true); $answers->setShowWizard(false); $answers->setShowSavePhrase(false); $answers->setUseOtherAnswer(false); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer')); include_once "./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php"; $categories =& $this->getCategoriesForPhrase($phrase_id); if (!$categories->getCategoryCount()) { $categories->addCategory(""); } $answers->setValues($categories); $answers->setDisabledScale(true); $form->addItem($answers); $form->addCommandButton("saveEditPhrase", $this->lng->txt("save")); $form->addCommandButton("cancelEditPhrase", $this->lng->txt("cancel")); $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("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * init info editor * * @access public * @param * */ public function initInfoEditor() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo')); $form->setMultipart(true); $form->setTitle($this->lng->txt('crs_general_info')); $form->addCommandButton('updateInfo', $this->lng->txt('save')); $form->addCommandButton('cancel', $this->lng->txt('cancel')); $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'), 'important'); $area->setValue($this->object->getImportantInformation()); $area->setRows(6); $area->setCols(80); $form->addItem($area); $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'), 'syllabus'); $area->setValue($this->object->getSyllabus()); $area->setRows(6); $area->setCols(80); $form->addItem($area); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('crs_info_download')); $form->addItem($section); $file = new ilFileInputGUI($this->lng->txt('crs_file'), 'file'); $file->enableFileNameSelection('file_name'); $form->addItem($file); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('crs_contact')); $form->addItem($section); $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'), 'contact_name'); $text->setValue($this->object->getContactName()); $text->setSize(40); $text->setMaxLength(70); $form->addItem($text); $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'), 'contact_responsibility'); $text->setValue($this->object->getContactResponsibility()); $text->setSize(40); $text->setMaxLength(70); $form->addItem($text); $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'), 'contact_phone'); $text->setValue($this->object->getContactPhone()); $text->setSize(40); $text->setMaxLength(40); $form->addItem($text); $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'), 'contact_email'); $text->setValue($this->object->getContactEmail()); $text->setInfo($this->lng->txt('crs_contact_email_info')); $text->setSize(40); $text->setMaxLength(255); $form->addItem($text); $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'), 'contact_consultation'); $area->setValue($this->object->getContactConsultation()); $area->setRows(6); $area->setCols(80); $form->addItem($area); include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php'; $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'crs', $this->object->getId()); $this->record_gui->setPropertyForm($form); $this->record_gui->parse(); 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 */ public function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); require_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $orderingtype = $this->getOrderingTypeFromPost(); $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"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); $this->populateQuestionSpecificFormPart($form); $this->populateAnswerSpecificFormPart($form); if (true || !$this->object->getSelfAssessmentEditingMode()) { if ($orderingtype == OQ_PICTURES) { $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); $form->addCommandButton("orderNestedPictures", $this->lng->txt("order_nested_pictures")); } else { if ($orderingtype == OQ_NESTED_TERMS) { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); } else { if ($orderingtype == OQ_NESTED_PICTURES) { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); } else { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); $form->addCommandButton("orderNestedTerms", $this->lng->txt("order_nested_terms")); } } } } $this->populateTaxonomyFormSection($form); $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 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("matching"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); $this->populateQuestionSpecificFormPart($form); $this->populateAnswerSpecificFormPart($form); $this->populateTaxonomyFormSection($form); $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 && count($this->object->getTerms()) < count($this->object->getDefinitions()) && !$this->object->getSelfAssessmentEditingMode()) { $errors = true; $terms = $form->getItemByPostVar('terms'); $terms->setAlert($this->lng->txt("msg_number_of_terms_too_low")); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } 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(FALSE); $form->setTableWidth("100%"); $form->setId("orderinghorizontal"); $this->addBasicQuestionFormProperties($form); // ordertext $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext"); $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText())); $ordertext->setRequired(TRUE); $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator)); $ordertext->setRows(10); $ordertext->setCols(80); $form->addItem($ordertext); // textsize $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize"); $textsize->setValue($this->object->getTextSize()); $textsize->setInfo($this->lng->txt("textsize_info")); $textsize->setSize(6); $textsize->setMinValue(10); $textsize->setRequired(FALSE); $form->addItem($textsize); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); // mbecker: Fix for mantis bug 7866: Predefined values schould make sense. // This implements a default value of "1" for this question type. if ($this->object->getPoints() == null) { $points->setValue("1"); } else { $points->setValue($this->object->getPoints()); } $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); $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(false); $subtype->setValue($this->object->getSubtype()); $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr"); foreach ($subtypes as $idx => $st) { $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx)); } $form->addItem($subtype); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_appearance")); $form->addItem($header); // column separators $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators"); $column_separators->setValue(1); $column_separators->setInfo($this->lng->txt("matrix_column_separators_description")); $column_separators->setChecked($this->object->getColumnSeparators()); $column_separators->setRequired(false); $form->addItem($column_separators); // row separators $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators"); $row_separators->setValue(1); $row_separators->setInfo($this->lng->txt("matrix_row_separators_description")); $row_separators->setChecked($this->object->getRowSeparators()); $row_separators->setRequired(false); $form->addItem($row_separators); // neutral column separators $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator"); $neutral_column_separator->setValue(1); $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description")); $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator()); $neutral_column_separator->setRequired(false); $form->addItem($neutral_column_separator); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_columns")); $form->addItem($header); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $columns = new ilCategoryWizardInputGUI("", "columns"); $columns->setRequired(false); $columns->setAllowMove(true); $columns->setShowWizard(true); $columns->setShowNeutralCategory(true); $columns->setDisabledScale(false); $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer')); $columns->setCategoryText($this->lng->txt('matrix_standard_answers')); $columns->setShowSavePhrase(true); if (!$this->object->getColumnCount()) { $this->object->columns->addCategory(""); } $columns->setValues($this->object->getColumns()); $form->addItem($columns); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_column_settings")); $form->addItem($header); // bipolar adjectives $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives")); $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description")); // left pole $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1"); $bipolar1->setValue($this->object->getBipolarAdjective(0)); $bipolar1->setRequired(false); $bipolar->addSubItem($bipolar1); // right pole $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2"); $bipolar2->setValue($this->object->getBipolarAdjective(1)); $bipolar2->setRequired(false); $bipolar->addSubItem($bipolar2); $form->addItem($bipolar); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_rows")); $form->addItem($header); // matrix rows include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php"; $rows = new ilMatrixRowWizardInputGUI("", "rows"); $rows->setRequired(false); $rows->setAllowMove(true); $rows->setLabelText($this->lng->txt('label')); $rows->setUseOtherAnswer(true); if ($this->object->getRowCount() == 0) { $this->object->getRows()->addCategory(""); } $rows->setValues($this->object->getRows()); $form->addItem($rows); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) { $form->setValuesByPost(); $errors = !$form->checkInput(); $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * Shows the certificate editor for ILIAS tests */ public function certificateEditor() { global $ilAccess; $form_fields = array(); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $form_fields = $this->getFormFieldsFromPOST(); } else { $form_fields = $this->getFormFieldsFromFO(); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("certificate_edit")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("certificate"); $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active"); $active->setChecked($form_fields["active"]); $form->addItem($active); $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import"); $import->setRequired(FALSE); $import->setSuffixes(array("zip")); // handle the certificate import if (strlen($_FILES["certificate_import"]["tmp_name"])) { if ($import->checkInput()) { $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]); if ($result == FALSE) { $import->setAlert($this->lng->txt("certificate_error_import")); } else { $this->ctrl->redirect($this, "certificateEditor"); } } } $form->addItem($import); $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat"); $pageformats = $this->object->getPageFormats(); $pageformat->setValue($form_fields["pageformat"]); foreach ($pageformats as $format) { $option = new ilRadioOption($format["name"], $format["value"]); if (strcmp($format["value"], "custom") == 0) { $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight"); $pageheight->setValue($form_fields["pageheight"]); $pageheight->setSize(6); $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pageheight->setInfo($this->lng->txt("certificate_unit_description")); $pageheight->setRequired(true); $option->addSubitem($pageheight); $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth"); $pagewidth->setValue($form_fields["pagewidth"]); $pagewidth->setSize(6); $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pagewidth->setInfo($this->lng->txt("certificate_unit_description")); $pagewidth->setRequired(true); $option->addSubitem($pagewidth); } $pageformat->addOption($option); } $pageformat->setRequired(true); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $pageformat->checkInput(); } $form->addItem($pageformat); $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background"); $bgimage->setRequired(FALSE); $bgimage->setUseCache(false); if (count($_POST)) { // handle the background upload if (strlen($_FILES["background"]["tmp_name"])) { if ($bgimage->checkInput()) { $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]); if ($result == FALSE) { $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage")); } } } } if (!$this->object->hasBackgroundImage()) { include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php"; if (ilObjCertificateSettingsAccess::hasBackgroundImage()) { $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb()); } } else { $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb()); } $form->addItem($bgimage); $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top"); $padding_top->setRequired(TRUE); $padding_top->setValue($form_fields["padding_top"]); $padding_top->setSize(6); $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $padding_top->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $padding_top->checkInput(); } $form->addItem($padding_top); $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body"); $rect->setRequired(TRUE); $rect->setUseUnits(TRUE); $rect->setTop($form_fields["margin_body_top"]); $rect->setBottom($form_fields["margin_body_bottom"]); $rect->setLeft($form_fields["margin_body_left"]); $rect->setRight($form_fields["margin_body_right"]); $rect->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $rect->checkInput(); } $form->addItem($rect); $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text"); $certificate->removePlugin('ilimgupload'); $certificate->setValue($form_fields["certificate_text"]); $certificate->setRequired(TRUE); $certificate->setRows(20); $certificate->setCols(80); // fraunhpatch start $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate"); foreach (ilCertificate::getCustomCertificateFields() as $f) { $common_desc_tpl->setCurrentBlock("cert_field"); $common_desc_tpl->setVariable("PH", $f["ph"]); $common_desc_tpl->setVariable("PH_TXT", $f["name"]); $common_desc_tpl->parseCurrentBlock(); } $common_desc = $common_desc_tpl->get(); // fraunhpatch start $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc); $certificate->setUseRte(TRUE, '3.4.7'); $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul"); $certificate->setRteTags($tags); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $certificate->checkInput(); } $form->addItem($certificate); $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { if ($this->object->isComplete() || $this->object->hasBackgroundImage()) { $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview")); $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export")); $form->addCommandButton("certificateDelete", $this->lng->txt("delete")); } $form->addCommandButton("certificateSave", $this->lng->txt("save")); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { if ($_POST["background_delete"]) { $this->object->deleteBackgroundImage(); } if ($form->checkInput()) { try { $xslfo = $this->object->processXHTML2FO($form_fields); $this->object->getAdapter()->saveFormFields($form_fields); $this->object->saveCertificate($xslfo); $this->object->writeActive($form_fields["active"]); ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE); $this->ctrl->redirect($this, "certificateEditor"); } catch (Exception $e) { ilUtil::sendFailure($e->getMessage()); } } } }
/** * @param $question_id * @param $question_pool_id * * @return ilPropertyFormGUI */ protected function buildAdjustQuestionForm($question_id, $question_pool_id) { require_once './Services/Form/classes/class.ilPropertyFormGUI.php'; require_once './Modules/TestQuestionPool/classes/class.assQuestion.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("adjustment"); /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */ $question = assQuestion::instantiateQuestionGUI($question_id); $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>'); $hidden_question_id = new ilHiddenInputGUI('q_id'); $hidden_question_id->setValue($question_id); $form->addItem($hidden_question_id); $hidden_qpl_id = new ilHiddenInputGUI('qpl_id'); $hidden_qpl_id->setValue($question_pool_id); $form->addItem($hidden_qpl_id); $this->populateScoringAdjustments($question, $form); $manscoring_section = new ilFormSectionHeaderGUI(); $manscoring_section->setTitle($this->lng->txt('manscoring')); $form->addItem($manscoring_section); $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring'); $manscoring_preservation->setChecked(true); $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info')); $form->addItem($manscoring_preservation); $form->addCommandButton("savescoringfortest", $this->lng->txt("save")); $participants = $this->object->getParticipants(); $active_ids = array_keys($participants); $results = array(); foreach ($active_ids as $active_id) { $passes[] = $this->object->_getPass($active_id); foreach ($passes as $key => $pass) { for ($i = 0; $i <= $pass; $i++) { $results[] = $question->object->getSolutionValues($active_id, $i); } } } $relevant_answers = array(); foreach ($results as $result) { foreach ($result as $answer) { if ($answer['question_fi'] == $question->object->getId()) { $relevant_answers[] = $answer; } } } $answers_view = $question->getAggregatedAnswersView($relevant_answers); include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test'); $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ'); $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close')))); $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview')); $container->setVariable('TXT_CLOSE', $this->lng->txt('close')); $container->setVariable('ANSWER_OVERVIEW', $answers_view); $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ'); $custom_input->setHtml($container->get()); $form->addItem($custom_input); return $form; }
/** * 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 */ 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("matching"); // Edit mode $hidden = new ilHiddenInputGUI("matching_type"); $hidden->setValue($matchingtype); $form->addItem($hidden); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); if (!$this->getSelfAssessmentEditingMode()) { // shuffle $shuffle = new ilSelectInputGUI($this->lng->txt("shuffle_answers"), "shuffle"); $shuffle_options = array(0 => $this->lng->txt("no"), 1 => $this->lng->txt("matching_shuffle_terms_definitions"), 2 => $this->lng->txt("matching_shuffle_terms"), 3 => $this->lng->txt("matching_shuffle_definitions")); $shuffle->setOptions($shuffle_options); $shuffle->setValue($this->object->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $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); $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); } // Definitions include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php"; $definitions = new ilMatchingWizardInputGUI($this->lng->txt("definitions"), "definitions"); if ($this->getSelfAssessmentEditingMode()) { $definitions->setHideImages(true); } $definitions->setRequired(true); $definitions->setQuestionObject($this->object); $definitions->setTextName($this->lng->txt('definition_text')); $definitions->setImageName($this->lng->txt('definition_image')); include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php"; if (!count($this->object->getDefinitions())) { $this->object->addDefinition(new assAnswerMatchingDefinition()); } $definitionvalues = $this->object->getDefinitions(); $definitions->setValues($definitionvalues); $form->addItem($definitions); // Terms include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php"; $terms = new ilMatchingWizardInputGUI($this->lng->txt("terms"), "terms"); if ($this->getSelfAssessmentEditingMode()) { $terms->setHideImages(true); } $terms->setRequired(true); $terms->setQuestionObject($this->object); $terms->setTextName($this->lng->txt('term_text')); $terms->setImageName($this->lng->txt('term_image')); include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php"; if (!count($this->object->getTerms())) { $this->object->addTerm(new assAnswerMatchingTerm()); } $termvalues = $this->object->getTerms(); $terms->setValues($termvalues); $form->addItem($terms); // Matching Pairs include_once "./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php"; $pairs = new ilMatchingPairWizardInputGUI($this->lng->txt('matching_pairs'), 'pairs'); $pairs->setRequired(true); $pairs->setTerms($this->object->getTerms()); $pairs->setDefinitions($this->object->getDefinitions()); include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php"; if (count($this->object->getMatchingPairs()) == 0) { $this->object->addMatchingPair(new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0)); } $pairs->setPairs($this->object->getMatchingPairs()); $form->addItem($pairs); $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 && count($terms->getValues()) < count($definitions->getValues()) && !$this->getSelfAssessmentEditingMode()) { $errors = true; $terms->setAlert($this->lng->txt("msg_number_of_terms_too_low")); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("QUESTION_DATA", $form->getHTML()); } return $errors; }
/** * @return ilPropertyFormGUI */ protected function buildBasicEditFormObject() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setId($this->getType()); $form->setTitle($this->outQuestionType()); $form->setTableWidth('100%'); $form->setMultipart(true); return $form; }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); # if ($_REQUEST['prev_qid']) { # $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); # } 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("assclozetest"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); $q_item = $form->getItemByPostVar("question"); $q_item->setInfo($this->lng->txt("close_text_hint")); $q_item->setTitle($this->lng->txt("cloze_text")); // text rating if (!$this->getSelfAssessmentEditingMode()) { $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "textgap_rating"); $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"), "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"), "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"), "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"), "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"), "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")); $textrating->setOptions($text_options); $textrating->setValue($this->object->getTextgapRating()); $form->addItem($textrating); // text field length $fixedTextLength = new ilNumberInputGUI($this->lng->txt("cloze_fixed_textlength"), "fixedTextLength"); $fixedTextLength->setValue(ilUtil::prepareFormOutput($this->object->getFixedTextLength())); $fixedTextLength->setMinValue(0); $fixedTextLength->setSize(3); $fixedTextLength->setMaxLength(6); $fixedTextLength->setInfo($this->lng->txt('cloze_fixed_textlength_description')); $fixedTextLength->setRequired(false); $form->addItem($fixedTextLength); // identical scoring $identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring"); $identical_scoring->setValue(1); $identical_scoring->setChecked($this->object->getIdenticalScoring()); $identical_scoring->setInfo($this->lng->txt('identical_scoring_desc')); $identical_scoring->setRequired(FALSE); $form->addItem($identical_scoring); } for ($i = 0; $i < $this->object->getGapCount(); $i++) { $gap = $this->object->getGap($i); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("gap") . " " . ($i + 1)); $form->addItem($header); $gapcounter = new ilHiddenInputGUI("gap[{$i}]"); $gapcounter->setValue($i); $form->addItem($gapcounter); $gaptype = new ilSelectInputGUI($this->lng->txt('type'), "clozetype_{$i}"); $options = array(0 => $this->lng->txt("text_gap"), 1 => $this->lng->txt("select_gap"), 2 => $this->lng->txt("numeric_gap")); $gaptype->setOptions($options); $gaptype->setValue($gap->getType()); $form->addItem($gaptype); if ($gap->getType() == CLOZE_TEXT) { // Choices include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php"; $values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . ""); $values->setRequired(true); $values->setQuestionObject($this->object); $values->setSingleline(true); $values->setAllowMove(false); if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } $values->setValues($gap->getItemsRaw()); $form->addItem($values); } else { if ($gap->getType() == CLOZE_SELECT) { include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php"; $values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . ""); $values->setRequired(true); $values->setQuestionObject($this->object); $values->setSingleline(true); $values->setAllowMove(false); if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } $values->setValues($gap->getItemsRaw()); $form->addItem($values); // shuffle $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_" . $i . ""); $shuffle->setValue(1); $shuffle->setChecked($gap->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); } else { if ($gap->getType() == CLOZE_NUMERIC) { if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } foreach ($gap->getItemsRaw() as $item) { // #8944: the js-based ouput in self-assessment cannot support formulas if (!$this->getSelfAssessmentEditingMode()) { $value = new ilFormulaInputGUI($this->lng->txt('value'), "gap_" . $i . "_numeric"); $value->setInlineStyle('text-align: right;'); $lowerbound = new ilFormulaInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $i . "_numeric_lower"); $lowerbound->setInlineStyle('text-align: right;'); $upperbound = new ilFormulaInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $i . "_numeric_upper"); $upperbound->setInlineStyle('text-align: right;'); } else { $value = new ilNumberInputGUI($this->lng->txt('value'), "gap_" . $i . "_numeric"); $value->allowDecimals(true); $lowerbound = new ilNumberInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $i . "_numeric_lower"); $lowerbound->allowDecimals(true); $upperbound = new ilNumberInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $i . "_numeric_upper"); $upperbound->allowDecimals(true); } $value->setSize(10); $value->setValue(ilUtil::prepareFormOutput($item->getAnswertext())); $value->setRequired(true); $form->addItem($value); $lowerbound->setSize(10); $lowerbound->setRequired(true); $lowerbound->setValue(ilUtil::prepareFormOutput($item->getLowerBound())); $form->addItem($lowerbound); $upperbound->setSize(10); $upperbound->setRequired(true); $upperbound->setValue(ilUtil::prepareFormOutput($item->getUpperBound())); $form->addItem($upperbound); $points = new ilNumberInputGUI($this->lng->txt('points'), "gap_" . $i . "_numeric_points"); $points->setSize(3); $points->setRequired(true); $points->setValue(ilUtil::prepareFormOutput($item->getPoints())); $form->addItem($points); } } } } } $form->addCommandButton('createGaps', $this->lng->txt('create_gaps')); $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; }
/** * 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; }