コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 protected function show()
 {
     global $tpl, $lng, $ilToolbar, $ilCtrl;
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("prtf_add_portfolio");
     $button->setUrl($ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
     $ilToolbar->addButtonInstance($button);
     include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
     $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
 }
コード例 #3
0
 /**
  * Insert property html
  */
 function insert(&$a_tpl)
 {
     global $lng;
     $quota_exceeded = $quota_legend = false;
     if (self::$check_wsp_quota) {
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         if (!ilDiskQuotaHandler::isUploadPossible()) {
             $lng->loadLanguageModule("file");
             $quota_exceeded = $lng->txt("personal_workspace_quota_exceeded_warning");
         } else {
             $quota_legend = ilDiskQuotaHandler::getStatusLegend();
             if ($quota_legend) {
                 $quota_legend = "<br />" . $quota_legend;
             }
         }
     }
     $i_tpl = new ilTemplate("tpl.prop_image_file.html", true, true, "Services/Form");
     if ($this->getImage() != "") {
         if (!$this->getDisabled() && $this->getALlowDeletion()) {
             $i_tpl->setCurrentBlock("delete_bl");
             $i_tpl->setVariable("POST_VAR_D", $this->getPostVar());
             $i_tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
             $i_tpl->parseCurrentBlock();
         }
         if (strlen($this->getValue())) {
             $i_tpl->setCurrentBlock("has_value");
             $i_tpl->setVariable("TEXT_IMAGE_NAME", $this->getValue());
             $i_tpl->parseCurrentBlock();
         }
         $i_tpl->setCurrentBlock("image");
         if (!$this->getUseCache()) {
             $pos = strpos($this->getImage(), '?');
             if ($pos !== false) {
                 $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "&amp;time=" . time());
             } else {
                 $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "?time=" . time());
             }
         } else {
             $i_tpl->setVariable("SRC_IMAGE", $this->getImage());
         }
         $i_tpl->setVariable("ALT_IMAGE", $this->getAlt());
         $i_tpl->parseCurrentBlock();
     }
     $pending = $this->getPending();
     if ($pending) {
         $i_tpl->setCurrentBlock("pending");
         $i_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending") . ": " . $pending);
         $i_tpl->parseCurrentBlock();
     }
     $i_tpl->setVariable("POST_VAR", $this->getPostVar());
     $i_tpl->setVariable("ID", $this->getFieldId());
     if (!$quota_exceeded) {
         $i_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString() . $quota_legend);
         $this->outputSuffixes($i_tpl, "allowed_image_suffixes");
     } else {
         $i_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded);
     }
     if ($this->getDisabled() || $quota_exceeded) {
         $i_tpl->setVariable("DISABLED", " disabled=\"disabled\"");
     }
     $a_tpl->setCurrentBlock("prop_generic");
     $a_tpl->setVariable("PROP_GENERIC", $i_tpl->get());
     $a_tpl->parseCurrentBlock();
 }
コード例 #4
0
 /**
  * Render html
  */
 function render($a_mode = "")
 {
     global $lng;
     $quota_exceeded = $quota_legend = false;
     if (self::$check_wsp_quota) {
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         if (!ilDiskQuotaHandler::isUploadPossible()) {
             $lng->loadLanguageModule("file");
             $quota_exceeded = $lng->txt("personal_workspace_quota_exceeded_warning");
         } else {
             $quota_legend = ilDiskQuotaHandler::getStatusLegend();
         }
     }
     $f_tpl = new ilTemplate("tpl.prop_file.html", true, true, "Services/Form");
     // show filename selection if enabled
     if ($this->isFileNameSelectionEnabled()) {
         $f_tpl->setCurrentBlock('filename');
         $f_tpl->setVariable('POST_FILENAME', $this->getFileNamePostVar());
         $f_tpl->setVariable('VAL_FILENAME', $this->getFilename());
         $f_tpl->setVariable('FILENAME_ID', $this->getFieldId());
         $f_tpl->setVAriable('TXT_FILENAME_HINT', $lng->txt('if_no_title_then_filename'));
         $f_tpl->parseCurrentBlock();
     } else {
         if (trim($this->getValue() != "")) {
             if (!$this->getDisabled() && $this->getALlowDeletion()) {
                 $f_tpl->setCurrentBlock("delete_bl");
                 $f_tpl->setVariable("POST_VAR_D", $this->getPostVar());
                 $f_tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
                 $f_tpl->parseCurrentBlock();
             }
             $f_tpl->setCurrentBlock('prop_file_propval');
             $f_tpl->setVariable('FILE_VAL', $this->getValue());
             $f_tpl->parseCurrentBlock();
         }
     }
     if ($a_mode != "toolbar") {
         if (!$quota_exceeded) {
             $this->outputSuffixes($f_tpl);
             $f_tpl->setCurrentBlock("max_size");
             $f_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString());
             $f_tpl->parseCurrentBlock();
             if ($quota_legend) {
                 $f_tpl->setVariable("TXT_MAX_SIZE", $quota_legend);
                 $f_tpl->parseCurrentBlock();
             }
         } else {
             $f_tpl->setCurrentBlock("max_size");
             $f_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded);
             $f_tpl->parseCurrentBlock();
         }
     } else {
         if ($quota_exceeded) {
             return $quota_exceeded;
         }
     }
     $pending = $this->getPending();
     if ($pending) {
         $f_tpl->setCurrentBlock("pending");
         $f_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending") . ": " . $pending);
         $f_tpl->parseCurrentBlock();
     }
     if ($this->getDisabled() || $quota_exceeded) {
         $f_tpl->setVariable("DISABLED", " disabled=\"disabled\"");
     }
     $f_tpl->setVariable("POST_VAR", $this->getPostVar());
     $f_tpl->setVariable("ID", $this->getFieldId());
     $f_tpl->setVariable("SIZE", $this->getSize());
     return $f_tpl->get();
 }
コード例 #5
0
 protected function show()
 {
     global $tpl, $lng, $ilToolbar, $ilCtrl;
     $ilToolbar->addButton($lng->txt("prtf_add_portfolio"), $ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
     include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
     $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
 }