/**
  * 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();
 }
示例#2
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();
     }
 }
 /**
  * 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();
 }