64 $this->
writelog(
'<constructor>('.$refId.
','.get_class(
$obj).
')');
85 return ($this->obj ==
null) ? null : $this->obj->getId();
107 $this->obj->setPermissions($this->
getRefId());
120 $ilias =
$DIC[
'ilias'];
122 if (is_null($this->obj))
124 $this->obj =& $ilias->obj_factory->getInstanceByRefId($this->
getRefId());
134 $this->
writelog(
'write() refid='.$this->refId);
135 $this->obj->update();
146 return $this->obj->getUntranslatedTitle();
155 $this->
writelog(
'setResourceName('.$name.
')');
156 return $this->obj->setTitle($name);
165 return $this->obj->getTitle();
175 return strtotime($this->obj->getCreateDate());
185 return strtotime($this->obj->getLastUpdateDate());
231 return 'application/x-non-readable';
317 if(isset(
$_GET[
'mount-instructions']))
326 $ops = explode(
',',$operations);
327 if (in_array(
'visible',$ops) && ! in_array(
'write',$ops))
330 $operations .=
',write';
335 $rbacsystem =
$DIC[
'rbacsystem'];
336 return $rbacsystem->checkAccess($operations, $this->
getRefId(), $type);
340 $GLOBALS[
'DIC'][
'ilLog']->write(
'Checking permission for ref_id: '.$this->
getRefId());
341 $GLOBALS[
'DIC'][
'ilLog']->write(
"Operations: ".print_r($operations,
true));
344 $ilAccess =
$DIC[
'ilAccess'];
345 $operations = explode(
",",$operations.
"");
346 foreach ($operations as $operation)
348 if (!$ilAccess->checkAccess($operation,
'', $this->getRefId(), $type))
350 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__.
': Permission denied for user '.
$GLOBALS[
'DIC'][
'ilUser']->getId());
365 return $this->obj->getType();
367 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__.
': Invalid object given, class='.get_class($this->obj));
368 $GLOBALS[
'DIC'][
'ilLog']->logStack();
402 $tree =
$DIC[
'tree'];
405 require_once
'Modules/Folder/classes/class.ilObjFolder.php';
408 $newObj->setTitle($name);
411 $newObj->createReference();
412 $newObj->setPermissions($this->
getRefId());
413 $newObj->putInTree($this->
getRefId());
415 require_once
'class.ilObjFolderDAV.php';
427 $tree =
$DIC[
'tree'];
430 require_once
'Modules/File/classes/class.ilObjFile.php';
433 $newObj->setTitle($name);
434 $newObj->setFileName($name);
435 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
438 $newObj->setFileType($mime);
441 $newObj->createReference();
442 $newObj->setPermissions($this->
getRefId());
443 $newObj->putInTree($this->
getRefId());
446 require_once
'class.ilObjFileDAV.php';
447 $objDAV =
new ilObjFileDAV($newObj->getRefId(), $newObj);
464 $tree =
$DIC[
'tree'];
467 require_once
'Modules/File/classes/class.ilObjFile.php';
469 $objDAV->initFromNull();
482 $tree =
$DIC[
'tree'];
485 require_once
'./Services/Object/classes/class.ilObject.php';
487 $newObj->setType(
'null');
488 $newObj->setTitle($name);
490 $newObj->createReference();
491 $newObj->setPermissions($this->
getRefId());
492 $newObj->putInTree($this->
getRefId());
494 require_once
'class.ilObjNullDAV.php';
495 $objDAV =
new ilObjNullDAV($newObj->getRefId(), $newObj);
507 function remove($objDAV)
510 $tree =
$DIC[
'tree'];
511 $rbacadmin =
$DIC[
'rbacadmin'];
513 $subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
514 foreach ($subnodes as $node)
516 $rbacadmin->revokePermission($node[
"child"]);
519 $tree->saveSubTree($objDAV->getRefId());
520 $tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
532 $this->
writelog(
"addCopy($objDAV,$newName) ....");
534 $rbacadmin =
$DIC[
'rbacadmin'];
535 $tree =
$DIC[
'tree'];
536 $revIdMapping = array();
537 $newRef = $this->
cloneNodes($objDAV->getRefId(),$this->getRefId(),$revIdMapping, $newName);
540 $this->
writelog(
'... addCopy done.');
553 function cloneNodes($srcRef,$dstRef,&$mapping, $newName=
null)
555 $this->
writelog(
"cloneNodes($srcRef,$dstRef,$mapping,$newName)");
557 $tree =
$DIC[
'tree'];
559 $ilias =
$DIC[
'ilias'];
562 $srcObj =& $ilias->obj_factory->getInstanceByRefId($srcRef);
563 $this->
writelog(
'cloneNodes cloning srcRef='.$srcRef.
' dstRef='.$dstRef.
'...');
564 $newObj = $srcObj->cloneObject($dstRef);
565 $newRef = $newObj->getRefId();
570 $this->
writelog(
"cloneNodes newname not null? ".(! is_null($newName)));
571 if (! is_null($newName))
574 $newObjDAV->setResourceName($newName);
578 $mapping[$newRef] = $srcRef;
581 $children = $tree->getChilds($srcRef);
582 foreach ($tree->getChilds($srcRef) as $child)
586 if ($child[
"type"] !=
'rolf')
588 $this->
cloneNodes($child[
"ref_id"],$newRef,$mapping,
null);
592 if (count($rolf = $tree->getChildsByType($newRef,
"rolf")))
594 $mapping[$rolf[0][
"ref_id"]] = $child[
"ref_id"];
598 $this->
writelog(
'cloneNodes ...cloned srcRef='.$srcRef.
' dstRef='.$dstRef.
' newRef='.$newRef);
612 $tree =
$DIC[
'tree'];
614 $rbacadmin =
$DIC[
'rbacadmin'];
616 $ilias =
$DIC[
'ilias'];
620 $this->
writelog(
'addMove('.$objDAV->getRefId().
' to '.$this->getRefId().
', newName='.$newName.
')');
623 if (! is_null($newName))
625 $objDAV->setResourceName($newName);
630 $old_parent = $tree->getParentId($objDAV->getRefId());
633 $tree->moveTree($objDAV->getRefId(),$this->getRefId());
636 $rbacadmin->adjustMovedObjectPermissions($objDAV->getRefId(), $old_parent);
701 $ilias =
$DIC[
'ilias'];
702 $tree =
$DIC[
'tree'];
704 $query =
"SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
705 $sta =
$ilDB->prepare(
$query,array(
'integer',
'integer'));
714 if (!in_array(
$row->tree,$a_checked))
717 $a_checked[] =
$row->tree;
720 $del_node_data = $deleted_tree->getNodeData(
$row->tree);
721 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
725 if ($a_delete_objects)
727 foreach ($del_subtree_nodes as $node)
729 $node_obj =& $ilias->obj_factory->getInstanceByRefId($node[
"ref_id"]);
740 $tree->deleteTree($del_node_data);
763 $tree =
$DIC[
'tree'];
765 $childrenDAV = array();
768 $childrenData =& $tree->getChilds($this->
getRefId(),
'');
769 foreach ($childrenData as
$data)
772 if (! is_null($childDAV))
776 $childrenDAV[] = $childDAV;
795 $permittedChildrenDAV = array();
796 foreach ($childrenDAV as $childDAV)
798 if ($childDAV->isPermitted($operations, $type))
800 $permittedChildrenDAV[] = $childDAV;
805 return $permittedChildrenDAV;
823 require_once
'class.ilObjMountPointDAV.php';
827 require_once
'class.ilObjRootDAV.php';
831 require_once
'class.ilObjCategoryDAV.php';
835 require_once
'class.ilObjFolderDAV.php';
839 require_once
'class.ilObjCourseDAV.php';
843 require_once
'class.ilObjGroupDAV.php';
847 require_once
'class.ilObjFileDAV.php';
851 require_once
'class.ilObjNullDAV.php';
857 if (! is_null($newObj))
875 $ilias =
$DIC[
'ilias'];
877 $ilias->account->getLogin()
878 .
' DAV .'.get_class($this).
' '.str_replace(
"\n",
";",$message)
An exception for terminatinating execution or to throw for unit testing.
static getMimeType($a_file='', $a_filename='', $a_mime='')
$refId
Refid to the object.
$isDebug
The ObjectDAV prints lots of log messages to the ilias log, if this variable is set to true.
getResourceType()
Returns the DAV resource type of this object.
getContentLength()
Returns the number of bytes of the content.
setContentLength($length)
Sets the length (number of bytes) of the content of this object.
createNull($name)
Creates a dav null object as a child of this object.
getContentType()
Returns the mime type of the content of this object.
setResourceName($name)
Sets the resource name of this object.
getContentOutputStreamLength()
Returns the length of the content output stream.
getContentData()
Returns the content of the object as a byte array.
getILIASFileType()
Returns the ilias type for files that can be created as children of this object.
$obj
Application layer object.
addMove(&$objDAV, $newName=null)
Adds (moves) the specified object as a child to this object.
__construct($refId, $obj=null)
Constructor.
getDisplayName()
Returns the display name of this object.
createFileFromNull($name, &$nullDAV)
Creates a dav file as a child of this object.
createFile($name)
Creates a dav file as a child of this object.
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
getObjectId()
Returns the object id of this object.
getCreationTimestamp()
Returns the creation date of this object as a Unix timestamp.
getContentStream()
Returns the content of the object as a stream.
removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects=true)
remove already deleted objects within the objects in trash recursive function
__toString()
This method is needed, because the object class in PHP 5.2 does not have a default implementation of ...
createNewVersion()
Creates a new version of the object.
createCollection($name)
Creates a dav collection as a child of this object.
getContentOutputStream()
Returns an output stream to the content.
initFromNull()
Initializes the object after it has been converted from NULL.
isOnline()
Returns true if the object is online.
writelog($message)
Writes a message to the logfile.,.
isFile()
Returns true if this object is a DAV file.
isCollection()
Returns true if this object is a DAV collection.
getILIASCollectionType()
Returns the ilias type for collections that can be created as children of this object.
write()
Writes the object data.
isPermitted($operations, $type='')
Returns whether a specific operation is permitted for the current user.
getRefId()
Returns the ref id of this object.
setContentType($type)
Sets the mime type of the content of this object.
getResourceName()
Returns the resource name of this object.
addCopy(&$objDAV, $newName=null)
Adds a copy of the specified object as a child to this object.
isNullResource()
Returns true if this is a null resource.
getNodeId()
Returns the node id of this object.
static createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
getILIASType()
Returns the ilias type of the current object.
read()
Reads the object data.
childrenWithPermission($operations, $type='')
Returns the children of this object with the specified permissions.
getModificationTimestamp()
Returns the modification date of this object as a Unix timestamp.
Class ilObject Basic functions for all objects.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static removeItemFromDesktops($a_id)
removes object from all user's desktops @access public
$GLOBALS['loaded']
Global hash that tracks already loaded includes.