/** * 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()); }