/** * 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 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)); }
/** * 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; }
/** * 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()); }
/** * 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; }
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(); }
/** * 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; }