/**
  * @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;
 }
Beispiel #3
0
 /**
  * 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);
 }
Beispiel #4
0
 /**
  * Fill header
  */
 private function fillHeader()
 {
     global $lng, $ilUser, $ilCtrl;
     $icon = false;
     if ($this->icon_path != "") {
         $icon = true;
         $this->setCurrentBlock("header_image");
         if ($this->icon_desc != "") {
             $this->setVariable("IMAGE_DESC", $lng->txt("icon") . " " . $this->icon_desc);
             $this->setVariable("IMAGE_ALT", $lng->txt("icon") . " " . $this->icon_desc);
         }
         $this->setVariable("IMG_HEADER", $this->icon_path);
         $this->parseCurrentBlock();
         $header = true;
     }
     if ($this->title != "") {
         $this->title = ilUtil::stripScriptHTML($this->title);
         $this->setVariable("HEADER", $this->title);
         if ($this->title_url != "") {
             $this->setVariable("HEADER_URL", ' href="' . $this->title_url . '"');
         }
         if ($this->getTitleColor() != "") {
             $this->setVariable("HEADER_COLOR", " style=\"color: #" . $this->getTitleColor() . "\"");
         }
         if ($icon) {
             //$this->setVariable("HICONCL", "ilHeaderHasIcon");
         }
         $header = true;
     }
     if ($header) {
         $this->setCurrentBlock("header_image");
         $this->parseCurrentBlock();
     }
     if ($this->title_desc != "") {
         $this->setCurrentBlock("header_desc");
         $this->setVariable("H_DESCRIPTION", $this->title_desc);
         $this->parseCurrentBlock();
     }
     $header = $this->getHeaderActionMenu();
     if ($header) {
         $this->setCurrentBlock("head_action_inner");
         $this->setVariable("HEAD_ACTION", $header);
         $this->parseCurrentBlock();
         $this->touchBlock("head_action");
     }
     if (count((array) $this->title_alerts)) {
         foreach ($this->title_alerts as $alert) {
             $this->setCurrentBlock('header_alert');
             if (!($alert['propertyNameVisible'] === false)) {
                 $this->setVariable('H_PROP', $alert['property'] . ':');
             }
             $this->setVariable('H_VALUE', $alert['value']);
             $this->parseCurrentBlock();
         }
     }
     // add file upload drop zone in header
     if ($this->enable_fileupload != null) {
         $ref_id = $this->enable_fileupload;
         $upload_id = "dropzone_" . $ref_id;
         include_once "./Services/FileUpload/classes/class.ilFileUploadGUI.php";
         $upload = new ilFileUploadGUI($upload_id, $ref_id, true);
         $this->setVariable("FILEUPLOAD_DROPZONE_ID", " id=\"{$upload_id}\"");
         $this->setCurrentBlock("header_fileupload");
         $this->setVariable("HEADER_FILEUPLOAD_SCRIPT", $upload->getHTML());
         $this->parseCurrentBlock();
     }
 }
 /**
  * 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();
 }
 /**
  * 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();
 }
 /**
  * Gets the code that is shared by all upload instances.
  * 
  * @return string The shared code by all upload instances.
  */
 protected function getSharedHtml()
 {
     global $lng;
     // already loaded?
     if (self::$shared_code_loaded) {
         return "";
     }
     // make sure required scripts are loaded
     self::initFileUpload();
     // load script template
     $tpl_shared = new ilTemplate("tpl.fileupload_shared.html", true, true, "Services/FileUpload");
     // initialize localized texts
     $lng->loadLanguageModule("form");
     $tpl_shared->setCurrentBlock("fileupload_texts");
     $tpl_shared->setVariable("ERROR_MSG_FILE_TOO_LARGE", $lng->txt("form_msg_file_size_exceeds"));
     $tpl_shared->setVariable("ERROR_MSG_WRONG_FILE_TYPE", $lng->txt("form_msg_file_wrong_file_type"));
     $tpl_shared->setVariable("ERROR_MSG_EMPTY_FILE_OR_FOLDER", $lng->txt("error_empty_file_or_folder"));
     $tpl_shared->setVariable("ERROR_MSG_UPLOAD_ZERO_BYTES", $lng->txt("error_upload_was_zero_bytes"));
     $tpl_shared->setVariable("QUESTION_CANCEL_ALL", $lng->txt("cancel_file_upload"));
     $tpl_shared->setVariable("ERROR_MSG_EXTRACT_FAILED", $lng->txt("error_extraction_failed"));
     $tpl_shared->setVariable("PROGRESS_UPLOADING", $lng->txt("uploading"));
     $tpl_shared->setVariable("PROGRESS_EXTRACTING", $lng->txt("extracting"));
     $tpl_shared->setVariable("DROP_FILES_HERE", $lng->txt("drop_files_on_repo_obj_info"));
     $tpl_shared->parseCurrentBlock();
     // initialize default values
     $tpl_shared->setCurrentBlock("fileupload_defaults");
     $tpl_shared->setVariable("CONCURRENT_UPLOADS", ilFileUploadSettings::getConcurrentUploads());
     $tpl_shared->setVariable("MAX_FILE_SIZE", ilFileUploadUtil::getMaxFileSize());
     $tpl_shared->setVariable("ALLOWED_SUFFIXES", "");
     $tpl_shared->setVariable("SUPPORTED_ARCHIVES", "\"zip\"");
     $tpl_shared->parseCurrentBlock();
     // load panel template
     $tpl_panel = new ilTemplate("tpl.fileupload_panel_template.html", true, true, "Services/FileUpload");
     $tpl_panel->setVariable("TXT_HEADER", $lng->txt("upload_files_title"));
     $tpl_panel->setVariable("TXT_SHOW_ALL_DETAILS", $lng->txt('show_all_details'));
     $tpl_panel->setVariable("TXT_HIDE_ALL_DETAILS", $lng->txt('hide_all_details'));
     $tpl_shared->setCurrentBlock("fileupload_panel_tmpl");
     $tpl_shared->setVariable("PANEL_TEMPLATE_HTML", $tpl_panel->get());
     $tpl_shared->parseCurrentBlock();
     // load row template
     $tpl_row = new ilTemplate("tpl.fileupload_row_template.html", true, true, "Services/FileUpload");
     $tpl_row->setVariable("IMG_ALERT", ilUtil::getImagePath("icon_alert_s.gif"));
     $tpl_row->setVariable("ALT_ALERT", $lng->txt("alert"));
     $tpl_row->setVariable("TXT_CANCEL", $lng->txt("cancel"));
     $tpl_row->setVariable("TXT_REMOVE", $lng->txt("remove"));
     $tpl_row->setVariable("TXT_TITLE", $lng->txt("title"));
     $tpl_row->setVariable("TXT_DESCRIPTION", $lng->txt("description"));
     $tpl_row->setVariable("TXT_EXTRACT", $lng->txt("unzip"));
     $tpl_row->setVariable("TXT_KEEP_STRUCTURE", $lng->txt("take_over_structure"));
     $tpl_row->setVariable("TXT_KEEP_STRUCTURE_INFO", $lng->txt("take_over_structure_info"));
     $tpl_row->setVariable("TXT_PENDING", $lng->txt("upload_pending"));
     $tpl_shared->setCurrentBlock("fileupload_row_tmpl");
     $tpl_shared->setVariable("ROW_TEMPLATE_HTML", $tpl_row->get());
     $tpl_shared->parseCurrentBlock();
     // shared code now loaded
     self::$shared_code_loaded = true;
     // create HTML
     return $tpl_shared->get();
 }