62 if (is_object(
$obj)) {
84 return ($this->obj == null) ? null : $this->obj->getId();
106 $this->obj->setPermissions($this->
getRefId());
119 $ilias = $DIC[
'ilias'];
121 if (is_null($this->obj)) {
122 $this->obj =&$ilias->obj_factory->getInstanceByRefId($this->
getRefId());
132 $this->
writelog(
'write() refid=' . $this->refId);
133 $this->obj->update();
144 return $this->obj->getUntranslatedTitle();
154 return $this->obj->setTitle(
$name);
163 return $this->obj->getTitle();
173 return strtotime($this->obj->getCreateDate());
183 return strtotime($this->obj->getLastUpdateDate());
229 return 'application/x-non-readable';
315 if (isset(
$_GET[
'mount-instructions'])) {
322 $ops = explode(
',', $operations);
323 if (in_array(
'visible', $ops) && !in_array(
'write', $ops)) {
325 $operations .=
',write';
330 $rbacsystem = $DIC[
'rbacsystem'];
331 return $rbacsystem->checkAccess($operations, $this->
getRefId(),
$type);
333 $GLOBALS[
'DIC'][
'ilLog']->write(
'Checking permission for ref_id: ' . $this->
getRefId());
334 $GLOBALS[
'DIC'][
'ilLog']->write(
"Operations: " . print_r($operations,
true));
337 $ilAccess = $DIC[
'ilAccess'];
338 $operations = explode(
",", $operations .
"");
339 foreach ($operations as $operation) {
340 if (!$ilAccess->checkAccess($operation,
'', $this->getRefId(),
$type)) {
341 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Permission denied for user ' .
$GLOBALS[
'DIC'][
'ilUser']->getId());
354 if ($this->obj instanceof
ilObject) {
355 return $this->obj->getType();
357 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Invalid object given, class=' . get_class($this->obj));
358 $GLOBALS[
'DIC'][
'ilLog']->logStack();
393 $tree = $DIC[
'tree'];
396 require_once
'Modules/Folder/classes/class.ilObjFolder.php';
399 $newObj->setTitle(
$name);
402 $newObj->createReference();
403 $newObj->setPermissions($this->
getRefId());
404 $newObj->putInTree($this->
getRefId());
406 require_once
'class.ilObjFolderDAV.php';
418 $tree = $DIC[
'tree'];
421 require_once
'Modules/File/classes/class.ilObjFile.php';
424 $newObj->setTitle(
$name);
425 $newObj->setFileName(
$name);
426 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
429 $newObj->setFileType($mime);
432 $newObj->createReference();
433 $newObj->setPermissions($this->
getRefId());
434 $newObj->putInTree($this->
getRefId());
437 require_once
'class.ilObjFileDAV.php';
438 $objDAV =
new ilObjFileDAV($newObj->getRefId(), $newObj);
455 $tree = $DIC[
'tree'];
458 require_once
'Modules/File/classes/class.ilObjFile.php';
460 $objDAV->initFromNull();
473 $tree = $DIC[
'tree'];
476 require_once
'./Services/Object/classes/class.ilObject.php';
478 $newObj->setType(
'null');
479 $newObj->setTitle(
$name);
481 $newObj->createReference();
482 $newObj->setPermissions($this->
getRefId());
483 $newObj->putInTree($this->
getRefId());
485 require_once
'class.ilObjNullDAV.php';
486 $objDAV =
new ilObjNullDAV($newObj->getRefId(), $newObj);
498 public function remove($objDAV)
501 $tree = $DIC[
'tree'];
502 $rbacadmin = $DIC[
'rbacadmin'];
504 $subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
505 foreach ($subnodes as $node) {
506 $rbacadmin->revokePermission($node[
"child"]);
509 $tree->saveSubTree($objDAV->getRefId());
510 $tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
520 public function addCopy(&$objDAV, $newName = null)
522 $this->
writelog(
"addCopy($objDAV,$newName) ....");
524 $rbacadmin = $DIC[
'rbacadmin'];
525 $tree = $DIC[
'tree'];
526 $revIdMapping =
array();
527 $newRef = $this->
cloneNodes($objDAV->getRefId(), $this->
getRefId(), $revIdMapping, $newName);
529 return self::createObject($newRef, $objDAV->getILIASType());
530 $this->
writelog(
'... addCopy done.');
543 public function cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
545 $this->
writelog(
"cloneNodes($srcRef,$dstRef,$mapping,$newName)");
547 $tree = $DIC[
'tree'];
549 $ilias = $DIC[
'ilias'];
552 $srcObj =&$ilias->obj_factory->getInstanceByRefId($srcRef);
553 $this->
writelog(
'cloneNodes cloning srcRef=' . $srcRef .
' dstRef=' . $dstRef .
'...');
554 $newObj = $srcObj->cloneObject($dstRef);
555 $newRef = $newObj->getRefId();
560 $this->
writelog(
"cloneNodes newname not null? " . (!is_null($newName)));
561 if (!is_null($newName)) {
562 $newObjDAV = self::createObject($newRef, $srcObj->getType());
563 $newObjDAV->setResourceName($newName);
567 $mapping[$newRef] = $srcRef;
570 $children = $tree->getChilds($srcRef);
571 foreach ($tree->getChilds($srcRef) as $child) {
574 if ($child[
"type"] !=
'rolf') {
575 $this->
cloneNodes($child[
"ref_id"], $newRef, $mapping, null);
577 if (count($rolf = $tree->getChildsByType($newRef,
"rolf"))) {
578 $mapping[$rolf[0][
"ref_id"]] = $child[
"ref_id"];
582 $this->
writelog(
'cloneNodes ...cloned srcRef=' . $srcRef .
' dstRef=' . $dstRef .
' newRef=' . $newRef);
593 public function addMove(&$objDAV, $newName = null)
596 $tree = $DIC[
'tree'];
598 $rbacadmin = $DIC[
'rbacadmin'];
600 $ilias = $DIC[
'ilias'];
604 $this->
writelog(
'addMove(' . $objDAV->getRefId() .
' to ' . $this->
getRefId() .
', newName=' . $newName .
')');
607 if (!is_null($newName)) {
608 $objDAV->setResourceName($newName);
613 $old_parent = $tree->getParentId($objDAV->getRefId());
616 $tree->moveTree($objDAV->getRefId(), $this->
getRefId());
619 $rbacadmin->adjustMovedObjectPermissions($objDAV->getRefId(), $old_parent);
682 $ilDB = $DIC[
'ilDB'];
684 $ilias = $DIC[
'ilias'];
685 $tree = $DIC[
'tree'];
687 $query =
"SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
696 if (!in_array(
$row->tree, $a_checked)) {
698 $a_checked[] =
$row->tree;
701 $del_node_data = $deleted_tree->getNodeData(
$row->tree);
702 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
706 if ($a_delete_objects) {
707 foreach ($del_subtree_nodes as $node) {
708 $node_obj =&$ilias->obj_factory->getInstanceByRefId($node[
"ref_id"]);
719 $tree->deleteTree($del_node_data);
742 $tree = $DIC[
'tree'];
744 $childrenDAV =
array();
747 $childrenData =&$tree->getChilds($this->
getRefId(),
'');
748 foreach ($childrenData as
$data) {
749 $childDAV =&self::createObject($data[
'ref_id'], $data[
'type']);
750 if (!is_null($childDAV)) {
753 $childrenDAV[] = $childDAV;
771 $permittedChildrenDAV =
array();
772 foreach ($childrenDAV as $childDAV) {
773 if ($childDAV->isPermitted($operations,
$type)) {
774 $permittedChildrenDAV[] = $childDAV;
778 return $permittedChildrenDAV;
795 require_once
'class.ilObjMountPointDAV.php';
799 require_once
'class.ilObjRootDAV.php';
803 require_once
'class.ilObjCategoryDAV.php';
807 require_once
'class.ilObjFolderDAV.php';
811 require_once
'class.ilObjCourseDAV.php';
815 require_once
'class.ilObjGroupDAV.php';
819 require_once
'class.ilObjFileDAV.php';
823 require_once
'class.ilObjNullDAV.php';
829 if (!is_null($newObj)) {
842 if ($this->isDebug) {
845 $ilias = $DIC[
'ilias'];
847 $ilias->account->getLogin()
848 .
' DAV .' . get_class($this) .
' ' . str_replace(
"\n",
";",
$message)
866 return get_class($this) .
'#' . $this->
getObjectId();
getObjectId()
Returns the object id of this object.
children()
Returns the children of this object.
static createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
getContentStream()
Returns the content of the object as a stream.
__toString()
This method is needed, because the object class in PHP 5.2 does not have a default implementation of ...
write()
Writes the object data.
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
createNewVersion()
Creates a new version of the object.
__construct($refId, $obj=null)
Constructor.
getResourceType()
Returns the DAV resource type of this object.
childrenWithPermission($operations, $type='')
Returns the children of this object with the specified permissions.
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
createFileFromNull($name, &$nullDAV)
Creates a dav file as a child of this object.
isNullResource()
Returns true if this is a null resource.
getILIASFileType()
Returns the ilias type for files that can be created as children of this object.
createCollection($name)
Creates a dav collection as a child of this object.
getDisplayName()
Returns the display name of this object.
getContentType()
Returns the mime type of the content of this object.
setContentLength($length)
Sets the length (number of bytes) of the content of this object.
static getMimeType($a_file='', $a_filename='', $a_mime='')
catch(Exception $e) $message
foreach($_POST as $key=> $value) $res
getModificationTimestamp()
Returns the modification date of this object as a Unix timestamp.
getResourceName()
Returns the resource name of this object.
read()
Reads the object data.
getILIASCollectionType()
Returns the ilias type for collections that can be created as children of this object.
isFile()
Returns true if this object is a DAV file.
createNull($name)
Creates a dav null object as a child of this object.
isCollection()
Returns true if this object is a DAV collection.
addMove(&$objDAV, $newName=null)
Adds (moves) the specified object as a child to this object.
getContentLength()
Returns the number of bytes of the content.
setContentType($type)
Sets the mime type of the content of this object.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects=true)
remove already deleted objects within the objects in trash recursive function
isPermitted($operations, $type='')
Returns whether a specific operation is permitted for the current user.
getContentOutputStream()
Returns an output stream to the content.
$refId
Refid to the object.
setResourceName($name)
Sets the resource name of this object.
initFromNull()
Initializes the object after it has been converted from NULL.
$isDebug
The ObjectDAV prints lots of log messages to the ilias log, if this variable is set to true...
getNodeId()
Returns the node id of this object.
getContentOutputStreamLength()
Returns the length of the content output stream.
isOnline()
Returns true if the object is online.
getCreationTimestamp()
Returns the creation date of this object as a Unix timestamp.
getILIASType()
Returns the ilias type of the current object.
getContentData()
Returns the content of the object as a byte array.
writelog($message)
Writes a message to the logfile.,.
$obj
Application layer object.
addCopy(&$objDAV, $newName=null)
Adds a copy of the specified object as a child to this object.
getRefId()
Returns the ref id of this object.