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

Public Member Functions

 __construct ($refid, $obj=null)
 Constructor. More...
 
 initFromNull ()
 Initializes the object after it has been converted from the NULL type. More...
 
 createNewVersion ()
 Creates a new version of the object. More...
 
 getResourceType ()
 Returns the display name of this object. 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 (in 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...
 
 read ()
 Reads the object data. More...
 
 write ()
 Writes the object data. More...
 
- Public Member Functions inherited from ilObjectDAV
 __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 ()
 Returns the children of this object. More...
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectDAV
static createObject ($refId, $type)
 Static factory method to create a DAV object for a given refId and type. More...
 
- Data Fields inherited from ilObjectDAV
 $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 43 of file class.ilObjFileDAV.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjFileDAV::__construct (   $refid,
  $obj = null 
)

Constructor.

Parameters
refidA refid to the object.

Definition at line 50 of file class.ilObjFileDAV.php.

References ilObjectDAV\$obj.

51  {
52  parent::__construct($refid, $obj);
53 
54  // Set debug to true, if you want to get debug output for this
55  // object
56  //$this->isDebug = true;
57  }
$obj
Application layer object.

Member Function Documentation

◆ createNewVersion()

ilObjFileDAV::createNewVersion ( )

Creates a new version of the object.

Only objects which support versioning need to implement this method.

Definition at line 76 of file class.ilObjFileDAV.php.

References ilHistory\_createEntry().

76  {
77  $this->obj->setVersion($this->obj->getVersion() + 1);
78  ilHistory::_createEntry($this->obj->getId(), "replace",
79  $this->obj->getFileName().",".$this->obj->getVersion());
80  }
static _createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
+ Here is the call graph for this function:

◆ getContentData()

ilObjFileDAV::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 184 of file class.ilObjFileDAV.php.

185  {
186  return null;
187  }

◆ getContentLength()

ilObjFileDAV::getContentLength ( )

Returns the number of bytes of the content.

Returns
int.

Definition at line 136 of file class.ilObjFileDAV.php.

References ilObjFile\_lookupFileSize().

137  {
138  return ilObjFile::_lookupFileSize($this->obj->getId());
139  }
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
+ Here is the call graph for this function:

◆ getContentOutputStream()

ilObjFileDAV::getContentOutputStream ( )

Returns an output stream to the content.

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

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

References $file, and ilUtil\makeDirParents().

154  {
155  $file = $this->obj->getFile();
156  $parent = dirname($file);
157  if (! file_exists($parent))
158  {
159  ilUtil::makeDirParents($parent);
160  }
161 
162  return fopen($file,'w');
163  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getContentOutputStreamLength()

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

References $file.

174  {
175  $file = $this->obj->getFile();
176  return file_exists($file) ? filesize($file) : 0;
177 
178  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

◆ getContentStream()

ilObjFileDAV::getContentStream ( )

Returns the content of the object as a stream.

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

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

References $file.

145  {
146  $file = $this->obj->getFile();
147  return (file_exists($file)) ? fopen($file,'r') : null;
148  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

◆ getContentType()

ilObjFileDAV::getContentType ( )

Returns the mime type of the content of this object.

Returns
String.

Definition at line 110 of file class.ilObjFileDAV.php.

111  {
112  //return $this->obj->getFileType();
113  return $this->obj->guessFileType();
114  }

◆ getResourceType()

ilObjFileDAV::getResourceType ( )

Returns the display name of this object.

Precondition: Object must have been read.

Returns
String. FIXME - Method deactivated. We don't display the file name as display name. Because the file name is not necessarily known to the user. / function getDisplayName() { return $this->obj->getFileName(); } Returns the DAV resource type of this object.
String "collection" or "".

Definition at line 101 of file class.ilObjFileDAV.php.

102  {
103  return "";
104  }

◆ initFromNull()

ilObjFileDAV::initFromNull ( )

Initializes the object after it has been converted from the NULL type.

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

Returns
void.

Definition at line 65 of file class.ilObjFileDAV.php.

References ilObjectDAV\getRefId(), ilObjectDAV\getResourceName(), and write().

66  {
67  $this->obj->setFileName($this->getResourceName());
68  $this->obj->setFileType($this->obj->guessFileType());
69  $this->write();
70  $this->obj->setPermissions($this->getRefId());
71  }
write()
Writes the object data.
getResourceName()
Returns the resource name of this object.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ read()

ilObjFileDAV::read ( )

Reads the object data.

Returns
void.

Definition at line 192 of file class.ilObjFileDAV.php.

References ilObjectDAV\getRefId().

193  {
194  if (is_null($this->obj))
195  {
196  $this->obj = new ilObjFile($this->getRefId(),true);
197  $this->obj->read();
198  }
199  }
Class ilObjFile.
getRefId()
Returns the ref id of this object.
+ Here is the call graph for this function:

◆ setContentLength()

ilObjFileDAV::setContentLength (   $length)

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

Parameters
Integer.

Definition at line 127 of file class.ilObjFileDAV.php.

128  {
129  $this->writeLog('setContentLength('.$length.')');
130  $this->obj->setFileSize($length);
131  }

◆ setContentType()

ilObjFileDAV::setContentType (   $type)

Sets the mime type of the content of this object.

Parameters
String.

Definition at line 119 of file class.ilObjFileDAV.php.

120  {
121  $this->obj->setFileType($type);
122  }

◆ write()

ilObjFileDAV::write ( )

Writes the object data.

Returns
void.

Definition at line 204 of file class.ilObjFileDAV.php.

Referenced by initFromNull().

205  {
206  $this->isNewFile = $this->obj->getVersion() == 0;
207  if ($this->isNewFile)
208  {
209  $this->obj->setVersion(1);
210  }
211  parent::write();
212  /*
213  ilHistory::_createEntry($this->getObjectId(), 'update', '', '','', true);
214  */
215  }
+ Here is the caller graph for this function:

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