ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectDAV Class Reference
+ Inheritance diagram for ilObjectDAV:
+ Collaboration diagram for ilObjectDAV:

Public Member Functions

 ilObjectDAV ($refId, $obj=null)
 Constructor.
 getRefId ()
 Returns the ref id of this object.
 getObjectId ()
 Returns the object id of this object.
 getNodeId ()
 Returns the node id of this object.
 initFromNull ()
 Initializes the object after it has been converted from NULL.
 read ()
 Reads the object data.
 write ()
 Writes the object data.
 getResourceName ()
 Returns the resource name of this object.
 setResourceName ($name)
 Sets the resource name of this object.
 getDisplayName ()
 Returns the display name of this object.
 getCreationTimestamp ()
 Returns the creation date of this object as a Unix timestamp.
 getModificationTimestamp ()
 Returns the modification date of this object as a Unix timestamp.
 getResourceType ()
 Returns the DAV resource type of this object.
 isCollection ()
 Returns true if this object is a DAV collection.
 isFile ()
 Returns true if this object is a DAV file.
 isNullResource ()
 Returns true if this is a null resource.
 getContentType ()
 Returns the mime type of the content of this object.
 setContentType ($type)
 Sets the mime type of the content of this object.
 setContentLength ($length)
 Sets the length (number of bytes) of the content of this object.
 getContentLength ()
 Returns the number of bytes of the content.
 getContentStream ()
 Returns the content of the object as a stream.
 getContentOutputStream ()
 Returns an output stream to the content.
 getContentOutputStreamLength ()
 Returns the length of the content output stream.
 getContentData ()
 Returns the content of the object as a byte array.
 isOnline ()
 Returns true if the object is online.
 isPermitted ($operations, $type= '')
 Returns whether a specific operation is permitted for the current user.
 getILIASType ()
 Returns the ilias type of the current object.
 getILIASCollectionType ()
 Returns the ilias type for collections that can be created as children of this object.
 getILIASFileType ()
 Returns the ilias type for files that can be created as children of this object.
 createNewVersion ()
 Creates a new version of the object.
 createCollection ($name)
 Creates a dav collection as a child of this object.
 createFile ($name)
 Creates a dav file as a child of this object.
 createFileFromNull ($name, &$nullDAV)
 Creates a dav file as a child of this object.
 createNull ($name)
 Creates a dav null object as a child of this object.
 remove ($objDAV)
 Removes the specified child from this object.
 addCopy (&$objDAV, $newName=null)
 Adds a copy of the specified object as a child to this object.
 cloneNodes ($srcRef, $dstRef, &$mapping, $newName=null)
 Recursively clones all nodes of the RBAC tree.
 addMove (&$objDAV, $newName=null)
 Adds (moves) the specified object as a child to this object.
 removeDeletedNodes ($a_node_id, $a_checked, $a_delete_objects=true)
 remove already deleted objects within the objects in trash recursive function
 children ()
 Returns the children of this object.
 childrenWithPermission ($operations, $type='')
 Returns the children of this object with the specified permissions.
 createObject ($refId, $type)
 Static factory method to create a DAV object for a given refId and type.
 writelog ($message)
 Writes a message to the logfile.,.
 __toString ()
 This method is needed, because the object class in PHP 5.2 does not have a default implementation of this method anymore.

Data Fields

 $refId
 Refid to the object.
 $obj
 Application layer object.
 $isDebug = false
 The ObjectDAV prints lots of log messages to the ilias log, if this variable is set to true.

Detailed Description

Definition at line 36 of file class.ilObjectDAV.php.

Member Function Documentation

ilObjectDAV::__toString ( )

This method is needed, because the object class in PHP 5.2 does not have a default implementation of this method anymore.

Definition at line 868 of file class.ilObjectDAV.php.

References getObjectId().

{
return get_class($this).'#'.$this->getObjectId();
}

+ Here is the call graph for this function:

ilObjectDAV::addCopy ( $objDAV,
  $newName = null 
)

Adds a copy of the specified object as a child to this object.

Parameters
ilObjectDAVthe object to be copied.
stringthe new name of the copy (optional).
Returns
A new ilObjectDAV object representing the cloned object.

Definition at line 520 of file class.ilObjectDAV.php.

References cloneNodes(), createObject(), getRefId(), and writelog().

{
$this->writelog("addCopy($objDAV,$newName) ....");
global $rbacadmin, $tree;
$revIdMapping = array();
$newRef = $this->cloneNodes($objDAV->getRefId(),$this->getRefId(),$revIdMapping, $newName);
//$rbacadmin->adjustMovedObjectPermissions($newRef, $tree->getParentId($objDAV->getRefId()));
return $this->createObject($newRef, $objDAV->getILIASType());
$this->writelog('... addCopy done.');
}

+ Here is the call graph for this function:

ilObjectDAV::addMove ( $objDAV,
  $newName = null 
)

Adds (moves) the specified object as a child to this object.

The object is removed from its former parent.

Parameters
ilObjectDAVthe object to be moved.
stringthe new name (optional).

Definition at line 595 of file class.ilObjectDAV.php.

References $log, getRefId(), and writelog().

{
global $tree;
global $rbacadmin;
global $ilias;
global $log;
$this->writelog('addMove('.$objDAV->getRefId().' to '.$this->getRefId().', newName='.$newName.')');
// Step 0:Assign new name to moved object
if (! is_null($newName))
{
$objDAV->setResourceName($newName);
$objDAV->write();
}
// Step 1: Store old parent
$old_parent = $tree->getParentId($objDAV->getRefId());
// Step 2: Move the tree
$tree->moveTree($objDAV->getRefId(),$this->getRefId());
// Step 3: Repair permissions
$rbacadmin->adjustMovedObjectPermissions($objDAV->getRefId(), $old_parent);
/*
// STEP 1: Move subtree to trash
$this->writelog('addMove('.$objDAV->getRefId().' to '.$this->getRefId().') step 1: move subtree to trash');
$subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
foreach ($subnodes as $node)
{
$rbacadmin->revokePermission($node["child"]);
$affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
}
$tree->saveSubTree($objDAV->getRefId());
$tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
// STEP 2: Move subtree to new location
// TODO: this whole put in place again stuff needs revision. Permission settings get lost.
$this->writelog('addMove() step 2: move subtree to new location');
// put top node to dest
$rbacadmin->revokePermission($subnodes[0]['child']);
$obj_data =& $ilias->obj_factory->getInstanceByRefId($subnodes[0]['child']);
$obj_data->putInTree($this->getRefId());
$obj_data->setPermissions($this->getRefId());
array_shift($subnodes);
// put all sub nodes to their parent (of which we have moved top already to dest).
foreach ($subnodes as $node)
{
$rbacadmin->revokePermission($node['child']);
$obj_data =& $ilias->obj_factory->getInstanceByRefId($node['child']);
$obj_data->putInTree($node['parent']);
$obj_data->setPermissions($node['parent']);
}
// STEP 3: Remove trashed objects from system
$this->writelog('addMove('.$objDAV->getRefID().') step 3: remove trashed objects from system');
require_once 'Services/Tree/classes/class.ilTree.php';
$trashTree = new ilTree(- (int) $objDAV->getRefId());
$node = $trashTree->getNodeData($objDAV->getRefId());
$subnodes = $trashTree->getSubTree($node);
// remember already checked deleted node_ids
$checked[] = -(int) $objDAV->getRefId();
// dive in recursive manner in each already deleted subtrees and remove these objects too
$this->removeDeletedNodes($objDAV->getRefId(), $checked, false);
// delete trash tree
$tree->deleteTree($node);
$this->writelog('addMove('.$objDAV->getRefID().') all 3 steps done');
*/
}

+ Here is the call graph for this function:

ilObjectDAV::children ( )

Returns the children of this object.

Returns
Array<ilObjectDAV>. Returns an empty array, if this object is not a collection..

Reimplemented in ilObjMountPointDAV.

Definition at line 733 of file class.ilObjectDAV.php.

References $data, createObject(), and getRefId().

Referenced by childrenWithPermission().

{
// FIXME: Remove duplicate entries from this list, because of RFC2518, chapter 5.2
// If a duplicate is found, the older object must win. We use the object
// id to determine this. This is based on the assumption, that new objects
// have higher object id's then older objects.
global $tree;
$childrenDAV = array();
// Performance optimization. We sort the children using PHP instead of using the database.
//$childrenData =& $tree->getChilds($this->getRefId(),'title');
$childrenData =& $tree->getChilds($this->getRefId(),'');
foreach ($childrenData as $data)
{
$childDAV =& $this->createObject($data['ref_id'],$data['type']);
if (! is_null($childDAV))
{
// Note: We must not assign with =& here, because this will cause trouble
// when other functions attempt to work with the $childrenDAV array.
$childrenDAV[] = $childDAV;
}
}
return $childrenDAV;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectDAV::childrenWithPermission (   $operations,
  $type = '' 
)

Returns the children of this object with the specified permissions.

Parameters
stringone or more operations, separated by commas (i.e.: visible,read,join)
stringthe ILIAS type definition abbreviation (i.e.: frm,grp,crs) (only needed for 'create' operation'.
Returns
Array<ilObjectDAV>. Returns an empty array, if this object is not a collection..

Definition at line 768 of file class.ilObjectDAV.php.

References children().

{
//$this->writelog('@'.$this->getRefId().'.childrenWithPermission('.$operations.','.$type.')');
$childrenDAV = $this->children();
$permittedChildrenDAV = array();
foreach ($childrenDAV as $childDAV)
{
if ($childDAV->isPermitted($operations, $type))
{
$permittedChildrenDAV[] = $childDAV;
}
}
//$this->writelog('@'.$this->getRefId().'.childrenWithPermission():'.count($permittedChildrenDAV).' children');
return $permittedChildrenDAV;
}

+ Here is the call graph for this function:

ilObjectDAV::cloneNodes (   $srcRef,
  $dstRef,
$mapping,
  $newName = null 
)

Recursively clones all nodes of the RBAC tree.

private

Parameters
integerref_id of source object
integerref_id of destination object
arraymapping new_ref_id => old_ref_id
stringthe new name of the copy (optional).
Returns
The ref_id pointing to the cloned object.

Definition at line 541 of file class.ilObjectDAV.php.

References createObject(), and writelog().

Referenced by addCopy().

{
$this->writelog("cloneNodes($srcRef,$dstRef,$mapping,$newName)");
global $tree;
global $ilias;
// clone the source node
$srcObj =& $ilias->obj_factory->getInstanceByRefId($srcRef);
$this->writelog('cloneNodes cloning srcRef='.$srcRef.' dstRef='.$dstRef.'...');
$newObj = $srcObj->cloneObject($dstRef);
$newRef = $newObj->getRefId();
// We must immediately apply a new name to the object, to
// prevent confusion of WebDAV clients about having two objects with identical
// name in the repository.
$this->writelog("cloneNodes newname not null? ".(! is_null($newName)));
if (! is_null($newName))
{
$newObjDAV = $this->createObject($newRef, $srcObj->getType());
$newObjDAV->setResourceName($newName);
$newObjDAV->write();
}
unset($srcObj);
$mapping[$newRef] = $srcRef;
// clone all children of the source node
$children = $tree->getChilds($srcRef);
foreach ($tree->getChilds($srcRef) as $child)
{
// Don't clone role folders, because it does not make sense to clone local roles
// FIXME - Maybe it does make sense (?)
if ($child["type"] != 'rolf')
{
$this->cloneNodes($child["ref_id"],$newRef,$mapping,null);
}
else
{
if (count($rolf = $tree->getChildsByType($newRef,"rolf")))
{
$mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
}
}
}
$this->writelog('cloneNodes ...cloned srcRef='.$srcRef.' dstRef='.$dstRef.' newRef='.$newRef);
return $newRef;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectDAV::createCollection (   $name)

Creates a dav collection as a child of this object.

Parameters
stringthe name of the collection.
Returns
ilObjectDAV returns the created collection, or null if creation failed.

Reimplemented in ilObjCategoryDAV.

Definition at line 395 of file class.ilObjectDAV.php.

References getILIASCollectionType(), and getRefId().

{
global $tree;
// create and insert Folder in tree
require_once 'Modules/Folder/classes/class.ilObjFolder.php';
$newObj = new ilObjFolder(0);
$newObj->setType($this->getILIASCollectionType());
$newObj->setTitle($name);
//$newObj->setDescription('');
$newObj->create();
$newObj->createReference();
$newObj->setPermissions($this->getRefId());
$newObj->putInTree($this->getRefId());
require_once 'class.ilObjFolderDAV.php';
return new ilObjFolderDAV($newObj->getRefId(), $newObj);
}

+ Here is the call graph for this function:

ilObjectDAV::createFile (   $name)

Creates a dav file as a child of this object.

Parameters
stringthe name of the file.
Returns
ilObjectDAV returns the created object, or null if creation failed.

Definition at line 419 of file class.ilObjectDAV.php.

References getILIASFileType(), ilMimeTypeUtil\getMimeType(), and getRefId().

{
global $tree;
// create and insert Folder in tree
require_once 'Modules/File/classes/class.ilObjFile.php';
$newObj = new ilObjFile(0);
$newObj->setType($this->getILIASFileType());
$newObj->setTitle($name);
$newObj->setFileName($name);
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
$mime = ilMimeTypeUtil::getMimeType("", $name, 'application/octet-stream');
//$newObj->setFileType('application/octet-stream');
$newObj->setFileType($mime);
//$newObj->setDescription('');
$newObj->create();
$newObj->createReference();
$newObj->setPermissions($this->getRefId());
$newObj->putInTree($this->getRefId());
//$newObj->createDirectory();
require_once 'class.ilObjFileDAV.php';
$objDAV = new ilObjFileDAV($newObj->getRefId(), $newObj);
/*
$fs = $objDAV->getContentOutputStream();
fwrite($fs,' ');
fclose($fs);
*/
return $objDAV;
}

+ Here is the call graph for this function:

ilObjectDAV::createFileFromNull (   $name,
$nullDAV 
)

Creates a dav file as a child of this object.

Parameters
stringthe name of the file.
Returns
ilObjectDAV returns the created object, or null if creation failed.

Definition at line 455 of file class.ilObjectDAV.php.

References getILIASFileType(), and getRefId().

{
global $tree;
// create and insert Folder in tree
require_once 'Modules/File/classes/class.ilObjFile.php';
$objDAV =& $nullDAV->convertToILIASType($this->getRefId(), $this->getILIASFileType());
$objDAV->initFromNull();
return $objDAV;
}

+ Here is the call graph for this function:

ilObjectDAV::createNewVersion ( )

Creates a new version of the object.

Only objects which support versioning need to implement this method.

Reimplemented in ilObjFileDAV.

Definition at line 385 of file class.ilObjectDAV.php.

{
}
ilObjectDAV::createNull (   $name)

Creates a dav null object as a child of this object.

null objects are used for locking names.

Parameters
stringthe name of the null object.
Returns
ilObjectDAV returns the created object, or null if creation failed.

Definition at line 472 of file class.ilObjectDAV.php.

References getRefId().

{
global $tree;
// create and insert Folder in tree
require_once 'classes/class.ilObject.php';
$newObj = new ilObject(0);
$newObj->setType('null');
$newObj->setTitle($name);
$newObj->create();
$newObj->createReference();
$newObj->setPermissions($this->getRefId());
$newObj->putInTree($this->getRefId());
require_once 'class.ilObjNullDAV.php';
$objDAV = new ilObjNullDAV($newObj->getRefId(), $newObj);
return $objDAV;
}

+ Here is the call graph for this function:

ilObjectDAV::createObject (   $refId,
  $type 
)

Static factory method to create a DAV object for a given refId and type.

Parameters
intrefID.
Stringtype The ILIAS object type.
Returns
ilObjectDAV. Returns null, if no DAV object can be constructed for the specified type.

Definition at line 793 of file class.ilObjectDAV.php.

References $refId.

Referenced by addCopy(), ilObjMountPointDAV\children(), children(), cloneNodes(), ilObjNullDAV\convertToILIASType(), ilDAVServer\getObject(), and ilDAVServer\toObjectPath().

{
$newObj = null;
switch ($type)
{
case 'mountPoint' :
require_once 'class.ilObjMountPointDAV.php';
$newObj = new ilObjMountPointDAV($refId,null);
break;
case 'root' :
require_once 'class.ilObjRootDAV.php';
$newObj = new ilObjRootDAV($refId,null);
break;
case 'cat' :
require_once 'class.ilObjCategoryDAV.php';
$newObj = new ilObjCategoryDAV($refId,null);
break;
case 'fold' :
require_once 'class.ilObjFolderDAV.php';
$newObj = new ilObjFolderDAV($refId,null);
break;
case 'crs' :
require_once 'class.ilObjCourseDAV.php';
$newObj = new ilObjCourseDAV($refId,null);
break;
case 'grp' :
require_once 'class.ilObjGroupDAV.php';
$newObj = new ilObjGroupDAV($refId,null);
break;
case 'file' :
require_once 'class.ilObjFileDAV.php';
$newObj = new ilObjFileDAV($refId,null);
break;
case 'null' :
require_once 'class.ilObjNullDAV.php';
$newObj = new ilObjNullDAV($refId,null);
break;
default :
break;
}
if (! is_null($newObj))
{
$newObj->read();
}
return $newObj;
}

+ Here is the caller graph for this function:

ilObjectDAV::getContentData ( )

Returns the content of the object as a byte array.

Returns
Array, String. Return null if the content can not be delivered as data.

Reimplemented in ilObjFileDAV.

Definition at line 289 of file class.ilObjectDAV.php.

{
return null;
}
ilObjectDAV::getContentLength ( )

Returns the number of bytes of the content.

Returns
int.

Reimplemented in ilObjMountPointDAV, ilObjFileDAV, ilObjRootDAV, ilObjCategoryDAV, ilObjCourseDAV, ilObjFolderDAV, and ilObjGroupDAV.

Definition at line 251 of file class.ilObjectDAV.php.

{
return 0;
}
ilObjectDAV::getContentOutputStream ( )

Returns an output stream to the content.

Returns
Stream or null, if the content does not support streaming.

Reimplemented in ilObjFileDAV.

Definition at line 267 of file class.ilObjectDAV.php.

{
return null;
}
ilObjectDAV::getContentOutputStreamLength ( )

Returns the length of the content output stream.

This method is used by the ilDAVServer, if a PUT operation has been performed for which the client did not specify the content length.

Parameters
Integer.

Reimplemented in ilObjFileDAV.

Definition at line 280 of file class.ilObjectDAV.php.

{
// subclass responsibility
}
ilObjectDAV::getContentStream ( )

Returns the content of the object as a stream.

Returns
Stream or null, if the content does not support streaming.

Reimplemented in ilObjFileDAV.

Definition at line 259 of file class.ilObjectDAV.php.

{
return null;
}
ilObjectDAV::getContentType ( )

Returns the mime type of the content of this object.

Returns
String.

Reimplemented in ilObjMountPointDAV, ilObjNullDAV, ilObjRootDAV, ilObjFileDAV, ilObjCategoryDAV, ilObjCourseDAV, ilObjFolderDAV, and ilObjGroupDAV.

Definition at line 227 of file class.ilObjectDAV.php.

{
return 'application/x-non-readable';//'application/octet-stream';
}
ilObjectDAV::getCreationTimestamp ( )

Returns the creation date of this object as a Unix timestamp.

Precondition: Object must have been read.

Returns
int.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

Definition at line 171 of file class.ilObjectDAV.php.

{
return strtotime($this->obj->getCreateDate());
}
ilObjectDAV::getDisplayName ( )

Returns the display name of this object.

Precondition: Object must have been read.

Returns
String.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

Definition at line 161 of file class.ilObjectDAV.php.

{
return $this->obj->getTitle();
}
ilObjectDAV::getILIASCollectionType ( )

Returns the ilias type for collections that can be created as children of this object.

Reimplemented in ilObjRootDAV, and ilObjCategoryDAV.

Definition at line 369 of file class.ilObjectDAV.php.

Referenced by createCollection().

{
return 'fold';
}

+ Here is the caller graph for this function:

ilObjectDAV::getILIASFileType ( )

Returns the ilias type for files that can be created as children of this object.

Definition at line 376 of file class.ilObjectDAV.php.

Referenced by createFile(), and createFileFromNull().

{
return 'file';
}

+ Here is the caller graph for this function:

ilObjectDAV::getILIASType ( )

Returns the ilias type of the current object.

Definition at line 357 of file class.ilObjectDAV.php.

References $GLOBALS.

{
if($this->obj instanceof ilObject)
{
return $this->obj->getType();
}
$GLOBALS['ilLog']->write(__METHOD__.': Invalid object given, class='.get_class($this->obj));
$GLOBALS['ilLog']->logStack();
}
ilObjectDAV::getModificationTimestamp ( )

Returns the modification date of this object as a Unix timestamp.

Precondition: Object must have been read.

Returns
int.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

Definition at line 181 of file class.ilObjectDAV.php.

{
return strtotime($this->obj->getLastUpdateDate());
}
ilObjectDAV::getNodeId ( )

Returns the node id of this object.

This only used by objects that are represented as a single object in RBAC, but as multiple objects in WebDAV.

Returns
int.

Definition at line 93 of file class.ilObjectDAV.php.

{
return 0;
}
ilObjectDAV::getObjectId ( )

Returns the object id of this object.

Returns
int.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

Definition at line 82 of file class.ilObjectDAV.php.

Referenced by __toString().

{
return ($this->obj == null) ? null : $this->obj->getId();
}

+ Here is the caller graph for this function:

ilObjectDAV::getResourceName ( )

Returns the resource name of this object.

Precondition: Object must have been read.

Returns
String.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

Definition at line 142 of file class.ilObjectDAV.php.

Referenced by ilObjFileDAV\initFromNull().

{
return $this->obj->getUntranslatedTitle();
}

+ Here is the caller graph for this function:

ilObjectDAV::getResourceType ( )

Returns the DAV resource type of this object.

Returns
String "collection", "" (file) or "null".

Reimplemented in ilObjMountPointDAV, ilObjNullDAV, ilObjRootDAV, ilObjFileDAV, ilObjCategoryDAV, ilObjCourseDAV, ilObjFolderDAV, and ilObjGroupDAV.

Definition at line 191 of file class.ilObjectDAV.php.

Referenced by isCollection(), isFile(), and isNullResource().

{
return "";
}

+ Here is the caller graph for this function:

ilObjectDAV::ilObjectDAV (   $refId,
  $obj = null 
)

Constructor.

Parameters
intA refId to the object.

Definition at line 59 of file class.ilObjectDAV.php.

References $obj, $refId, and writelog().

Referenced by ilObjCategoryDAV\ilObjCategoryDAV(), ilObjCourseDAV\ilObjCourseDAV(), ilObjFileDAV\ilObjFileDAV(), ilObjFolderDAV\ilObjFolderDAV(), ilObjGroupDAV\ilObjGroupDAV(), ilObjMountPointDAV\ilObjMountPointDAV(), ilObjNullDAV\ilObjNullDAV(), and ilObjRootDAV\ilObjRootDAV().

{
if (is_object($obj))
{
$this->writelog('<constructor>('.$refId.','.get_class($obj).')');
}
$this->refId = $refId;
$this->obj =& $obj;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectDAV::initFromNull ( )

Initializes the object after it has been converted from NULL.

We create all the additonal object data that is needed, to make the object work.

Returns
void.

Reimplemented in ilObjFileDAV.

Definition at line 104 of file class.ilObjectDAV.php.

References getRefId().

{
$this->obj->setPermissions($this->getRefId());
}

+ Here is the call graph for this function:

ilObjectDAV::isCollection ( )

Returns true if this object is a DAV collection.

Returns
bool.

Definition at line 201 of file class.ilObjectDAV.php.

References getResourceType().

{
return $this->getResourceType() == 'collection';
}

+ Here is the call graph for this function:

ilObjectDAV::isFile ( )

Returns true if this object is a DAV file.

Returns
bool.

Definition at line 210 of file class.ilObjectDAV.php.

References getResourceType().

{
return $this->getResourceType() == '';
}

+ Here is the call graph for this function:

ilObjectDAV::isNullResource ( )

Returns true if this is a null resource.

Null objects are used for locking names.

Definition at line 218 of file class.ilObjectDAV.php.

References getResourceType().

{
return $this->getResourceType() == 'null';
}

+ Here is the call graph for this function:

ilObjectDAV::isOnline ( )

Returns true if the object is online.

Reimplemented in ilObjCourseDAV.

Definition at line 297 of file class.ilObjectDAV.php.

Referenced by isPermitted().

{
return true;
}

+ Here is the caller graph for this function:

ilObjectDAV::isPermitted (   $operations,
  $type = '' 
)

Returns whether a specific operation is permitted for the current user.

This method takes all conditions into account that are required to perform the specified action on behalf of the current user.

Parameters
stringone or more operations, separated by commas (i.e.: visible,read,join)
stringthe ILIAS type definition abbreviation (i.e.: frm,grp,crs) (only needed for 'create' operation'.
Returns
boolean returns true if ALL passed operations are given, otherwise false

Reimplemented in ilObjMountPointDAV.

Definition at line 312 of file class.ilObjectDAV.php.

References $_GET, $GLOBALS, getRefId(), and isOnline().

{
// Mount instructions are always visible
if(isset($_GET['mount-instructions']))
{
return true;
}
// The 'visible' operation is only permitted if the object is online,
// or if the user is also permitted the perform the 'write' operation.
if (false) // old implementation deactivated
{
$ops = explode(',',$operations);
if (in_array('visible',$ops) && ! in_array('write',$ops))
{
if (! $this->isOnline()) {
$operations .= ',write';
}
}
global $rbacsystem;
return $rbacsystem->checkAccess($operations, $this->getRefId(), $type);
}
else // this one fixes bug #5367
{
$GLOBALS['ilLog']->write('Checking permission for ref_id: '.$this->getRefId());
$GLOBALS['ilLog']->write("Operations: ".print_r($operations,true));
global $ilAccess;
$operations = explode(",",$operations."");
foreach ($operations as $operation)
{
if (!$ilAccess->checkAccess($operation, '', $this->getRefId(), $type))
{
$GLOBALS['ilLog']->write(__METHOD__.': Permission denied for user '.$GLOBALS['ilUser']->getId());
return false;
}
}
return true;
}
}

+ Here is the call graph for this function:

ilObjectDAV::read ( )

Reads the object data.

Returns
void.

Reimplemented in ilObjFileDAV, ilObjRootDAV, ilObjNullDAV, ilObjCourseDAV, ilObjGroupDAV, and ilObjMountPointDAV.

Definition at line 116 of file class.ilObjectDAV.php.

References getRefId().

{
global $ilias;
if (is_null($this->obj))
{
$this->obj =& $ilias->obj_factory->getInstanceByRefId($this->getRefId());
$this->obj->read();
}
}

+ Here is the call graph for this function:

ilObjectDAV::remove (   $objDAV)

Removes the specified child from this object.

Parameters
ilObjectDAVthe child to be removed.

Definition at line 499 of file class.ilObjectDAV.php.

References ilUtil\removeItemFromDesktops().

{
global $tree, $rbacadmin;
$subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
foreach ($subnodes as $node)
{
$rbacadmin->revokePermission($node["child"]);
$affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
}
$tree->saveSubTree($objDAV->getRefId());
$tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
}

+ Here is the call graph for this function:

ilObjectDAV::removeDeletedNodes (   $a_node_id,
  $a_checked,
  $a_delete_objects = true 
)

remove already deleted objects within the objects in trash recursive function

public

Parameters
integerref_id of source object
boolean

Definition at line 678 of file class.ilObjectDAV.php.

References $ilDB, $log, $query, $res, and $row.

{
global $ilDB, $log, $ilias, $tree;
$query = "SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
$sta = $ilDB->prepare($query,array('integer','integer'));
$res = $ilDB->execute($sta,array(
$a_node_id,
0));
while($row = $ilDB->fetchObject($res))
{
// only continue recursion if fetched node wasn't touched already!
if (!in_array($row->tree,$a_checked))
{
$deleted_tree = new ilTree($row->tree);
$a_checked[] = $row->tree;
$row->tree = $row->tree * (-1);
$del_node_data = $deleted_tree->getNodeData($row->tree);
$del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
$this->removeDeletedNodes($row->tree,$a_checked);
if ($a_delete_objects)
{
foreach ($del_subtree_nodes as $node)
{
$node_obj =& $ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
// write log entry
/*$this->writelog("removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
", ref_id: ".$node_obj->getRefId().", type: ".$node_obj->getType().", ".
"title: ".$node_obj->getTitle());
*/
$node_obj->delete();
}
}
$tree->deleteTree($del_node_data);
// write log entry
//$this->writelog("removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data["tree"].", child: ".$del_node_data["child"]);
}
}
return true;
}
ilObjectDAV::setContentLength (   $length)

Sets the length (number of bytes) of the content of this object.

Parameters
Integer.

Reimplemented in ilObjFileDAV.

Definition at line 243 of file class.ilObjectDAV.php.

{
// subclass responsibility
}
ilObjectDAV::setContentType (   $type)

Sets the mime type of the content of this object.

Parameters
String.

Reimplemented in ilObjFileDAV.

Definition at line 235 of file class.ilObjectDAV.php.

{
// subclass responsibility
}
ilObjectDAV::setResourceName (   $name)

Sets the resource name of this object.

Precondition: Object must have been read. String.

Definition at line 151 of file class.ilObjectDAV.php.

References writelog().

{
$this->writelog('setResourceName('.$name.')');
return $this->obj->setTitle($name);
}

+ Here is the call graph for this function:

ilObjectDAV::write ( )

Writes the object data.

Returns
void.

Reimplemented in ilObjFileDAV, ilObjCategoryDAV, and ilObjMountPointDAV.

Definition at line 130 of file class.ilObjectDAV.php.

References writelog().

Referenced by ilObjNullDAV\convertToILIASType().

{
$this->writelog('write() refid='.$this->refId);
$this->obj->update();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectDAV::writelog (   $message)

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

Definition at line 845 of file class.ilObjectDAV.php.

References $log.

Referenced by addCopy(), addMove(), cloneNodes(), ilObjNullDAV\convertToILIASType(), ilObjectDAV(), setResourceName(), and write().

{
if ($this->isDebug)
{
global $log, $ilias;
$log->write(
$ilias->account->getLogin()
.' DAV .'.get_class($this).' '.str_replace("\n",";",$message)
);
/*
$fh = fopen('/opt/ilias/log/ilias.log', 'a');
fwrite($fh, date('Y-m-d h:i:s '));
fwrite($fh, str_replace("\n",";",$message));
fwrite($fh, "\n\n");
fclose($fh);
*/
}
}

+ Here is the caller graph for this function:

Field Documentation

ilObjectDAV::$isDebug = false

The ObjectDAV prints lots of log messages to the ilias log, if this variable is set to true.

Definition at line 52 of file class.ilObjectDAV.php.

ilObjectDAV::$obj

Application layer object.

Definition at line 46 of file class.ilObjectDAV.php.

Referenced by ilObjectDAV(), ilObjFileDAV\ilObjFileDAV(), and ilObjNullDAV\ilObjNullDAV().

ilObjectDAV::$refId

Refid to the object.

Definition at line 41 of file class.ilObjectDAV.php.

Referenced by ilObjNullDAV\convertToILIASType(), createObject(), getRefId(), and ilObjectDAV().


The documentation for this class was generated from the following file: