protected function initForm($submit_action) { $form = new ilPropertyFormGUI(); $input = new ilFileInputGUI($this->lng->txt("import_xml_file"), "import_file"); $input->setRequired(true); $form->addItem($input); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton($submit_action, $this->lng->txt("import")); return $form; }
/** * 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; }
function initMultiFeedbackForm($a_ass_id) { global $lng; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->addCommandButton("uploadMultiFeedback", $lng->txt("upload")); $form->addCommandButton("members", $lng->txt("cancel")); // multi feedback file $fi = new ilFileInputGUI($lng->txt("exc_multi_feedback_file"), "mfzip"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $form->addItem($fi); $form->setTitle(ilExAssignment::lookupTitle($a_ass_id)); $form->setFormAction($this->ctrl->getFormAction($this, "uploadMultiFeedback")); return $form; }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $form->addItem($points); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_attributes")); $form->addItem($header); // java applet $javaapplet = $this->object->getJavaAppletFilename(); $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName'); $applet->setSuffixes(array('jar', 'class')); $applet->setRequired(false); if (strlen($javaapplet)) { $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet'); $filename->setValue($javaapplet); $applet->addSubItem($filename); $delete = new ilCheckboxInputGUI('', 'delete_applet'); $delete->setOptionTitle($this->lng->txt('delete')); $delete->setValue(1); $applet->addSubItem($delete); } $form->addItem($applet); // Code $code = new ilTextInputGUI($this->lng->txt("code"), "java_code"); $code->setValue($this->object->getJavaCode()); $code->setRequired(TRUE); $form->addItem($code); if (!strlen($javaapplet)) { // Archive $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive"); $archive->setValue($this->object->getJavaArchive()); $archive->setRequired(false); $form->addItem($archive); // Codebase $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase"); $codebase->setValue($this->object->getJavaCodebase()); $codebase->setRequired(false); $form->addItem($codebase); } // Width $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width"); $width->setDecimals(0); $width->setSize(6); $width->setMinValue(50); $width->setMaxLength(6); $width->setValue($this->object->getJavaWidth()); $width->setRequired(TRUE); $form->addItem($width); // Height $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height"); $height->setDecimals(0); $height->setSize(6); $height->setMinValue(50); $height->setMaxLength(6); $height->setValue($this->object->getJavaHeight()); $height->setRequired(TRUE); $form->addItem($height); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("applet_parameters")); $form->addItem($header); include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php"; $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp"); $values = array(); for ($i = 0; $i < $this->object->getParameterCount(); $i++) { $param = $this->object->getParameter($i); array_push($values, array($param['name'], $param['value'])); } if (count($values) == 0) { array_push($values, array("", "")); } $kvp->setKeyName($this->lng->txt('name')); $kvp->setValueName($this->lng->txt('value')); $kvp->setValues($values); $form->addItem($kvp); }
/** * Init import form. */ public function initImportForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"]; $this->ctrl->setParameter($this, "new_type", $new_type); $form->setTarget(ilFrameTargetInfo::_getFrame("MainContent")); $form->setTableWidth("600px"); // import file $fi = new ilFileInputGUI($this->lng->txt("file"), "xmldoc"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $fi->setSize(30); $form->addItem($fi); // validation $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate"); $cb->setInfo($this->lng->txt("")); $form->addItem($cb); $form->addCommandButton("importFile", $lng->txt("import")); $form->addCommandButton("cancel", $lng->txt("cancel")); $form->setTitle($this->lng->txt("import_" . $new_type)); $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
/** * 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()); } } } }
/** * Init page layout import form. */ public function initPageLayoutImportForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); // template file $fi = new ilFileInputGUI($lng->txt("file"), "file"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $form->addItem($fi); $form->addCommandButton("importPageLayout", $lng->txt("import")); $form->addCommandButton("viewPageLayouts", $lng->txt("cancel")); $form->setTitle($lng->txt("sty_import_page_layout")); $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
/** * show import form * * @access protected */ protected function initImportForm() { if (is_object($this->import_form)) { return true; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->import_form = new ilPropertyFormGUI(); $this->import_form->setMultipart(true); $this->import_form->setFormAction($this->ctrl->getFormAction($this)); // add file property $file = new ilFileInputGUI($this->lng->txt('file'), 'file'); $file->setSuffixes(array('xml')); $file->setRequired(true); $this->import_form->addItem($file); $this->import_form->setTitle($this->lng->txt('md_adv_import_record')); $this->import_form->addCommandButton('importRecord', $this->lng->txt('import')); $this->import_form->addCommandButton('showRecords', $this->lng->txt('cancel')); }
public function initEditForm() { global $lng; $form = parent::initEditForm(); // Add File-Upload $in_file = new ilFileInputGUI($lng->txt("bibliography file"), "bibliographic_file"); $in_file->setSuffixes(array("ris", "bib", "bibtex")); $in_file->setRequired(false); $cb_override = new ilCheckboxInputGUI($this->lng->txt("override_entries"), "override_entries"); $cb_override->addSubItem($in_file); $form->addItem($cb_override); $form->setFormAction($this->ctrl->getFormAction($this, "save")); return $form; }
public function showAttachments() { /** * @var $ilToolbar ilToolbarGUI */ global $ilToolbar; $this->tpl->setTitle($this->lng->txt('mail')); require_once 'Services/Form/classes/class.ilFileInputGUI.php'; $attachment = new ilFileInputGUI($this->lng->txt('upload'), 'userfile'); $attachment->setRequired(true); $attachment->setSize(20); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'uploadFile'), true); $ilToolbar->addInputItem($attachment); $ilToolbar->addFormButton($this->lng->txt('upload'), 'uploadFile'); require_once 'Services/Mail/classes/class.ilMailAttachmentTableGUI.php'; $table = new ilMailAttachmentTableGUI($this, 'showAttachments'); $mailData = $this->umail->getSavedData(); $files = $this->mfile->getUserFilesData(); $data = array(); $counter = 0; foreach ($files as $file) { $checked = false; if (is_array($mailData['attachments']) && in_array($file['name'], $mailData['attachments'])) { $checked = true; } $data[$counter] = array('checked' => $checked, 'filename' => $file['name'], 'filesize' => (int) $file['size'], 'filecreatedate' => (int) $file['ctime']); ++$counter; } $table->setData($data); $this->tpl->setContent($table->getHtml()); $this->tpl->show(); }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // is MultipleChoice? $radioGroup = new ilRadioGroupInputGUI($this->lng->txt('tst_imap_qst_mode'), 'is_multiple_choice'); $radioGroup->setValue($this->object->getIsMultipleChoice()); $modeSingleChoice = new ilRadioOption($this->lng->txt('tst_imap_qst_mode_sc'), assImagemapQuestion::MODE_SINGLE_CHOICE); $modeMultipleChoice = new ilRadioOption($this->lng->txt('tst_imap_qst_mode_mc'), assImagemapQuestion::MODE_MULTIPLE_CHOICE); $radioGroup->addOption($modeSingleChoice); $radioGroup->addOption($modeMultipleChoice); $form->addItem($radioGroup); // image include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php"; $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image'); $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice()); $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); return $form; }
/** * display the import form to import questions into the questionpool */ public function importQuestionsObject() { global $tpl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "uploadQuestions")); $form->setTitle($this->lng->txt("import_question")); include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($this->lng->txt("select_file"), "qtidoc"); $fi->setSuffixes(array("xml", "zip")); $fi->setRequired(true); $form->addItem($fi); $form->addCommandButton("uploadQuestions", $this->lng->txt("import")); $form->addCommandButton("questions", $this->lng->txt("cancel")); $tpl->setContent($form->getHTML()); }
/** * Shows a form to add or edit content * * @param int $a_mode * @param int $a_content_id optional content id * @access protected */ protected function initFormContent($a_mode, $a_content_id = 0) { if ($this->cform instanceof ilPropertyFormGUI) { return; } include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->cform = new ilPropertyFormGUI(); switch ($a_mode) { case self::CONTENT_MOD_EDIT: $positive_cmd = $this->is_record ? 'updateRecord' : 'updateContent'; // Header $this->ctrl->setParameter($this, 'content_id', (int) $_REQUEST['content_id']); $this->cform->setTitle($this->txt('edit_content')); // Buttons $this->cform->addCommandButton($positive_cmd, $this->txt('save')); $this->cform->addCommandButton('showContent', $this->txt('cancel')); // Form action if ($a_content_id) { $this->ctrl->setParameter($this, 'content_id', $a_content_id); } $this->cform->setFormAction($this->ctrl->getFormAction($this, $positive_cmd)); break; case self::CONTENT_MOD_ADD: // Header $this->cform->setTitle($this->txt('add_new_content')); // Buttons $this->cform->addCommandButton('addContent', $this->txt('save')); $this->cform->addCommandButton('showContent', $this->txt('cancel')); // Form action $this->cform->setFormAction($this->ctrl->getFormAction($this, 'addContent')); break; } // Title $tit = new ilTextInputGUI($this->txt('title'), 'tit'); // $tit->setRequired(true); $tit->setSize(40); $tit->setMaxLength(127); $this->cform->addItem($tit); // Description $des = new ilTextAreaInputGUI($this->txt('description'), 'des'); $des->setRows(3); $this->cform->addItem($des); if ($this->is_record == false) { // File $fil = new ilFileInputGUI($this->txt('file'), 'file'); if ($a_mode == self::CONTENT_MOD_ADD) { $fil->setRequired(true); } $content_file_types = strlen(ilAdobeConnectServer::getSetting('content_file_types')) > 1 ? ilAdobeConnectServer::getSetting('content_file_types') : 'ppt, pptx, flv, swf, pdf, gif, jpg, png, mp3, html'; $fil->setSuffixes(explode(',', str_replace(' ', '', $content_file_types))); $this->cform->addItem($fil); } }
/** * Creates an input field for floor plans that should be uploaded. * * @return ilFileInputGUI file input form item */ protected function createFileInputFormItem() { $file = new ilFileInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "upload_file"); $file->setSize(50); $file->setRequired(true); $file->setALlowDeletion(true); $file->setInfo($this->lng->txt("rep_robj_xrs_floor_plans_filetypes") . " .bmp, .jpg, .jpeg, .png, .gif"); return $file; }
/** * Init edit form * * @param int $a_mode Edit Mode */ public function initEditForm($a_mode = "edit") { global $lng, $ilCtrl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); if ($a_mode != "add_file") { // title $ti = new ilTextInputGUI($lng->txt("title"), "flst_title"); $ti->setMaxLength(80); $ti->setSize(40); $form->addItem($ti); // language require_once "Services/MetaData/classes/class.ilMDLanguageItem.php"; $lang = ilMDLanguageItem::_getLanguages(); $si = new ilSelectInputGUI($lng->txt("language"), "flst_language"); $si->setOptions($lang); $form->addItem($si); } if (in_array($a_mode, array("create", "add_file"))) { // file $fi = new ilFileInputGUI($lng->txt("file"), "file"); $fi->setRequired(true); $form->addItem($fi); } else { if (in_array($a_mode, array("select_file"))) { // file $ne = new ilNonEditableValueGUI($lng->txt("file"), ""); if (isset($_GET["file_ref_id"])) { include_once "./Modules/File/classes/class.ilObjFile.php"; $file_obj = new ilObjFile((int) $_GET["file_ref_id"]); if (is_object($file_obj)) { // ref id as hidden input $hi = new ilHiddenInputGUI("file_ref_id"); $hi->setValue((int) $_GET["file_ref_id"]); $form->addItem($hi); $ne->setValue($file_obj->getTitle()); } } else { if (isset($_GET["fl_wsp_id"])) { // we need the object id for the instance include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $node = $tree->getNodeData((int) $_GET["fl_wsp_id"]); include_once "./Modules/File/classes/class.ilObjFile.php"; $file_obj = new ilObjFile($node["obj_id"], false); if (is_object($file_obj)) { // ref id as hidden input $hi = new ilHiddenInputGUI("file_ref_id"); $hi->setValue("wsp_" . (int) $node["obj_id"]); $form->addItem($hi); $ne->setValue($file_obj->getTitle()); } $this->tpl->parseCurrentBlock(); } } $form->addItem($ne); } } switch ($a_mode) { case "edit": $ti->setValue($this->content_obj->getListTitle()); $si->setValue($this->content_obj->getLanguage()); $form->addCommandButton("saveProperties", $lng->txt("save")); $form->addCommandButton("cancelUpdate", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_edit_file_list_properties")); break; case "create": case "select_file": if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") { $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]]; } else { $s_lang = $ilUser->getLanguage(); } $si->setValue($s_lang); $form->addCommandButton("create_flst", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_insert_file_list")); break; case "add_file": $form->addCommandButton("insertNewFileItem", $lng->txt("save")); $form->addCommandButton("editFiles", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_insert_file_item")); break; } $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
function importExternalMailRecipientsFromFileFormObject() { global $ilAccess; $this->parent_gui->handleWriteAccess(); $this->setCodesSubtabs(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form_import_file = new ilPropertyFormGUI(); $form_import_file->setFormAction($this->ctrl->getFormAction($this)); $form_import_file->setTableWidth("100%"); $form_import_file->setId("codes_import_file"); $headerfile = new ilFormSectionHeaderGUI(); $headerfile->setTitle($this->lng->txt("import_from_file")); $form_import_file->addItem($headerfile); $externalmails = new ilFileInputGUI($this->lng->txt("externalmails"), "externalmails"); $externalmails->setInfo($this->lng->txt('externalmails_info')); $externalmails->setRequired(true); $form_import_file->addItem($externalmails); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $form_import_file->addCommandButton("importExternalRecipientsFromFile", $this->lng->txt("import")); } if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $form_import_file->addCommandButton("codes", $this->lng->txt("cancel")); } $this->tpl->setContent($form_import_file->getHTML()); }
/** * create */ function createObject() { global $rbacsystem, $lng, $tpl, $ilHelp; $forms = array(); $ilHelp->setScreenIdComponent("sty"); $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create"); // --- create include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("sty_create_new_stylesheet")); // title $ti = new ilTextInputGUI($this->lng->txt("title"), "style_title"); $ti->setMaxLength(128); $ti->setSize(40); $ti->setRequired(true); $form->addItem($ti); // description $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description"); $ta->setCols(40); $ta->setRows(2); $form->addItem($ta); $form->addCommandButton("save", $this->lng->txt("save")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); $forms[] = $form; // --- import include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("sty_import_stylesheet")); // title $ti = new ilFileInputGUI($this->lng->txt("import_file"), "stylefile"); $ti->setRequired(true); $form->addItem($ti); $form->addCommandButton("importStyle", $this->lng->txt("import")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); $forms[] = $form; // --- clone include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("sty_copy_other_stylesheet")); // source $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style"); $ti->setRequired(true); $ti->setOptions(ilObjStyleSheet::_getClonableContentStyles()); $form->addItem($ti); $form->addCommandButton("copyStyle", $this->lng->txt("copy")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); $forms[] = $form; $this->tpl->setContent($this->getCreationFormsHTML($forms)); }
/** * Init personal data import form * * @param * @return */ function initPersonalDataImportForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // input file $fi = new ilFileInputGUI($lng->txt("file"), "file"); $fi->setRequired(true); $fi->setSuffixes(array("zip")); $this->form->addItem($fi); // profile data $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data"); $this->form->addItem($cb); // settings $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings"); $this->form->addItem($cb); // bookmarks $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks"); $this->form->addItem($cb); // personal notes $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes"); $this->form->addItem($cb); // calendar entries $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar"); $this->form->addItem($cb); $this->form->addCommandButton("importPersonalData", $lng->txt("import")); $this->form->addCommandButton("showExportImport", $lng->txt("cancel")); $this->form->setTitle($lng->txt("pd_import_personal_data")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
/** * Init upload form. */ public function initUploadForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // type selection $options = array("scorm2004" => $lng->txt("lm_type_scorm2004"), "scorm" => $lng->txt("lm_type_scorm"), "aicc" => $lng->txt("lm_type_aicc"), "hacp" => $lng->txt("lm_type_hacp")); $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type"); $si->setOptions($options); $this->form->addItem($si); // input file $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile"); $fi->setRequired(true); $this->form->addItem($fi); // todo "uploaded file" // todo wysiwyg editor removement include_once 'Services/FileSystem/classes/class.ilUploadFiles.php'; if (ilUploadFiles::_getUploadDirectory()) { $options = array(); $fi->setRequired(false); $files = ilUploadFiles::_getUploadFiles(); $options[""] = $this->lng->txt("cont_select_from_upload_dir"); foreach ($files as $file) { $file = htmlspecialchars($file, ENT_QUOTES, "utf-8"); $options[$file] = $file; } // $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file"); $si->setOptions($options); $this->form->addItem($si); } // validate file $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate"); $cb->setValue("y"); //$cb->setChecked(true); $this->form->addItem($cb); // import for editing $cb = new ilCheckboxInputGUI($this->lng->txt("sahs_authoring_mode"), "editable"); $cb->setValue("y"); $cb->setInfo($this->lng->txt("sahs_authoring_mode_info")); $this->form->addItem($cb); // $radg = new ilRadioGroupInputGUI($lng->txt("sahs_sequencing"), "import_sequencing"); $radg->setValue(0); $op1 = new ilRadioOption($lng->txt("sahs_std_sequencing"), 0, $lng->txt("sahs_std_sequencing_info")); $radg->addOption($op1); $op1 = new ilRadioOption($lng->txt("sahs_import_sequencing"), 1, $lng->txt("sahs_import_sequencing_info")); $radg->addOption($op1); $cb->addSubItem($radg); $this->form->addCommandButton("upload", $lng->txt("import")); $this->form->addCommandButton("cancel", $lng->txt("cancel")); $this->form->setTitle($lng->txt("import_sahs")); $this->form->setFormAction($ilCtrl->getFormAction($this, "upload")); $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent")); }
/** * Init object import form * * @param string new type */ public function initImportForm($a_new_type = "") { global $lng, $ilCtrl; $lng->loadLanguageModule("feed"); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setTarget("_top"); // Import file include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $this->form->addItem($fi); $this->form->addCommandButton("importFile", $lng->txt("import")); $this->form->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel")); $this->form->setTitle($lng->txt($a_new_type . "_import")); $ilCtrl->setParameter($this, "new_type", $a_new_type); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
protected function initImportForm($a_new_type) { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTarget("_top"); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("import_svy")); include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($this->lng->txt("import_file"), "importfile"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $form->addItem($fi); include_once "./Modules/Survey/classes/class.ilObjSurvey.php"; $svy = new ilObjSurvey(); $questionspools = $svy->getAvailableQuestionpools(true, true, true); $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool_short"), "spl"); $pools->setOptions(array("" => $this->lng->txt("dont_use_questionpool")) + $questionspools); $pools->setRequired(false); $form->addItem($pools); $form->addCommandButton("importFile", $this->lng->txt("import")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); return $form; }
/** * * @param * @return */ protected function initPropertiesForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->lng->loadLanguageModule('file'); $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this), 'update'); $form->setTitle($this->lng->txt('file_edit')); $form->addCommandButton('update', $this->lng->txt('save')); $form->addCommandButton('cancel', $this->lng->txt('cancel')); $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->object->getTitle()); $title->setInfo($this->lng->txt("if_no_title_then_filename")); $form->addItem($title); $upload_possible = true; if ($this->id_type == self::WORKSPACE_NODE_ID) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; $upload_possible = ilDiskQuotaHandler::isUploadPossible(); } if ($upload_possible) { $file = new ilFileInputGUI($this->lng->txt('obj_file'), 'file'); $file->setRequired(false); // $file->enableFileNameSelection('title'); $form->addItem($file); $group = new ilRadioGroupInputGUI('', 'replace'); $group->setValue(0); $replace = new ilRadioOption($this->lng->txt('replace_file'), 1); $replace->setInfo($this->lng->txt('replace_file_info')); $group->addOption($replace); $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0); $keep->setInfo($this->lng->txt('file_new_version_info')); $group->addOption($keep); $file->addSubItem($group); } else { $file = new ilNonEditableValueGUI($this->lng->txt('obj_file')); $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning")); $form->addItem($file); } $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $desc->setRows(3); #$desc->setCols(40); $form->addItem($desc); if ($this->id_type == self::REPOSITORY_NODE_ID) { $this->lng->loadLanguageModule('rating'); $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating'); $rate->setInfo($this->lng->txt('rating_activate_rating_info')); $form->addItem($rate); } return $form; }
/** * Allows to add suggested solutions for questions * * @access public */ public function suggestedsolution() { global $ilUser; global $ilAccess; if ($_POST["deleteSuggestedSolution"] == 1) { $this->object->deleteSuggestedSolutions(); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "suggestedsolution"); } $save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE; $output = ""; $solution_array = $this->object->getSuggestedSolution(0); $options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText")); if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) { $solution_array = array("type" => "file"); } elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) { $solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE)); } if ($save && strlen($_POST["filename"])) { $solution_array["value"]["filename"] = $_POST["filename"]; } if ($save && strlen($_POST["solutiontext"])) { $solution_array["value"] = $_POST["solutiontext"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if (count($solution_array)) { $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("solution_hint")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("suggestedsolutiondisplay"); // suggested solution output include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php"; $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype"); $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool"); if (strlen($solution_array["internal_link"])) { $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]); $template->setCurrentBlock("preview"); $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution")); $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> "); $template->parseCurrentBlock(); } elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) { $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"]; $template->setCurrentBlock("preview"); $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution")); $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> "); $template->parseCurrentBlock(); } $template->setVariable("TEXT_TYPE", $this->lng->txt("type")); $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]); $title->setHtml($template->get()); $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution"); $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution")); $title->addSubItem($deletesolution); $form->addItem($title); if (strcmp($solution_array["type"], "file") == 0) { // file $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file"); $file->setRequired(TRUE); $file->enableFileNameSelection("filename"); //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf")); if ($_FILES["file"]["tmp_name"] && $file->checkInput()) { if (!file_exists($this->object->getSuggestedSolutionPath())) { ilUtil::makeDirParents($this->object->getSuggestedSolutionPath()); } $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]); if ($res) { ilUtil::renameExecutables($this->object->getSuggestedSolutionPath()); // remove an old file download if (is_array($solution_array["value"])) { @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]); } $file->setValue($_FILES["file"]["name"]); $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"])); $originalexists = $this->object->_questionExistsInPool($this->object->original_id); if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { return $this->originalSyncForm("suggestedsolution"); } else { ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE); $this->ctrl->redirect($this, "suggestedsolution"); } } else { // BH: $res as info string? wtf? it holds a bool or something else!!? ilUtil::sendInfo($res); } } else { if (is_array($solution_array["value"])) { $file->setValue($solution_array["value"]["name"]); $file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]); } } $form->addItem($file); $hidden = new ilHiddenInputGUI("solutiontype"); $hidden->setValue("file"); $form->addItem($hidden); } else { if (strcmp($solution_array["type"], "text") == 0) { $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext"); $question->setValue($this->object->prepareTextareaOutput($solution_array["value"])); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); $question->addPlugin("latex"); $question->addButton("latex"); $question->setRTESupport($this->object->getId(), "qpl", "assessment"); $hidden = new ilHiddenInputGUI("solutiontype"); $hidden->setValue("text"); $form->addItem($hidden); $form->addItem($question); } } if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) { $form->addCommandButton("suggestedsolution", $this->lng->txt("save")); } if ($save) { if ($form->checkInput()) { switch ($solution_array["type"]) { case "file": $this->object->saveSuggestedSolution("file", "", 0, array("name" => $solution_array["value"]["name"], "type" => $solution_array["value"]["type"], "size" => $solution_array["value"]["size"], "filename" => $_POST["filename"])); break; case "text": $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]); break; } $originalexists = $this->object->_questionExistsInPool($this->object->original_id); if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { return $this->originalSyncForm("suggestedsolution"); } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "suggestedsolution"); } } } $output = $form->getHTML(); } $savechange = strcmp($this->ctrl->getCmd(), "saveSuggestedSolution") == 0 ? TRUE : FALSE; $changeoutput = ""; if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) { $formchange = new ilPropertyFormGUI(); $formchange->setFormAction($this->ctrl->getFormAction($this)); $formchange->setTitle(count($solution_array) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution")); $formchange->setMultipart(FALSE); $formchange->setTableWidth("100%"); $formchange->setId("suggestedsolution"); $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype"); foreach ($options as $opt_value => $opt_caption) { $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value)); } if (count($solution_array)) { $solutiontype->setValue($solution_array["type"]); } $solutiontype->setRequired(TRUE); $formchange->addItem($solutiontype); $formchange->addCommandButton("saveSuggestedSolution", $this->lng->txt("select")); if ($savechange) { $formchange->checkInput(); } $changeoutput = $formchange->getHTML(); } $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output); }
/** * Init import form */ protected function initImportForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('cont_import_tracking')); $form->addCommandButton('import', $this->lng->txt('import')); $form->addCommandButton('showTrackingItems', $this->lng->txt('cancel')); $csv = new ilFileInputGUI($this->lng->txt('select_file'), 'csv'); $csv->setRequired(true); $csv->setSuffixes(array('csv')); $form->addItem($csv); return $form; }
/** * Init object import form * * @param string new type * @return ilPropertyFormGUI */ protected function initImportForm($a_new_type) { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTarget("_top"); $form->setFormAction($this->ctrl->getFormAction($this, "importFile")); $form->setTitle($this->lng->txt($a_new_type . "_import")); include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($this->lng->txt("import_file"), "importfile"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $form->addItem($fi); $form->addCommandButton("importFile", $this->lng->txt("import")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); return $form; }
function initImportForm($a_new_type) { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTarget("_top"); $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"]; $this->ctrl->setParameter($this, "new_type", $new_type); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("import_tst")); // file include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc"); $fi->setSuffixes(array("zip")); $fi->setRequired(true); $form->addItem($fi); // question pool include_once "./Modules/Test/classes/class.ilObjTest.php"; $tst = new ilObjTest(); $questionpools = $tst->getAvailableQuestionpools(TRUE, FALSE, TRUE, TRUE); if (count($questionpools)) { $options = array("-1" => $this->lng->txt("dont_use_questionpool")); foreach ($questionpools as $key => $value) { $options[$key] = $value["title"]; } $pool = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "qpl"); $pool->setOptions($options); $form->addItem($pool); } $form->addCommandButton("importFile", $this->lng->txt("import")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); return $form; }
/** * Init form * * @return ilPropertyFormGUI */ public function initForm() { global $lng, $ilCtrl; /** @var $ilCtrl ilCtrl */ $ilCtrl = $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $item = new ilCustomInputGUI(); $item->setHtml($lng->txt('dcl_file_format_description')); $item->setTitle("Info"); $form->addItem($item); $file = new ilFileInputGUI($lng->txt("import_file"), "import_file"); $file->setRequired(true); $form->addItem($file); $cb = new ilCheckboxInputGUI($lng->txt("dcl_simulate_import"), "simulate"); $cb->setInfo($lng->txt("dcl_simulate_info")); $form->addItem($cb); $form->addCommandButton("importExcel", $lng->txt("save")); return $form; }
/** * Creates an input field for the davinci text file upload * * @return \ilFileInputGUI file input form item */ protected function createFileInputFormItem() { $file = new ilFileInputGUI($this->lng->txt("rep_robj_xrs_daVinci_import_file"), "upload_file"); $file->setSize(50); $file->setRequired(true); $file->setALlowDeletion(true); $file->setSuffixes(array('txt')); return $file; }
/** * Init settings form. * This command uses the form class to display an input form. */ protected function initSettingsForm() { $this->settingsForm = new ilPropertyFormGUI(); // Title and description (Standard) $titleField = new ilTextInputGUI($this->lng->txt('title'), 'title'); $titleField->setMaxLength(128); $titleField->setRequired(true); $this->settingsForm->addItem($titleField); $descField = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc'); $descField->setCols(50); $descField->setRows(5); $this->settingsForm->addItem($descField); // Online flag $onlineField = new ilCheckboxInputGUI($this->lng->txt('online'), 'online'); $this->settingsForm->addItem($onlineField); // Max booking time // $maxtimeField = new ilRoomSharingTimeInputGUI($this->lng->txt('rep_robj_xrs_max_book_time'), 'max_book_time'); // $maxtimeField->setShowTime(true); // $maxtimeField->setMinuteStepSize(5); // $maxtimeField->setShowDate(false); // $this->settingsForm->addItem($maxtimeField); require_once './Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/utils/class.xrsTimeInputGUI.php'; $xrsTimeInputGUI = new xrsTimeInputGUI($this->lng->txt('rep_robj_xrs_max_book_time'), 'max_book_time'); $this->settingsForm->addItem($xrsTimeInputGUI); // Rooms agreement $roomsAgrField = new ilFileInputGUI($this->lng->txt('rep_robj_xrs_rooms_user_agreement'), "rooms_agreement"); $roomsAgrField->setSize(50); $roomsAgrField->setRequired(false); $roomsAgrField->setInfo($this->lng->txt("rep_robj_xrs_room_agreement_filetypes") . " .bmp, .jpg, .jpeg, .png, .gif, .txt, .pdf"); $this->settingsForm->addItem($roomsAgrField); $this->settingsForm->addCommandButton('updateSettings', $this->lng->txt('save')); $this->settingsForm->setTitle($this->lng->txt('edit_properties')); $this->settingsForm->setFormAction($this->ctrl->getFormAction($this)); }
/** * 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; }