/** * Render html */ function render($a_mode = "") { global $lng, $tpl, $ilUser; $quota_exceeded = $quota_legend = false; if (self::$check_wsp_quota) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible()) { $lng->loadLanguageModule("file"); return $lng->txt("personal_workspace_quota_exceeded_warning"); } else { $quota_legend = ilDiskQuotaHandler::getStatusLegend(); } } // make sure jQuery is loaded iljQueryUtil::initjQuery(); // add file upload scripts include_once "./Services/FileUpload/classes/class.ilFileUploadGUI.php"; ilFileUploadGUI::initFileUpload(); // load template $this->tpl = new ilTemplate("tpl.prop_dndfiles.html", true, true, "Services/Form"); // general variables $this->tpl->setVariable("UPLOAD_ID", $this->uniqueId); // input $this->tpl->setVariable("FILE_SELECT_ICON", ilUtil::getImagePath('icon_fold.png')); $this->tpl->setVariable("TXT_SHOW_ALL_DETAILS", $lng->txt('show_all_details')); $this->tpl->setVariable("TXT_HIDE_ALL_DETAILS", $lng->txt('hide_all_details')); $this->tpl->setVariable("TXT_SELECTED_FILES", $lng->txt('selected_files')); $this->tpl->setVariable("TXT_DRAG_FILES_HERE", $lng->txt('drag_files_here')); $this->tpl->setVariable("TXT_NUM_OF_SELECTED_FILES", $lng->txt('num_of_selected_files')); $this->tpl->setVariable("TXT_SELECT_FILES_FROM_COMPUTER", $lng->txt('select_files_from_computer')); $this->tpl->setVariable("TXT_OR", $lng->txt('logic_or')); $this->tpl->setVariable("INPUT_ACCEPT_SUFFIXES", $this->getInputAcceptSuffixes($this->getSuffixes())); // info $this->tpl->setCurrentBlock("max_size"); $this->tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString()); $this->tpl->parseCurrentBlock(); if ($quota_legend) { $this->tpl->setVariable("TXT_MAX_SIZE", $quota_legend); $this->tpl->parseCurrentBlock(); } $this->outputSuffixes($this->tpl); // create file upload object $upload = new ilFileUploadGUI("ilFileUploadDropZone_" . $this->uniqueId, $this->uniqueId, false); $upload->enableFormSubmit("ilFileUploadInput_" . $this->uniqueId, $this->submit_button_name, $this->cancel_button_name); $upload->setDropAreaId("ilFileUploadDropArea_" . $this->uniqueId); $upload->setFileListId("ilFileUploadList_" . $this->uniqueId); $upload->setFileSelectButtonId("ilFileUploadFileSelect_" . $this->uniqueId); $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML()); return $this->tpl->get(); }
/** * @param bool $delete * @param ilCloudFileNode $node * @return string $html */ public function getGroupedListItemsHTML($showUpload = false, $showCreateFolders = false) { global $lng; include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; $this->gl = new ilGroupedListGUI(); $this->addItemsBefore(); if ($showUpload) { include_once "Services/FileUpload/classes/class.ilFileUploadGUI.php"; ilFileUploadGUI::initFileUpload(); $icon_path = "./Modules/Cloud/templates/images/icon_file_s.png"; $this->gl->addEntry(ilUtil::img($icon_path) . " " . $lng->txt("cld_add_file"), "javascript:il.CloudFileList.uploadFile();", "_top", "", "", "il_cld_add_file", $lng->txt("cld_info_add_file_to_current_directory"), "bottom center", "top center", false); } if ($showCreateFolders) { $icon_path = "./Modules/Cloud/templates/images/icon_folder_s.png"; $this->gl->addEntry(ilUtil::img($icon_path) . " " . $lng->txt("cld_add_folder"), "javascript:il.CloudFileList.createFolder();", "_top", "", "", "il_cld_add_file", $lng->txt("cld_info_add_folder_to_current_directory"), "bottom center", "top center", false); } $this->addItemsAfter(); return $this->gl->getHTML(); }
/** * @param bool $show_upload * @param bool $show_create_folders * * @return ilCloudGroupedListGUI */ public function getGroupedListItems($show_upload = false, $show_create_folders = false) { global $lng; $this->gl = new ilCloudGroupedListGUI(); $this->addItemsBefore(); $this->gl->setAsDropDown(true); if ($show_upload) { ilFileUploadGUI::initFileUpload(); $icon_path = './Modules/Cloud/templates/images/icon_file_s.svg'; $icon_path = ilUtil::getImagePath('icon_file.svg'); $img = ilUtil::img($icon_path); $a_ttip = $lng->txt('cld_info_add_file_to_current_directory'); $this->gl->addEntry($img . ' ' . $lng->txt('cld_add_file'), 'javascript:il.CloudFileList.uploadFile();', '_top', '', '', 'il_cld_add_file', $a_ttip, 'bottom center', 'top center', false); } if ($show_create_folders) { $icon_path = './Modules/Cloud/templates/images/icon_folder_s.svg'; $icon_path = ilUtil::getImagePath('icon_fold.svg'); $img1 = ilUtil::img($icon_path); $a_ttip1 = $lng->txt('cld_info_add_folder_to_current_directory'); $this->gl->addEntry($img1 . ' ' . $lng->txt('cld_add_folder'), 'javascript:il.CloudFileList.createFolder();', '_top', '', '', 'il_cld_add_file', $a_ttip1, 'bottom center', 'top center', false); } $this->addItemsAfter(); return $this->gl; }
/** * Enables the file upload into this object by dropping files. */ protected function enableDragDropFileUpload() { include_once "./Services/FileUpload/classes/class.ilFileUploadGUI.php"; ilFileUploadGUI::initFileUpload(); $this->tpl->enableDragDropFileUpload($this->ref_id); }
/** * Inserts a file upload component */ public function insertFileUpload() { include_once "./Services/FileUpload/classes/class.ilFileUploadGUI.php"; ilFileUploadGUI::initFileUpload(); $upload = new ilFileUploadGUI($this->getUniqueItemId(true), $this->ref_id); $this->tpl->setCurrentBlock("fileupload"); $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML()); $this->tpl->parseCurrentBlock(); }