63 if ($this->repo_helper->checkCreateAccessForType($this->obj->getRefId(),
'file')) {
65 if ($this->dav_helper->isValidFileNameWithValidFileExtension(
$name)) {
68 $file_dav->put(
$data);
71 $file_obj->setTitle(
$name);
72 $file_obj->setFileName(
$name);
73 $file_obj->setVersion(1);
74 $file_obj->setMaxVersion(1);
75 $file_obj->createDirectory();
78 $file_obj->createReference();
79 $file_obj->putInTree($this->obj->getRefId());
80 $file_obj->setPermissions($this->ref_id);
83 $file_dav =
new ilObjFileDAV($file_obj, $this->repo_helper, $this->dav_helper);
84 $file_dav->handleFileUpload(
$data,
"create");
89 throw new Forbidden(
'Invalid file name or file extension');
92 throw new Forbidden(
'No write access');
95 return $file_dav->getETag();
110 if ($this->repo_helper->checkCreateAccessForType($this->getRefId(),
$type) && $this->dav_helper->isDAVableObjTitle(
$name)) {
121 ilLoggerFactory::getLogger(
'WebDAV')->info(get_class($this) .
' ' . $this->obj->getTitle() .
" -> $type is not supported as webdav directory");
122 throw new NotImplemented(
"Create type '$type' as collection is not implemented yet");
125 $new_obj->setType(
$type);
126 $new_obj->setOwner($DIC->user()->getId());
127 $new_obj->setTitle(
$name);
130 $new_obj->createReference();
131 $new_obj->putInTree($this->obj->getRefId());
132 $new_obj->setPermissions($this->obj->getRefId());
135 throw new Forbidden();
152 $child_exists =
false;
160 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
162 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
164 if ($this->repo_helper->getObjectTitleFromRefId($child_ref,
true) ==
$name) {
165 $child_exists =
true;
168 if ($this->repo_helper->checkAccess(
"read", $child_ref)
169 && $this->repo_helper->checkAccess(
"visible", $child_ref)) {
170 $child_node = $this->dav_helper->createDAVObjectForRefId($child_ref);
177 if (!is_null($child_node)) {
192 $child_nodes = array();
193 $already_seen_titles = array();
194 $problem_info_file_needed =
false;
196 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
198 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
200 $title = $this->repo_helper->getObjectTitleFromRefId($child_ref);
201 if (in_array($title, $already_seen_titles)) {
202 $problem_info_file_needed =
true;
206 $already_seen_titles[] = $title;
209 if ($this->repo_helper->checkAccess(
"read", $child_ref)
210 && $this->repo_helper->checkAccess(
"visible", $child_ref)) {
212 $child_nodes[$child_ref] = $this->dav_helper->createDAVObjectForRefId($child_ref);
216 elseif (!$problem_info_file_needed
217 && $this->dav_helper->isDAVableObjType($this->repo_helper->getObjectTypeFromRefId($child_ref))
218 && $this->dav_helper->hasTitleForbiddenChars($this->repo_helper->getObjectTitleFromRefId($child_ref))) {
219 $problem_info_file_needed =
true;
223 if ($problem_info_file_needed) {
238 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
240 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
242 if ($this->repo_helper->getObjectTitleFromRefId($child_ref,
true) ==
$name) {
244 if ($this->repo_helper->checkAccess(
"read", $child_ref)) {
createDirectory($name)
Creates a new subdirectory.
getChildCollectionType()
Return the type for child collections of this collection For courses, groups and folders the type is ...
getChildren()
Returns an array with all the child nodes.
Class ilWebDAVRepositoryHelper.
childExists($name)
Checks if a child-node with the specified name exists.
Class ilWebDAVObjDAVHelper.
createFile($name, $data=null)
Creates a new file in the directory.
const PROBLEM_INFO_FILE_NAME
getChild($name)
Returns a specific child node, referenced by its name.
__construct(Container $dic, ilPlugin $plugin)
__construct(ilContainer $a_obj, ilWebDAVRepositoryHelper $repo_helper, ilWebDAVObjDAVHelper $dav_helper)
Check if given object has valid type and calls parent constructor.
static getLogger($a_component_id)
Get component logger.