/** * Edit news settings. */ public function editSettings() { global $ilCtrl, $lng, $ilSetting, $ilTabs, $ilToolbar; $ilTabs->activateTab("settings"); if (OH_REF_ID > 0) { ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported."); return; } if ($this->checkPermissionBool("write")) { // help file include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file"); $fi->setSuffixes(array("zip")); $ilToolbar->addInputItem($fi, true); $ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile"); $ilToolbar->addSeparator(); // help mode include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $options = array("" => $lng->txt("help_tooltips_and_help"), "1" => $lng->txt("help_help_only"), "2" => $lng->txt("help_tooltips_only")); $si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode"); $si->setOptions($options); $si->setValue($ilSetting->get("help_mode")); $ilToolbar->addInputItem($si); $ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode"); } $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true); include_once "./Services/Help/classes/class.ilHelpModuleTableGUI.php"; $tab = new ilHelpModuleTableGUI($this, "editSettings"); $this->tpl->setContent($tab->getHTML()); }
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; }
/** * 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; }
/** * Constructor * * @param string $a_title Title * @param string $a_postvar Post Variable */ function __construct($a_title = "", $a_postvar = "") { parent::__construct($a_title, $a_postvar); $this->setType("flash_file"); $this->setSuffixes(array("swf")); $this->width = 550; $this->height = 400; $this->parameters = array(); }
/** * Constructor * * @param string $a_title Title * @param string $a_postvar Post Variable */ function __construct($a_title = "", $a_postvar = "") { global $lng; parent::__construct($a_title, $a_postvar); $this->setType("image_file"); $this->setAllowDeletion(true); $this->setSuffixes(array("jpg", "jpeg", "png", "gif")); $this->setHiddenTitle("(" . $lng->txt("form_image_file_input") . ")"); $this->cache = true; }
protected function initNewAccountMailForm() { global $lng, $ilCtrl; $lng->loadLanguageModule("meta"); $lng->loadLanguageModule("mail"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitleIcon(ilUtil::getImagePath("icon_mail.png")); $form->setTitle($lng->txt("user_new_account_mail")); $form->setDescription($lng->txt("user_new_account_mail_desc")); $langs = $lng->getInstalledLanguages(); foreach ($langs as $lang_key) { $amail = $this->object->_lookupNewAccountMail($lang_key); $title = $lng->txt("meta_l_" . $lang_key); if ($lang_key == $lng->getDefaultLanguage()) { $title .= " (" . $lng->txt("default") . ")"; } $header = new ilFormSectionHeaderGUI(); $header->setTitle($title); $form->addItem($header); $subj = new ilTextInputGUI($lng->txt("subject"), "subject_" . $lang_key); // $subj->setRequired(true); $subj->setValue($amail["subject"]); $form->addItem($subj); $salg = new ilTextInputGUI($lng->txt("mail_salutation_general"), "sal_g_" . $lang_key); // $salg->setRequired(true); $salg->setValue($amail["sal_g"]); $form->addItem($salg); $salf = new ilTextInputGUI($lng->txt("mail_salutation_female"), "sal_f_" . $lang_key); // $salf->setRequired(true); $salf->setValue($amail["sal_f"]); $form->addItem($salf); $salm = new ilTextInputGUI($lng->txt("mail_salutation_male"), "sal_m_" . $lang_key); // $salm->setRequired(true); $salm->setValue($amail["sal_m"]); $form->addItem($salm); $body = new ilTextAreaInputGUI($lng->txt("message_content"), "body_" . $lang_key); // $body->setRequired(true); $body->setValue($amail["body"]); $body->setRows(10); $body->setCols(100); $form->addItem($body); $att = new ilFileInputGUI($lng->txt("attachment"), "att_" . $lang_key); $att->setAllowDeletion(true); if ($amail["att_file"]) { $att->setValue($amail["att_file"]); } $form->addItem($att); } $form->addCommandButton("saveNewAccountMail", $lng->txt("save")); $form->addCommandButton("cancelNewAccountMail", $lng->txt("cancel")); return $form; }
/** * 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; }
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; }
/** * list files */ function listFiles() { global $ilToolbar, $lng, $ilCtrl; // determine directory // FIXME: I have to call stripSlashes here twice, because I could not // determine where the second layer of slashes is added to the // URL Parameter $cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["cdir"])); $new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["newdir"])); if ($new_subdir == "..") { $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/")); } else { if (!empty($new_subdir)) { if (!empty($cur_subdir)) { $cur_subdir = $cur_subdir . "/" . $new_subdir; } else { $cur_subdir = $new_subdir; } } } $cur_subdir = str_replace("..", "", $cur_subdir); $cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir; $this->ctrl->setParameter($this, "cdir", $cur_subdir); // toolbar for adding files/directories $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true); include_once "./Services/Form/classes/class.ilTextInputGUI.php"; if ($this->getAllowDirectories() && $this->getAllowDirectoryCreation()) { $ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), "new_dir"); $ti->setMaxLength(80); $ti->setSize(10); $ilToolbar->addInputItem($ti, true); $ilToolbar->addFormButton($lng->txt("create"), "createDirectory"); $ilToolbar->addSeparator(); } include_once "./Services/Form/classes/class.ilFileInputGUI.php"; if ($this->getAllowFileCreation()) { $fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file"); $fi->setSize(10); $ilToolbar->addInputItem($fi, true); $ilToolbar->addFormButton($lng->txt("upload"), "uploadFile"); } include_once 'Services/FileSystem/classes/class.ilUploadFiles.php'; if (ilUploadFiles::_getUploadDirectory()) { $ilToolbar->addSeparator(); $files = ilUploadFiles::_getUploadFiles(); $options[""] = $lng->txt("cont_select_from_upload_dir"); foreach ($files as $file) { $file = htmlspecialchars($file, ENT_QUOTES, "utf-8"); $options[$file] = $file; } include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file"); $si->setOptions($options); $ilToolbar->addInputItem($si, true); $ilToolbar->addFormButton($lng->txt("copy"), "uploadFile"); } // load files templates include_once "./Services/FileSystem/classes/class.ilFileSystemTableGUI.php"; $fs_table = new ilFileSystemTableGUI($this, "listFiles", $cur_dir, $cur_subdir, $this->label_enable, $this->file_labels, $this->label_header, $this->commands, $this->getPostDirPath()); $fs_table->setId($this->getTableId()); if ($this->getTitle() != "") { $fs_table->setTitle($this->getTitle()); } if ($_GET["resetoffset"] == 1) { $fs_table->resetOffset(); } $this->tpl->setContent($fs_table->getHTML()); }
/** * Constructor * * @param string $a_title Title * @param string $a_postvar Post Variable */ function __construct($a_title = "", $a_postvar = "") { parent::__construct($a_title, $a_postvar); }
/** * Init add cast item form. */ function initAddCastItemForm($a_mode = "create") { global $lng, $ilCtrl, $ilTabs; $this->checkPermission("write"); $ilTabs->activateTab("edit_content"); $lng->loadLanguageModule("mcst"); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setMultipart(true); // Property Title $text_input = new ilTextInputGUI($lng->txt("title"), "title"); $text_input->setMaxLength(200); $this->form_gui->addItem($text_input); // Property Content $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description"); $text_area->setRequired(false); $this->form_gui->addItem($text_area); // Property Visibility if ($enable_internal_rss) { $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility"); $radio_option = new ilRadioOption($lng->txt("access_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("access_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("mcst_visibility_info")); $radio_group->setRequired(true); $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public"); $this->form_gui->addItem($radio_group); } // Duration $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration"); $dur->setInfo($lng->txt("mcst_duration_info")); $dur->setShowDays(false); $dur->setShowHours(true); $dur->setShowSeconds(true); $this->form_gui->addItem($dur); foreach (ilObjMediaCast::$purposes as $purpose) { if ($purpose == "VideoAlternative" && $a_mode == "create") { continue; } $section = new ilFormSectionHeaderGUI(); $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title")); $this->form_gui->addItem($section); if ($a_mode != "create") { $value = new ilHiddenInputGUI("value_" . $purpose); $label = new ilNonEditableValueGUI($lng->txt("value")); $label->setPostVar("label_value_" . $purpose); $label->setInfo($lng->txt("mcst_current_value_info")); $this->form_gui->addItem($label); $this->form_gui->addItem($value); } $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose); $file->setSuffixes($this->purposeSuffixes[$purpose]); $this->form_gui->addItem($file); $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose); $text_input->setPattern("/https?\\:\\/\\/.+/i"); $text_input->setInfo($lng->txt("mcst_reference_info")); $this->form_gui->addItem($text_input); if ($purpose != "Standard") { $clearCheckBox = new ilCheckboxInputGUI(); $clearCheckBox->setPostVar("delete_" . $purpose); $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title")); $this->form_gui->addItem($clearCheckBox); } else { // mime type selection $mimeTypeSelection = new ilSelectInputGUI(); $mimeTypeSelection->setPostVar("mimetype_" . $purpose); $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype")); $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info")); $options = array("" => $lng->txt("mcst_automatic_detection")); $options = array_merge($options, $this->mimeTypes); $mimeTypeSelection->setOptions($options); $this->form_gui->addItem($mimeTypeSelection); // preview picure $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic"); $pp->setSuffixes(array("png", "jpeg", "jpg")); $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif"); $this->form_gui->addItem($pp); } } // save/cancel button if ($a_mode == "create") { $this->form_gui->setTitle($lng->txt("mcst_add_new_item")); $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save")); } else { $this->form_gui->setTitle($lng->txt("mcst_edit_item")); $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save")); } $this->form_gui->addCommandButton("listItems", $lng->txt("cancel")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem")); }
/** * 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")); }
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 upload form form. */ public function initZipUploadForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // desc include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI($lng->txt("file"), "deliver"); $fi->setSuffixes(array("zip")); $this->form->addItem($fi); $this->form->addCommandButton("deliverUnzip", $lng->txt("upload")); $this->form->setTitle($lng->txt("header_zip")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
/** * 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()); } } } }
/** * 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 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; }
/** * 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; }
function executeCommand() { global $ilCtrl, $tpl, $ilTabs, $lng, $ilNavigationHistory; // goto link to blog posting if ($_GET["gtp"]) { $ilCtrl->setCmdClass("ilblogpostinggui"); $_GET["blpg"] = $_GET["gtp"]; $ilCtrl->setCmd("previewFullscreen"); } $next_class = $ilCtrl->getNextClass($this); $cmd = $ilCtrl->getCmd(); if ($this->id_type == self::REPOSITORY_NODE_ID) { $tpl->getStandardTemplate(); // add entry to navigation history if (!$this->getCreationMode() && $this->getAccessHandler()->checkAccess("read", "", $this->node_id)) { $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"); $ilNavigationHistory->addItem($this->node_id, $link, "blog"); } } switch ($next_class) { case 'ilblogpostinggui': // #9680 if ($this->id_type == self::REPOSITORY_NODE_ID) { $this->setLocator(); } else { include_once "Services/Form/classes/class.ilFileInputGUI.php"; ilFileInputGUI::setPersonalWorkspaceQuotaCheck(true); } $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "")); include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php"; $bpost_gui = new ilBlogPostingGUI($this->node_id, $this->getAccessHandler(), $_GET["blpg"], $_GET["old_nr"], $this->object->getNotesStatus() && !$this->disable_notes, $this->mayContribute($_GET["blpg"])); // needed for editor $bpost_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->object->getStyleSheetId(), "blog")); // keep preview mode through notes gui (has its own commands) switch ($cmd) { // blog preview case "previewFullscreen": $ilCtrl->setParameter($this, "prvm", "fsc"); break; // blog in portfolio // blog in portfolio case "previewEmbedded": $ilCtrl->setParameter($this, "prvm", "emb"); break; // edit // edit default: $this->setContentStyleSheet(); $this->ctrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]); $this->tabs_gui->addNonTabbedLink("preview", $lng->txt("blog_preview"), $this->ctrl->getLinkTargetByClass("ilblogpostinggui", "previewFullscreen")); $this->ctrl->setParameterByClass("ilblogpostinggui", "blpg", ""); break; } $ret = $ilCtrl->forwardCommand($bpost_gui); if ($ret != "") { // keep preview mode through notes gui if ($_REQUEST["prvm"]) { $cmd = "preview" . ($_REQUEST["prvm"] == "fsc" ? "Fullscreen" : "Embedded"); } // $is_owner = $this->object->getOwner() == $ilUser->getId(); $is_owner = $this->mayContribute(); $is_active = $bpost_gui->getBlogPosting()->getActive(); // do not show inactive postings if (($cmd == "previewFullscreen" || $cmd == "previewEmbedded") && !$is_owner && !$is_active) { $this->ctrl->redirect($this, "preview"); } switch ($cmd) { // blog preview case "previewFullscreen": $this->addHeaderAction($cmd); $this->filterInactivePostings(); $nav = $this->renderNavigation($this->items, "preview", $cmd); $this->renderFullScreen($ret, $nav); break; // blog in portfolio // blog in portfolio case "previewEmbedded": $this->filterInactivePostings(); $nav = $this->renderNavigation($this->items, "gethtml", $cmd); return $this->buildEmbedded($ret, $nav); // ilias/editor // ilias/editor default: // infos about draft status / snippet $info = array(); if (!$is_active) { // single author blog (owner) in personal workspace if ($this->id_type == self::WORKSPACE_NODE_ID) { $info[] = $lng->txt("blog_draft_info"); } else { $info[] = $lng->txt("blog_draft_info_contributors"); } } if ($cmd != "history" && !$bpost_gui->getBlogPosting()->getFirstParagraphText()) { $info[] = $lng->txt("blog_new_posting_info"); } if ($this->object->hasApproval() && !$bpost_gui->getBlogPosting()->isApproved()) { // #9737 $info[] = $lng->txt("blog_posting_edit_approval_info"); } if (sizeof($info)) { ilUtil::sendInfo(implode("<br />", $info)); } // revert to edit cmd to avoid confusion $this->addHeaderAction("render"); $tpl->setContent($ret); $nav = $this->renderNavigation($this->items, "render", $cmd, null, $is_owner); $tpl->setRightContent($nav); break; } } break; case "ilinfoscreengui": $this->prepareOutput(); $this->infoScreenForward(); break; case "ilnotegui": $this->preview(); break; case "ilcommonactiondispatchergui": include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; case "ilpermissiongui": $this->prepareOutput(); $ilTabs->activateTab("id_permissions"); include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui = new ilPermissionGUI($this); $this->ctrl->forwardCommand($perm_gui); break; case "ilobjectcopygui": include_once "./Services/Object/classes/class.ilObjectCopyGUI.php"; $cp = new ilObjectCopyGUI($this); $cp->setType("blog"); $this->ctrl->forwardCommand($cp); break; case 'ilrepositorysearchgui': $this->prepareOutput(); $ilTabs->activateTab("contributors"); include_once './Services/Search/classes/class.ilRepositorySearchGUI.php'; $rep_search = new ilRepositorySearchGUI(); $rep_search->setTitle($this->lng->txt("blog_add_contributor")); $rep_search->setCallback($this, 'addContributor'); $this->ctrl->setReturn($this, 'contributors'); $ret =& $this->ctrl->forwardCommand($rep_search); break; case 'ilexportgui': $this->prepareOutput(); $ilTabs->activateTab("export"); include_once "./Services/Export/classes/class.ilExportGUI.php"; $exp_gui = new ilExportGUI($this); $exp_gui->addFormat("xml"); $ret = $ilCtrl->forwardCommand($exp_gui); break; case "ilobjstylesheetgui": include_once "./Services/Style/classes/class.ilObjStyleSheetGUI.php"; $this->ctrl->setReturn($this, "editStyleProperties"); $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false); $style_gui->omitLocator(); if ($cmd == "create" || $_GET["new_type"] == "sty") { $style_gui->setCreationMode(true); } if ($cmd == "confirmedDelete") { $this->object->setStyleSheetId(0); $this->object->update(); } $ret = $this->ctrl->forwardCommand($style_gui); if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") { $style_id = $ret; $this->object->setStyleSheetId($style_id); $this->object->update(); $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit"); } break; default: if ($cmd != "gethtml") { // desktop item handling, must be toggled before header action if ($cmd == "addToDesk" || $cmd == "removeFromDesk") { $this->{$cmd . "Object"}(); if ($_GET["prvm"]) { $cmd = "preview"; } else { $cmd = "render"; } $ilCtrl->setCmd($cmd); } $this->addHeaderAction($cmd); } return parent::executeCommand(); } return true; }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
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; }
/** * Get HTML for file link * @return string file link html */ function getFileLinkHTML() { global $ilCtrl, $lng; if (!is_object($this->uploaded_file)) { $tpl = new ilTemplate("tpl.link_file.html", true, true, "Modules/LearningModule"); $tpl->setCurrentBlock("form"); $tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, "saveFileLink", "", true)); $tpl->setVariable("TXT_SELECT_FILE", $lng->txt("cont_select_file")); $tpl->setVariable("TXT_SAVE_LINK", $lng->txt("cont_create_link")); $tpl->setVariable("CMD_SAVE_LINK", "saveFileLink"); include_once "./Services/Form/classes/class.ilFileInputGUI.php"; $fi = new ilFileInputGUI("", "link_file"); $fi->setSize(15); $tpl->setVariable("INPUT", $fi->getToolbarHTML()); $tpl->parseCurrentBlock(); return $tpl->get(); } else { $tpl = new ilTemplate("tpl.link_file.html", true, true, "Modules/LearningModule"); $tpl->setCurrentBlock("link_js"); // $tpl->setVariable("LINK_FILE", // $this->prepareJavascriptOutput("[iln dfile=\"".$this->uploaded_file->getId()."\"] [/iln]") // ); $tpl->setVariable("TAG_B", '[iln dfile=\\x22' . $this->uploaded_file->getId() . '\\x22]'); $tpl->setVariable("TAG_E", "[/iln]"); $tpl->setVariable("TXT_FILE", $this->uploaded_file->getTitle()); // $tpl->parseCurrentBlock(); return $tpl->get(); } }
/** * 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; }
/** * Create import form */ protected function initImportForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('cal_import_tbl')); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton('uploadAppointments', $this->lng->txt('import')); $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file'); $ics->setALlowDeletion(false); $ics->setSuffixes(array('ics')); $ics->setInfo($this->lng->txt('cal_import_file_info')); $form->addItem($ics); return $form; }
/** * Build property form * @param string $a_mode * @param int $id * @return object */ function initForm($a_mode = "create", $id = NULL) { global $lng, $ilCtrl, $ilObjDataCache; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form_gui = new ilPropertyFormGUI(); $title = new ilTextInputGUI($lng->txt("title"), "title"); $title->setRequired(true); $title->setSize(40); $title->setMaxLength(120); $form_gui->addItem($title); $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc"); $desc->setCols(70); $desc->setRows(15); $form_gui->addItem($desc); $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file"); $file->setALlowDeletion(true); $form_gui->addItem($file); $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items"); $nr->setRequired(true); $nr->setSize(3); $nr->setMaxLength(3); $form_gui->addItem($nr); if ($this->pool_has_schedule) { $options = array(); include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php'; foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) { $options[$schedule["booking_schedule_id"]] = $schedule["title"]; } $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule"); $schedule->setRequired(true); $schedule->setOptions($options); $form_gui->addItem($schedule); } $post = new ilFormSectionHeaderGUI(); $post->setTitle($lng->txt("book_post_booking_information")); $form_gui->addItem($post); $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text"); $pdesc->setCols(70); $pdesc->setRows(15); $form_gui->addItem($pdesc); $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file"); $pfile->setALlowDeletion(true); $form_gui->addItem($pfile); if ($a_mode == "edit") { $form_gui->setTitle($lng->txt("book_edit_object")); $item = new ilHiddenInputGUI('object_id'); $item->setValue($id); $form_gui->addItem($item); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $obj = new ilBookingObject($id); $title->setValue($obj->getTitle()); $desc->setValue($obj->getDescription()); $nr->setValue($obj->getNrOfItems()); $pdesc->setValue($obj->getPostText()); $file->setValue($obj->getFile()); $pfile->setValue($obj->getPostFile()); if (isset($schedule)) { $schedule->setValue($obj->getScheduleId()); } $form_gui->addCommandButton("update", $lng->txt("save")); } else { $form_gui->setTitle($lng->txt("book_add_object")); $form_gui->addCommandButton("save", $lng->txt("save")); $form_gui->addCommandButton("render", $lng->txt("cancel")); } $form_gui->setFormAction($ilCtrl->getFormAction($this)); return $form_gui; }
/** * 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)); }
/** * 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); }