ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjectDAV Class Reference
+ Inheritance diagram for ilObjectDAV:
+ Collaboration diagram for ilObjectDAV:

Public Member Functions

 __construct ($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 ()
 
 childrenWithPermission ($operations, $type='')
 Returns the children of this object with the specified permissions. 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...
 

Static Public Member Functions

static createObject ($refId, $type)
 Static factory method to create a DAV object for a given refId and type. 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 37 of file class.ilObjectDAV.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
intA refId to the object.

Reimplemented in ilObjFileDAV, and ilObjNullDAV.

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

61 {
62 if (is_object($obj))
63 {
64 $this->writelog('<constructor>('.$refId.','.get_class($obj).')');
65 }
66 $this->refId = $refId;
67 $this->obj =& $obj;
68 }
$refId
Refid to the object.
$obj
Application layer object.
writelog($message)
Writes a message to the logfile.,.

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

+ Here is the call graph for this function:

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 894 of file class.ilObjectDAV.php.

894 {
895 return get_class($this).'#'.$this->getObjectId();
896 }
getObjectId()
Returns the object id of this object.

References getObjectId().

+ 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 530 of file class.ilObjectDAV.php.

531 {
532 $this->writelog("addCopy($objDAV,$newName) ....");
533 global $DIC;
534 $rbacadmin = $DIC['rbacadmin'];
535 $tree = $DIC['tree'];
536 $revIdMapping = array();
537 $newRef = $this->cloneNodes($objDAV->getRefId(),$this->getRefId(),$revIdMapping, $newName);
538 //$rbacadmin->adjustMovedObjectPermissions($newRef, $tree->getParentId($objDAV->getRefId()));
539 return self::createObject($newRef, $objDAV->getILIASType());
540 $this->writelog('... addCopy done.');
541 }
cloneNodes($srcRef, $dstRef, &$mapping, $newName=null)
Recursively clones all nodes of the RBAC tree.
static createObject($refId, $type)
Static factory method to create a DAV object for a given refId and type.
global $DIC

References $DIC, cloneNodes(), createObject(), and writelog().

+ 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 609 of file class.ilObjectDAV.php.

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

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

+ 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..

Reimplemented in ilObjMountPointDAV.

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

756 {
757 // FIXME: Remove duplicate entries from this list, because of RFC2518, chapter 5.2
758 // If a duplicate is found, the older object must win. We use the object
759 // id to determine this. This is based on the assumption, that new objects
760 // have higher object id's then older objects.
761
762 global $DIC;
763 $tree = $DIC['tree'];
764
765 $childrenDAV = array();
766 // Performance optimization. We sort the children using PHP instead of using the database.
767 //$childrenData =& $tree->getChilds($this->getRefId(),'title');
768 $childrenData =& $tree->getChilds($this->getRefId(),'');
769 foreach ($childrenData as $data)
770 {
771 $childDAV =& self::createObject($data['ref_id'],$data['type']);
772 if (! is_null($childDAV))
773 {
774 // Note: We must not assign with =& here, because this will cause trouble
775 // when other functions attempt to work with the $childrenDAV array.
776 $childrenDAV[] = $childDAV;
777 }
778
779 }
780 return $childrenDAV;
781 }
getRefId()
Returns the ref id of this object.

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

Referenced by childrenWithPermission().

+ 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 791 of file class.ilObjectDAV.php.

792 {
793 //$this->writelog('@'.$this->getRefId().'.childrenWithPermission('.$operations.','.$type.')');
794 $childrenDAV = $this->children();
795 $permittedChildrenDAV = array();
796 foreach ($childrenDAV as $childDAV)
797 {
798 if ($childDAV->isPermitted($operations, $type))
799 {
800 $permittedChildrenDAV[] = $childDAV;
801 }
802
803 }
804 //$this->writelog('@'.$this->getRefId().'.childrenWithPermission():'.count($permittedChildrenDAV).' children');
805 return $permittedChildrenDAV;
806 }

References children().

+ Here is the call graph for this function:

◆ cloneNodes()

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

Recursively clones all nodes of the RBAC tree.

@access 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 553 of file class.ilObjectDAV.php.

554 {
555 $this->writelog("cloneNodes($srcRef,$dstRef,$mapping,$newName)");
556 global $DIC;
557 $tree = $DIC['tree'];
558 global $DIC;
559 $ilias = $DIC['ilias'];
560
561 // clone the source node
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();
566
567 // We must immediately apply a new name to the object, to
568 // prevent confusion of WebDAV clients about having two objects with identical
569 // name in the repository.
570 $this->writelog("cloneNodes newname not null? ".(! is_null($newName)));
571 if (! is_null($newName))
572 {
573 $newObjDAV = self::createObject($newRef, $srcObj->getType());
574 $newObjDAV->setResourceName($newName);
575 $newObjDAV->write();
576 }
577 unset($srcObj);
578 $mapping[$newRef] = $srcRef;
579
580 // clone all children of the source node
581 $children = $tree->getChilds($srcRef);
582 foreach ($tree->getChilds($srcRef) as $child)
583 {
584 // Don't clone role folders, because it does not make sense to clone local roles
585 // FIXME - Maybe it does make sense (?)
586 if ($child["type"] != 'rolf')
587 {
588 $this->cloneNodes($child["ref_id"],$newRef,$mapping,null);
589 }
590 else
591 {
592 if (count($rolf = $tree->getChildsByType($newRef,"rolf")))
593 {
594 $mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
595 }
596 }
597 }
598 $this->writelog('cloneNodes ...cloned srcRef='.$srcRef.' dstRef='.$dstRef.' newRef='.$newRef);
599 return $newRef;
600 }

References $DIC, cloneNodes(), createObject(), and writelog().

Referenced by addCopy(), and cloneNodes().

+ 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.

Reimplemented in ilObjCategoryDAV.

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

400 {
401 global $DIC;
402 $tree = $DIC['tree'];
403
404 // create and insert Folder in tree
405 require_once 'Modules/Folder/classes/class.ilObjFolder.php';
406 $newObj = new ilObjFolder(0);
407 $newObj->setType($this->getILIASCollectionType());
408 $newObj->setTitle($name);
409 //$newObj->setDescription('');
410 $newObj->create();
411 $newObj->createReference();
412 $newObj->setPermissions($this->getRefId());
413 $newObj->putInTree($this->getRefId());
414
415 require_once 'class.ilObjFolderDAV.php';
416 return new ilObjFolderDAV($newObj->getRefId(), $newObj);
417 }
Class ilObjFolder.
getILIASCollectionType()
Returns the ilias type for collections that can be created as children of this object.

References $DIC, getILIASCollectionType(), and getRefId().

+ 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 424 of file class.ilObjectDAV.php.

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

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

+ 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 461 of file class.ilObjectDAV.php.

462 {
463 global $DIC;
464 $tree = $DIC['tree'];
465
466 // create and insert Folder in tree
467 require_once 'Modules/File/classes/class.ilObjFile.php';
468 $objDAV =& $nullDAV->convertToILIASType($this->getRefId(), $this->getILIASFileType());
469 $objDAV->initFromNull();
470 return $objDAV;
471 }

References $DIC, getILIASFileType(), and getRefId().

+ 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.

Reimplemented in ilObjFileDAV.

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

389 {
390 }

◆ 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 479 of file class.ilObjectDAV.php.

480 {
481 global $DIC;
482 $tree = $DIC['tree'];
483
484 // create and insert Folder in tree
485 require_once './Services/Object/classes/class.ilObject.php';
486 $newObj = new ilObject(0);
487 $newObj->setType('null');
488 $newObj->setTitle($name);
489 $newObj->create();
490 $newObj->createReference();
491 $newObj->setPermissions($this->getRefId());
492 $newObj->putInTree($this->getRefId());
493
494 require_once 'class.ilObjNullDAV.php';
495 $objDAV = new ilObjNullDAV($newObj->getRefId(), $newObj);
496
497 return $objDAV;
498 }
Class ilObject Basic functions for all objects.

References $DIC, and getRefId().

+ Here is the call graph for this function:

◆ createObject()

static ilObjectDAV::createObject (   $refId,
  $type 
)
static

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 816 of file class.ilObjectDAV.php.

817 {
818 $newObj = null;
819
820 switch ($type)
821 {
822 case 'mountPoint' :
823 require_once 'class.ilObjMountPointDAV.php';
824 $newObj = new ilObjMountPointDAV($refId,null);
825 break;
826 case 'root' :
827 require_once 'class.ilObjRootDAV.php';
828 $newObj = new ilObjRootDAV($refId,null);
829 break;
830 case 'cat' :
831 require_once 'class.ilObjCategoryDAV.php';
832 $newObj = new ilObjCategoryDAV($refId,null);
833 break;
834 case 'fold' :
835 require_once 'class.ilObjFolderDAV.php';
836 $newObj = new ilObjFolderDAV($refId,null);
837 break;
838 case 'crs' :
839 require_once 'class.ilObjCourseDAV.php';
840 $newObj = new ilObjCourseDAV($refId,null);
841 break;
842 case 'grp' :
843 require_once 'class.ilObjGroupDAV.php';
844 $newObj = new ilObjGroupDAV($refId,null);
845 break;
846 case 'file' :
847 require_once 'class.ilObjFileDAV.php';
848 $newObj = new ilObjFileDAV($refId,null);
849 break;
850 case 'null' :
851 require_once 'class.ilObjNullDAV.php';
852 $newObj = new ilObjNullDAV($refId,null);
853 break;
854 default :
855 break;
856 }
857 if (! is_null($newObj))
858 {
859 $newObj->read();
860 }
861 return $newObj;
862 }

References $refId.

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

+ 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.

Reimplemented in ilObjFileDAV.

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

292 {
293 return null;
294 }

◆ getContentLength()

ilObjectDAV::getContentLength ( )

Returns the number of bytes of the content.

Returns
int.

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

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

254 {
255 return 0;
256 }

◆ getContentOutputStream()

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 269 of file class.ilObjectDAV.php.

270 {
271 return null;
272 }

◆ 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.

Reimplemented in ilObjFileDAV.

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

283 {
284 // subclass responsibility
285 }

◆ getContentStream()

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 261 of file class.ilObjectDAV.php.

262 {
263 return null;
264 }

◆ getContentType()

ilObjectDAV::getContentType ( )

Returns the mime type of the content of this object.

Returns
String.

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

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

230 {
231 return 'application/x-non-readable';//'application/octet-stream';
232 }

◆ getCreationTimestamp()

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 173 of file class.ilObjectDAV.php.

174 {
175 return strtotime($this->obj->getCreateDate());
176 }

◆ getDisplayName()

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 163 of file class.ilObjectDAV.php.

164 {
165 return $this->obj->getTitle();
166 }

◆ getILIASCollectionType()

ilObjectDAV::getILIASCollectionType ( )

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

Reimplemented in ilObjCategoryDAV, and ilObjRootDAV.

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

374 {
375 return 'fold';
376 }

Referenced by createCollection().

+ 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 380 of file class.ilObjectDAV.php.

381 {
382 return 'file';
383 }

Referenced by createFile(), and createFileFromNull().

+ Here is the caller graph for this function:

◆ getILIASType()

ilObjectDAV::getILIASType ( )

Returns the ilias type of the current object.

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

362 {
363 if($this->obj instanceof ilObject)
364 {
365 return $this->obj->getType();
366 }
367 $GLOBALS['DIC']['ilLog']->write(__METHOD__.': Invalid object given, class='.get_class($this->obj));
368 $GLOBALS['DIC']['ilLog']->logStack();
369 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS.

◆ getModificationTimestamp()

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 183 of file class.ilObjectDAV.php.

184 {
185 return strtotime($this->obj->getLastUpdateDate());
186 }

◆ 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 94 of file class.ilObjectDAV.php.

95 {
96 return 0;
97 }

◆ getObjectId()

ilObjectDAV::getObjectId ( )

Returns the object id of this object.

Returns
int.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

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

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

Referenced by __toString().

+ 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.

Reimplemented in ilObjMountPointDAV, and ilObjRootDAV.

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

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

Referenced by ilObjFileDAV\initFromNull().

+ 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".

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

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

194 {
195 return "";
196 }

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

+ 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.

Reimplemented in ilObjFileDAV.

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

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

References getRefId().

+ 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 203 of file class.ilObjectDAV.php.

204 {
205 return $this->getResourceType() == 'collection';
206 }
getResourceType()
Returns the DAV resource type of this object.

References getResourceType().

+ 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 212 of file class.ilObjectDAV.php.

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

References getResourceType().

+ 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 220 of file class.ilObjectDAV.php.

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

References getResourceType().

+ Here is the call graph for this function:

◆ isOnline()

ilObjectDAV::isOnline ( )

Returns true if the object is online.

Reimplemented in ilObjCourseDAV.

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

300 {
301 return true;
302 }

Referenced by isPermitted().

+ 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

Reimplemented in ilObjMountPointDAV.

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

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

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

+ Here is the call graph for this function:

◆ read()

ilObjectDAV::read ( )

Reads the object data.

Returns
void.

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

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

118 {
119 global $DIC;
120 $ilias = $DIC['ilias'];
121
122 if (is_null($this->obj))
123 {
124 $this->obj =& $ilias->obj_factory->getInstanceByRefId($this->getRefId());
125 $this->obj->read();
126 }
127 }

References $DIC, and getRefId().

+ 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 507 of file class.ilObjectDAV.php.

508 {
509 global $DIC;
510 $tree = $DIC['tree'];
511 $rbacadmin = $DIC['rbacadmin'];
512
513 $subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
514 foreach ($subnodes as $node)
515 {
516 $rbacadmin->revokePermission($node["child"]);
517 $affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
518 }
519 $tree->saveSubTree($objDAV->getRefId());
520 $tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
521 }
static removeItemFromDesktops($a_id)
removes object from all user's desktops @access public

References $DIC, and ilUtil\removeItemFromDesktops().

+ 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

@access public

Parameters
integerref_id of source object
boolean

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

697 {
698 global $DIC;
699 $ilDB = $DIC['ilDB'];
700 $log = $DIC['log'];
701 $ilias = $DIC['ilias'];
702 $tree = $DIC['tree'];
703
704 $query = "SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
705 $sta = $ilDB->prepare($query,array('integer','integer'));
706 $res = $ilDB->execute($sta,array(
707 $a_node_id,
708 0));
709
710
711 while($row = $ilDB->fetchObject($res))
712 {
713 // only continue recursion if fetched node wasn't touched already!
714 if (!in_array($row->tree,$a_checked))
715 {
716 $deleted_tree = new ilTree($row->tree);
717 $a_checked[] = $row->tree;
718
719 $row->tree = $row->tree * (-1);
720 $del_node_data = $deleted_tree->getNodeData($row->tree);
721 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
722
723 $this->removeDeletedNodes($row->tree,$a_checked);
724
725 if ($a_delete_objects)
726 {
727 foreach ($del_subtree_nodes as $node)
728 {
729 $node_obj =& $ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
730
731 // write log entry
732 /*$this->writelog("removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
733 ", ref_id: ".$node_obj->getRefId().", type: ".$node_obj->getType().", ".
734 "title: ".$node_obj->getTitle());
735 */
736 $node_obj->delete();
737 }
738 }
739
740 $tree->deleteTree($del_node_data);
741
742 // write log entry
743 //$this->writelog("removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data["tree"].", child: ".$del_node_data["child"]);
744 }
745 }
746
747 return true;
748 }
removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects=true)
remove already deleted objects within the objects in trash recursive function
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilDB

References $DIC, $ilDB, $log, $query, $res, $row, and removeDeletedNodes().

Referenced by removeDeletedNodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentLength()

ilObjectDAV::setContentLength (   $length)

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

Parameters
Integer.

Reimplemented in ilObjFileDAV.

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

246 {
247 // subclass responsibility
248 }

◆ setContentType()

ilObjectDAV::setContentType (   $type)

Sets the mime type of the content of this object.

Parameters
String.

Reimplemented in ilObjFileDAV.

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

238 {
239 // subclass responsibility
240 }

◆ setResourceName()

ilObjectDAV::setResourceName (   $name)

Sets the resource name of this object.

Precondition: Object must have been read. @parm String.

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

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

References writelog().

+ Here is the call graph for this function:

◆ write()

ilObjectDAV::write ( )

Writes the object data.

Returns
void.

Reimplemented in ilObjCategoryDAV, ilObjFileDAV, and ilObjMountPointDAV.

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

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

References writelog().

Referenced by ilObjNullDAV\convertToILIASType().

+ 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 869 of file class.ilObjectDAV.php.

870 {
871 if ($this->isDebug)
872 {
873 global $DIC;
874 $log = $DIC['log'];
875 $ilias = $DIC['ilias'];
876 $log->write(
877 $ilias->account->getLogin()
878 .' DAV .'.get_class($this).' '.str_replace("\n",";",$message)
879 );
880 /*
881 $fh = fopen('/opt/ilias/log/ilias.log', 'a');
882 fwrite($fh, date('Y-m-d h:i:s '));
883 fwrite($fh, str_replace("\n",";",$message));
884 fwrite($fh, "\n\n");
885 fclose($fh);
886 */
887 }
888 }

References $DIC, and $log.

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

+ 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 53 of file class.ilObjectDAV.php.

◆ $obj

ilObjectDAV::$obj

Application layer object.

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

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

◆ $refId

ilObjectDAV::$refId

Refid to the object.

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

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


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