ILIAS  release_4-4 Revision
ilObjectDAV Class Reference
+ Inheritance diagram for ilObjectDAV:
+ Collaboration diagram for ilObjectDAV:

Public Member Functions

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

Data Fields

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

Detailed Description

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

Member Function Documentation

◆ __toString()

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().

868  {
869  return get_class($this).'#'.$this->getObjectId();
870  }
getObjectId()
Returns the object id of this object.
+ Here is the call graph for this function:

◆ addCopy()

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().

521  {
522  $this->writelog("addCopy($objDAV,$newName) ....");
523  global $rbacadmin, $tree;
524  $revIdMapping = array();
525  $newRef = $this->cloneNodes($objDAV->getRefId(),$this->getRefId(),$revIdMapping, $newName);
526  //$rbacadmin->adjustMovedObjectPermissions($newRef, $tree->getParentId($objDAV->getRefId()));
527  return $this->createObject($newRef, $objDAV->getILIASType());
528  $this->writelog('... addCopy done.');
529  }
createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
writelog($message)
Writes a message to the logfile.,.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ addMove()

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().

596  {
597  global $tree;
598  global $rbacadmin;
599  global $ilias;
600  global $log;
601 
602  $this->writelog('addMove('.$objDAV->getRefId().' to '.$this->getRefId().', newName='.$newName.')');
603 
604  // Step 0:Assign new name to moved object
605  if (! is_null($newName))
606  {
607  $objDAV->setResourceName($newName);
608  $objDAV->write();
609  }
610 
611  // Step 1: Store old parent
612  $old_parent = $tree->getParentId($objDAV->getRefId());
613 
614  // Step 2: Move the tree
615  $tree->moveTree($objDAV->getRefId(),$this->getRefId());
616 
617  // Step 3: Repair permissions
618  $rbacadmin->adjustMovedObjectPermissions($objDAV->getRefId(), $old_parent);
619 
620  /*
621  // STEP 1: Move subtree to trash
622  $this->writelog('addMove('.$objDAV->getRefId().' to '.$this->getRefId().') step 1: move subtree to trash');
623  $subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
624  foreach ($subnodes as $node)
625  {
626  $rbacadmin->revokePermission($node["child"]);
627  $affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
628  }
629  $tree->saveSubTree($objDAV->getRefId());
630  $tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
631 
632  // STEP 2: Move subtree to new location
633  // TODO: this whole put in place again stuff needs revision. Permission settings get lost.
634  $this->writelog('addMove() step 2: move subtree to new location');
635  // put top node to dest
636  $rbacadmin->revokePermission($subnodes[0]['child']);
637  $obj_data =& $ilias->obj_factory->getInstanceByRefId($subnodes[0]['child']);
638  $obj_data->putInTree($this->getRefId());
639  $obj_data->setPermissions($this->getRefId());
640  array_shift($subnodes);
641 
642  // put all sub nodes to their parent (of which we have moved top already to dest).
643  foreach ($subnodes as $node)
644  {
645  $rbacadmin->revokePermission($node['child']);
646  $obj_data =& $ilias->obj_factory->getInstanceByRefId($node['child']);
647  $obj_data->putInTree($node['parent']);
648  $obj_data->setPermissions($node['parent']);
649  }
650 
651  // STEP 3: Remove trashed objects from system
652  $this->writelog('addMove('.$objDAV->getRefID().') step 3: remove trashed objects from system');
653  require_once 'Services/Tree/classes/class.ilTree.php';
654  $trashTree = new ilTree(- (int) $objDAV->getRefId());
655  $node = $trashTree->getNodeData($objDAV->getRefId());
656  $subnodes = $trashTree->getSubTree($node);
657 
658  // remember already checked deleted node_ids
659  $checked[] = -(int) $objDAV->getRefId();
660 
661  // dive in recursive manner in each already deleted subtrees and remove these objects too
662  $this->removeDeletedNodes($objDAV->getRefId(), $checked, false);
663 
664  // delete trash tree
665  $tree->deleteTree($node);
666  $this->writelog('addMove('.$objDAV->getRefID().') all 3 steps done');
667  */
668  }
writelog($message)
Writes a message to the logfile.,.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ children()

ilObjectDAV::children ( )

Returns the children of this object.

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

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

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

Referenced by childrenWithPermission().

734  {
735  // FIXME: Remove duplicate entries from this list, because of RFC2518, chapter 5.2
736  // If a duplicate is found, the older object must win. We use the object
737  // id to determine this. This is based on the assumption, that new objects
738  // have higher object id's then older objects.
739 
740  global $tree;
741 
742  $childrenDAV = array();
743  // Performance optimization. We sort the children using PHP instead of using the database.
744  //$childrenData =& $tree->getChilds($this->getRefId(),'title');
745  $childrenData =& $tree->getChilds($this->getRefId(),'');
746  foreach ($childrenData as $data)
747  {
748  $childDAV =& $this->createObject($data['ref_id'],$data['type']);
749  if (! is_null($childDAV))
750  {
751  // Note: We must not assign with =& here, because this will cause trouble
752  // when other functions attempt to work with the $childrenDAV array.
753  $childrenDAV[] = $childDAV;
754  }
755 
756  }
757  return $childrenDAV;
758  }
createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ childrenWithPermission()

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().

769  {
770  //$this->writelog('@'.$this->getRefId().'.childrenWithPermission('.$operations.','.$type.')');
771  $childrenDAV = $this->children();
772  $permittedChildrenDAV = array();
773  foreach ($childrenDAV as $childDAV)
774  {
775  if ($childDAV->isPermitted($operations, $type))
776  {
777  $permittedChildrenDAV[] = $childDAV;
778  }
779 
780  }
781  //$this->writelog('@'.$this->getRefId().'.childrenWithPermission():'.count($permittedChildrenDAV).' children');
782  return $permittedChildrenDAV;
783  }
children()
Returns the children of this object.
+ Here is the call graph for this function:

◆ cloneNodes()

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().

542  {
543  $this->writelog("cloneNodes($srcRef,$dstRef,$mapping,$newName)");
544  global $tree;
545  global $ilias;
546 
547  // clone the source node
548  $srcObj =& $ilias->obj_factory->getInstanceByRefId($srcRef);
549  $this->writelog('cloneNodes cloning srcRef='.$srcRef.' dstRef='.$dstRef.'...');
550  $newObj = $srcObj->cloneObject($dstRef);
551  $newRef = $newObj->getRefId();
552 
553  // We must immediately apply a new name to the object, to
554  // prevent confusion of WebDAV clients about having two objects with identical
555  // name in the repository.
556  $this->writelog("cloneNodes newname not null? ".(! is_null($newName)));
557  if (! is_null($newName))
558  {
559  $newObjDAV = $this->createObject($newRef, $srcObj->getType());
560  $newObjDAV->setResourceName($newName);
561  $newObjDAV->write();
562  }
563  unset($srcObj);
564  $mapping[$newRef] = $srcRef;
565 
566  // clone all children of the source node
567  $children = $tree->getChilds($srcRef);
568  foreach ($tree->getChilds($srcRef) as $child)
569  {
570  // Don't clone role folders, because it does not make sense to clone local roles
571  // FIXME - Maybe it does make sense (?)
572  if ($child["type"] != 'rolf')
573  {
574  $this->cloneNodes($child["ref_id"],$newRef,$mapping,null);
575  }
576  else
577  {
578  if (count($rolf = $tree->getChildsByType($newRef,"rolf")))
579  {
580  $mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
581  }
582  }
583  }
584  $this->writelog('cloneNodes ...cloned srcRef='.$srcRef.' dstRef='.$dstRef.' newRef='.$newRef);
585  return $newRef;
586  }
createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
writelog($message)
Writes a message to the logfile.,.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createCollection()

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.

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

References getILIASCollectionType(), and getRefId().

396  {
397  global $tree;
398 
399  // create and insert Folder in tree
400  require_once 'Modules/Folder/classes/class.ilObjFolder.php';
401  $newObj = new ilObjFolder(0);
402  $newObj->setType($this->getILIASCollectionType());
403  $newObj->setTitle($name);
404  //$newObj->setDescription('');
405  $newObj->create();
406  $newObj->createReference();
407  $newObj->setPermissions($this->getRefId());
408  $newObj->putInTree($this->getRefId());
409 
410  require_once 'class.ilObjFolderDAV.php';
411  return new ilObjFolderDAV($newObj->getRefId(), $newObj);
412  }
Class ilObjFolder.
getILIASCollectionType()
Returns the ilias type for collections that can be created as children of this object.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ createFile()

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().

420  {
421  global $tree;
422 
423  // create and insert Folder in tree
424  require_once 'Modules/File/classes/class.ilObjFile.php';
425  $newObj = new ilObjFile(0);
426  $newObj->setType($this->getILIASFileType());
427  $newObj->setTitle($name);
428  $newObj->setFileName($name);
429  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
430  $mime = ilMimeTypeUtil::getMimeType("", $name, 'application/octet-stream');
431  //$newObj->setFileType('application/octet-stream');
432  $newObj->setFileType($mime);
433  //$newObj->setDescription('');
434  $newObj->create();
435  $newObj->createReference();
436  $newObj->setPermissions($this->getRefId());
437  $newObj->putInTree($this->getRefId());
438  //$newObj->createDirectory();
439 
440  require_once 'class.ilObjFileDAV.php';
441  $objDAV = new ilObjFileDAV($newObj->getRefId(), $newObj);
442  /*
443  $fs = $objDAV->getContentOutputStream();
444  fwrite($fs,' ');
445  fclose($fs);
446  */
447  return $objDAV;
448  }
getILIASFileType()
Returns the ilias type for files that can be created as children of this object.
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
Class ilObjFile.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ createFileFromNull()

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().

456  {
457  global $tree;
458 
459  // create and insert Folder in tree
460  require_once 'Modules/File/classes/class.ilObjFile.php';
461  $objDAV =& $nullDAV->convertToILIASType($this->getRefId(), $this->getILIASFileType());
462  $objDAV->initFromNull();
463  return $objDAV;
464  }
getILIASFileType()
Returns the ilias type for files that can be created as children of this object.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ createNewVersion()

ilObjectDAV::createNewVersion ( )

Creates a new version of the object.

Only objects which support versioning need to implement this method.

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

385  {
386  }

◆ createNull()

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().

473  {
474  global $tree;
475 
476  // create and insert Folder in tree
477  require_once './Services/Object/classes/class.ilObject.php';
478  $newObj = new ilObject(0);
479  $newObj->setType('null');
480  $newObj->setTitle($name);
481  $newObj->create();
482  $newObj->createReference();
483  $newObj->setPermissions($this->getRefId());
484  $newObj->putInTree($this->getRefId());
485 
486  require_once 'class.ilObjNullDAV.php';
487  $objDAV = new ilObjNullDAV($newObj->getRefId(), $newObj);
488 
489  return $objDAV;
490  }
Class ilObject Basic functions for all objects.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ createObject()

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.

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

794  {
795  $newObj = null;
796  switch ($type)
797  {
798  case 'mountPoint' :
799  require_once 'class.ilObjMountPointDAV.php';
800  $newObj = new ilObjMountPointDAV($refId,null);
801  break;
802  case 'root' :
803  require_once 'class.ilObjRootDAV.php';
804  $newObj = new ilObjRootDAV($refId,null);
805  break;
806  case 'cat' :
807  require_once 'class.ilObjCategoryDAV.php';
808  $newObj = new ilObjCategoryDAV($refId,null);
809  break;
810  case 'fold' :
811  require_once 'class.ilObjFolderDAV.php';
812  $newObj = new ilObjFolderDAV($refId,null);
813  break;
814  case 'crs' :
815  require_once 'class.ilObjCourseDAV.php';
816  $newObj = new ilObjCourseDAV($refId,null);
817  break;
818  case 'grp' :
819  require_once 'class.ilObjGroupDAV.php';
820  $newObj = new ilObjGroupDAV($refId,null);
821  break;
822  case 'file' :
823  require_once 'class.ilObjFileDAV.php';
824  $newObj = new ilObjFileDAV($refId,null);
825  break;
826  case 'null' :
827  require_once 'class.ilObjNullDAV.php';
828  $newObj = new ilObjNullDAV($refId,null);
829  break;
830  default :
831  break;
832  }
833  if (! is_null($newObj))
834  {
835  $newObj->read();
836  }
837  return $newObj;
838  }
$refId
Refid to the object.
+ Here is the caller graph for this function:

◆ getContentData()

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.

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

290  {
291  return null;
292  }

◆ getContentLength()

ilObjectDAV::getContentLength ( )

Returns the number of bytes of the content.

Returns
int.

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

252  {
253  return 0;
254  }

◆ getContentOutputStream()

ilObjectDAV::getContentOutputStream ( )

Returns an output stream to the content.

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

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

268  {
269  return null;
270  }

◆ getContentOutputStreamLength()

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.

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

281  {
282  // subclass responsibility
283  }

◆ getContentStream()

ilObjectDAV::getContentStream ( )

Returns the content of the object as a stream.

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

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

260  {
261  return null;
262  }

◆ getContentType()

ilObjectDAV::getContentType ( )

Returns the mime type of the content of this object.

Returns
String.

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

228  {
229  return 'application/x-non-readable';//'application/octet-stream';
230  }

◆ getCreationTimestamp()

ilObjectDAV::getCreationTimestamp ( )

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

Precondition: Object must have been read.

Returns
int.

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

172  {
173  return strtotime($this->obj->getCreateDate());
174  }

◆ getDisplayName()

ilObjectDAV::getDisplayName ( )

Returns the display name of this object.

Precondition: Object must have been read.

Returns
String.

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

162  {
163  return $this->obj->getTitle();
164  }

◆ getILIASCollectionType()

ilObjectDAV::getILIASCollectionType ( )

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

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

Referenced by createCollection().

370  {
371  return 'fold';
372  }
+ Here is the caller graph for this function:

◆ getILIASFileType()

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().

377  {
378  return 'file';
379  }
+ Here is the caller graph for this function:

◆ getILIASType()

ilObjectDAV::getILIASType ( )

Returns the ilias type of the current object.

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

References $GLOBALS.

358  {
359  if($this->obj instanceof ilObject)
360  {
361  return $this->obj->getType();
362  }
363  $GLOBALS['ilLog']->write(__METHOD__.': Invalid object given, class='.get_class($this->obj));
364  $GLOBALS['ilLog']->logStack();
365  }
Class ilObject Basic functions for all objects.
$GLOBALS['ct_recipient']

◆ getModificationTimestamp()

ilObjectDAV::getModificationTimestamp ( )

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

Precondition: Object must have been read.

Returns
int.

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

182  {
183  return strtotime($this->obj->getLastUpdateDate());
184  }

◆ getNodeId()

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.

94  {
95  return 0;
96  }

◆ getObjectId()

ilObjectDAV::getObjectId ( )

Returns the object id of this object.

Returns
int.

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

Referenced by __toString().

83  {
84  return ($this->obj == null) ? null : $this->obj->getId();
85  }
+ Here is the caller graph for this function:

◆ getRefId()

ilObjectDAV::getRefId ( )

◆ getResourceName()

ilObjectDAV::getResourceName ( )

Returns the resource name of this object.

Precondition: Object must have been read.

Returns
String.

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

Referenced by ilObjFileDAV\initFromNull().

143  {
144  return $this->obj->getUntranslatedTitle();
145  }
+ Here is the caller graph for this function:

◆ getResourceType()

ilObjectDAV::getResourceType ( )

Returns the DAV resource type of this object.

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

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

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

192  {
193  return "";
194  }
+ Here is the caller graph for this function:

◆ ilObjectDAV()

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().

60  {
61  if (is_object($obj))
62  {
63  $this->writelog('<constructor>('.$refId.','.get_class($obj).')');
64  }
65  $this->refId = $refId;
66  $this->obj =& $obj;
67  }
$refId
Refid to the object.
writelog($message)
Writes a message to the logfile.,.
$obj
Application layer object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFromNull()

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.

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

References getRefId().

105  {
106  $this->obj->setPermissions($this->getRefId());
107  }
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ isCollection()

ilObjectDAV::isCollection ( )

Returns true if this object is a DAV collection.

Returns
bool.

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

References getResourceType().

202  {
203  return $this->getResourceType() == 'collection';
204  }
getResourceType()
Returns the DAV resource type of this object.
+ Here is the call graph for this function:

◆ isFile()

ilObjectDAV::isFile ( )

Returns true if this object is a DAV file.

Returns
bool.

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

References getResourceType().

211  {
212  return $this->getResourceType() == '';
213  }
getResourceType()
Returns the DAV resource type of this object.
+ Here is the call graph for this function:

◆ isNullResource()

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().

219  {
220  return $this->getResourceType() == 'null';
221  }
getResourceType()
Returns the DAV resource type of this object.
+ Here is the call graph for this function:

◆ isOnline()

ilObjectDAV::isOnline ( )

Returns true if the object is online.

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

Referenced by isPermitted().

298  {
299  return true;
300  }
+ Here is the caller graph for this function:

◆ isPermitted()

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

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

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

313  {
314  // Mount instructions are always visible
315  if(isset($_GET['mount-instructions']))
316  {
317  return true;
318  }
319 
320  // The 'visible' operation is only permitted if the object is online,
321  // or if the user is also permitted the perform the 'write' operation.
322  if (false) // old implementation deactivated
323  {
324  $ops = explode(',',$operations);
325  if (in_array('visible',$ops) && ! in_array('write',$ops))
326  {
327  if (! $this->isOnline()) {
328  $operations .= ',write';
329  }
330  }
331 
332  global $rbacsystem;
333  return $rbacsystem->checkAccess($operations, $this->getRefId(), $type);
334  }
335  else // this one fixes bug #5367
336  {
337  $GLOBALS['ilLog']->write('Checking permission for ref_id: '.$this->getRefId());
338  $GLOBALS['ilLog']->write("Operations: ".print_r($operations,true));
339 
340  global $ilAccess;
341  $operations = explode(",",$operations."");
342  foreach ($operations as $operation)
343  {
344  if (!$ilAccess->checkAccess($operation, '', $this->getRefId(), $type))
345  {
346  $GLOBALS['ilLog']->write(__METHOD__.': Permission denied for user '.$GLOBALS['ilUser']->getId());
347  return false;
348  }
349  }
350  return true;
351  }
352  }
$_GET["client_id"]
$GLOBALS['ct_recipient']
isOnline()
Returns true if the object is online.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ read()

ilObjectDAV::read ( )

Reads the object data.

Returns
void.

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

References getRefId().

117  {
118  global $ilias;
119 
120  if (is_null($this->obj))
121  {
122  $this->obj =& $ilias->obj_factory->getInstanceByRefId($this->getRefId());
123  $this->obj->read();
124  }
125  }
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ remove()

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().

500  {
501  global $tree, $rbacadmin;
502 
503  $subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
504  foreach ($subnodes as $node)
505  {
506  $rbacadmin->revokePermission($node["child"]);
507  $affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
508  }
509  $tree->saveSubTree($objDAV->getRefId());
510  $tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
511  }
static removeItemFromDesktops($a_id)
removes object from all user&#39;s desktops public
+ Here is the call graph for this function:

◆ removeDeletedNodes()

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 $log, $query, $res, and $row.

679  {
680  global $ilDB, $log, $ilias, $tree;
681 
682  $query = "SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
683  $sta = $ilDB->prepare($query,array('integer','integer'));
684  $res = $ilDB->execute($sta,array(
685  $a_node_id,
686  0));
687 
688 
689  while($row = $ilDB->fetchObject($res))
690  {
691  // only continue recursion if fetched node wasn't touched already!
692  if (!in_array($row->tree,$a_checked))
693  {
694  $deleted_tree = new ilTree($row->tree);
695  $a_checked[] = $row->tree;
696 
697  $row->tree = $row->tree * (-1);
698  $del_node_data = $deleted_tree->getNodeData($row->tree);
699  $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
700 
701  $this->removeDeletedNodes($row->tree,$a_checked);
702 
703  if ($a_delete_objects)
704  {
705  foreach ($del_subtree_nodes as $node)
706  {
707  $node_obj =& $ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
708 
709  // write log entry
710  /*$this->writelog("removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
711  ", ref_id: ".$node_obj->getRefId().", type: ".$node_obj->getType().", ".
712  "title: ".$node_obj->getTitle());
713  */
714  $node_obj->delete();
715  }
716  }
717 
718  $tree->deleteTree($del_node_data);
719 
720  // write log entry
721  //$this->writelog("removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data["tree"].", child: ".$del_node_data["child"]);
722  }
723  }
724 
725  return true;
726  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects=true)
remove already deleted objects within the objects in trash recursive function

◆ setContentLength()

ilObjectDAV::setContentLength (   $length)

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

Parameters
Integer.

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

244  {
245  // subclass responsibility
246  }

◆ setContentType()

ilObjectDAV::setContentType (   $type)

Sets the mime type of the content of this object.

Parameters
String.

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

236  {
237  // subclass responsibility
238  }

◆ setResourceName()

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().

152  {
153  $this->writelog('setResourceName('.$name.')');
154  return $this->obj->setTitle($name);
155  }
writelog($message)
Writes a message to the logfile.,.
+ Here is the call graph for this function:

◆ write()

ilObjectDAV::write ( )

Writes the object data.

Returns
void.

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

References writelog().

Referenced by ilObjNullDAV\convertToILIASType().

131  {
132  $this->writelog('write() refid='.$this->refId);
133  $this->obj->update();
134  }
writelog($message)
Writes a message to the logfile.,.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writelog()

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().

846  {
847  if ($this->isDebug)
848  {
849  global $log, $ilias;
850  $log->write(
851  $ilias->account->getLogin()
852  .' DAV .'.get_class($this).' '.str_replace("\n",";",$message)
853  );
854  /*
855  $fh = fopen('/opt/ilias/log/ilias.log', 'a');
856  fwrite($fh, date('Y-m-d h:i:s '));
857  fwrite($fh, str_replace("\n",";",$message));
858  fwrite($fh, "\n\n");
859  fclose($fh);
860  */
861  }
862  }
+ Here is the caller graph for this function:

Field Documentation

◆ $isDebug

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.

◆ $obj

ilObjectDAV::$obj

Application layer object.

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

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

◆ $refId

ilObjectDAV::$refId

Refid to the object.

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

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


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