Exemplo n.º 1
0
 /**
  * Determines whether files can be uploaded to the object with the specified reference id.
  * 
  * @param int $a_ref_id The reference id to check.
  * @param string $a_type The type of the object to check.
  * @return bool true, if file upload is allowed; otherwise, false.
  */
 public static function isUploadAllowed($a_ref_id, $a_type = "")
 {
     global $objDefinition, $ilAccess;
     if (self::isUploadSupported()) {
         include_once "./Services/FileUpload/classes/class.ilFileUploadSettings.php";
         // repository upload enabled?
         if (ilFileUploadSettings::isDragAndDropUploadEnabled() && ilFileUploadSettings::isRepositoryDragAndDropUploadEnabled()) {
             if ($a_type == "") {
                 $a_type = ilObject::_lookupType($a_ref_id, true);
             }
             if ($objDefinition->isContainer($a_type)) {
                 return $ilAccess->checkAccess("create_file", "", $a_ref_id, "file");
             }
         }
     }
     return false;
 }
 /**
  * Edit upload settings.
  */
 public function editUploadSettings()
 {
     global $rbacsystem, $ilErr, $tpl, $lng, $ilSetting;
     $this->tabs_gui->setTabActive('upload_settings');
     if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
         $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING);
     }
     // get form
     $form = $this->initUploadSettingsForm();
     require_once "Services/FileUpload/classes/class.ilFileUploadSettings.php";
     // set current values
     $val = array();
     $val["enable_dnd_upload"] = ilFileUploadSettings::isDragAndDropUploadEnabled();
     $val["enable_repository_dnd_upload"] = ilFileUploadSettings::isRepositoryDragAndDropUploadEnabled();
     $val["concurrent_uploads"] = ilFileUploadSettings::getConcurrentUploads();
     $val["suffix_repl_additional"] = $ilSetting->get("suffix_repl_additional");
     $form->setValuesByArray($val);
     // set content
     $tpl->setContent($form->getHTML());
 }
Exemplo n.º 3
0
 protected function initCreationForms()
 {
     $forms = array();
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         if (!ilDiskQuotaHandler::isUploadPossible()) {
             $this->lng->loadLanguageModule("file");
             ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
             $this->ctrl->redirect($this, "cancel");
         }
     }
     // use drag-and-drop upload if configured
     require_once "Services/FileUpload/classes/class.ilFileUploadSettings.php";
     if (ilFileUploadSettings::isDragAndDropUploadEnabled()) {
         $forms[] = $this->initMultiUploadForm();
     } else {
         $forms[] = $this->initSingleUploadForm();
         $forms[] = $this->initZipUploadForm();
     }
     // repository only
     if ($this->id_type != self::WORKSPACE_NODE_ID) {
         $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
         $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
     }
     return $forms;
 }