ILIAS
release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
◀ ilDoc Overview
class.ilObjFileDAV.php
Go to the documentation of this file.
1
<?php
2
// BEGIN WebDAV
3
/*
4
+-----------------------------------------------------------------------------+
5
| ILIAS open source |
6
+-----------------------------------------------------------------------------+
7
| Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
8
| |
9
| This program is free software; you can redistribute it and/or |
10
| modify it under the terms of the GNU General Public License |
11
| as published by the Free Software Foundation; either version 2 |
12
| of the License, or (at your option) any later version. |
13
| |
14
| This program is distributed in the hope that it will be useful, |
15
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
| GNU General Public License for more details. |
18
| |
19
| You should have received a copy of the GNU General Public License |
20
| along with this program; if not, write to the Free Software |
21
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
+-----------------------------------------------------------------------------+
23
*/
24
25
require_once
"class.ilObjectDAV.php"
;
26
27
require_once
'./Services/History/classes/class.ilHistory.php'
;
28
require_once
'Services/Utilities/classes/class.ilUtil.php'
;
29
require_once
"Modules/File/classes/class.ilObjFile.php"
;
30
31
// NOTE: I changed class.ilObjFile.php to support the functionality needed by this handler.
32
43
class
ilObjFileDAV
extends
ilObjectDAV
44
{
50
function
ilObjFileDAV
($refid,
$obj
=
null
)
51
{
52
$this->
ilObjectDAV
($refid,
$obj
);
53
54
// Set debug to true, if you want to get debug output for this
55
// object
56
//$this->isDebug = true;
57
}
58
65
function
initFromNull
()
66
{
67
$this->obj->setFileName($this->
getResourceName
());
68
$this->obj->setFileType($this->obj->guessFileType());
69
$this->
write
();
70
$this->obj->setPermissions($this->
getRefId
());
71
}
76
function
createNewVersion
() {
77
$this->obj->setVersion($this->obj->getVersion() + 1);
78
ilHistory::_createEntry
($this->obj->getId(),
"replace"
,
79
$this->obj->getFileName().
","
.$this->obj->getVersion());
80
}
81
82
101
function
getResourceType
()
102
{
103
return
""
;
104
}
105
110
function
getContentType
()
111
{
112
//return $this->obj->getFileType();
113
return
$this->obj->guessFileType();
114
}
119
function
setContentType
($type)
120
{
121
$this->obj->setFileType($type);
122
}
127
function
setContentLength
($length)
128
{
129
$this->writeLog(
'setContentLength('
.$length.
')'
);
130
$this->obj->setFileSize($length);
131
}
136
function
getContentLength
()
137
{
138
return
ilObjFile::_lookupFileSize
($this->obj->getId());
139
}
144
function
getContentStream
()
145
{
146
$file
= $this->obj->getFile();
147
return
(file_exists(
$file
)) ? fopen(
$file
,
'r'
) :
null
;
148
}
153
function
getContentOutputStream
()
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
}
173
function
getContentOutputStreamLength
()
174
{
175
$file
= $this->obj->getFile();
176
return
file_exists(
$file
) ? filesize(
$file
) : 0;
177
178
}
184
function
getContentData
()
185
{
186
return
null
;
187
}
192
function
read
()
193
{
194
if
(is_null($this->obj))
195
{
196
$this->obj = &
new
ilObjFile
($this->
getRefId
(),
true
);
197
$this->obj->read();
198
}
199
}
204
function
write
()
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
}
216
}
217
// END WebDAV
218
?>
$file
print $file
Definition:
HFile_ueconv.php:128
ilHistory\_createEntry
_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.
Definition:
class.ilHistory.php:31
ilObjFileDAV
Definition:
class.ilObjFileDAV.php:44
ilObjFileDAV\getContentData
getContentData()
Returns the content of the object as a byte array.
Definition:
class.ilObjFileDAV.php:184
ilObjFileDAV\setContentType
setContentType($type)
Sets the mime type of the content of this object.
Definition:
class.ilObjFileDAV.php:119
ilObjFileDAV\getContentOutputStreamLength
getContentOutputStreamLength()
Returns the length of the content output stream.
Definition:
class.ilObjFileDAV.php:173
ilObjFileDAV\initFromNull
initFromNull()
Initializes the object after it has been converted from the NULL type.
Definition:
class.ilObjFileDAV.php:65
ilObjFileDAV\createNewVersion
createNewVersion()
Creates a new version of the object.
Definition:
class.ilObjFileDAV.php:76
ilObjFileDAV\write
write()
Writes the object data.
Definition:
class.ilObjFileDAV.php:204
ilObjFileDAV\getContentType
getContentType()
Returns the mime type of the content of this object.
Definition:
class.ilObjFileDAV.php:110
ilObjFileDAV\getContentStream
getContentStream()
Definition:
class.ilObjFileDAV.php:144
ilObjFileDAV\getContentLength
getContentLength()
Returns the number of bytes of the content.
Definition:
class.ilObjFileDAV.php:136
ilObjFileDAV\getResourceType
getResourceType()
Returns the display name of this object.
Definition:
class.ilObjFileDAV.php:101
ilObjFileDAV\ilObjFileDAV
ilObjFileDAV($refid, $obj=null)
Constructor.
Definition:
class.ilObjFileDAV.php:50
ilObjFileDAV\getContentOutputStream
getContentOutputStream()
Definition:
class.ilObjFileDAV.php:153
ilObjFileDAV\read
read()
Reads the object data.
Definition:
class.ilObjFileDAV.php:192
ilObjFileDAV\setContentLength
setContentLength($length)
Definition:
class.ilObjFileDAV.php:127
ilObjFile
Class ilObjFile.
Definition:
class.ilObjFile.php:16
ilObjFile\_lookupFileSize
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
Definition:
class.ilObjFile.php:605
ilObjectDAV
Definition:
class.ilObjectDAV.php:37
ilObjectDAV\$obj
$obj
Application layer object.
Definition:
class.ilObjectDAV.php:46
ilObjectDAV\ilObjectDAV
ilObjectDAV($refId, $obj=null)
Constructor.
Definition:
class.ilObjectDAV.php:59
ilObjectDAV\getRefId
getRefId()
Returns the ref id of this object.
Definition:
class.ilObjectDAV.php:74
ilObjectDAV\getResourceName
getResourceName()
Returns the resource name of this object.
Definition:
class.ilObjectDAV.php:142
ilUtil\makeDirParents
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Definition:
class.ilUtil.php:2482
Services
WebDAV
classes
class.ilObjFileDAV.php
Generated on Wed Sep 24 2025 19:01:06 for ILIAS by
1.9.4 (using
Doxyfile
)