33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
56 if(!$this->__checkSession($sid))
60 global $rbacsystem, $tree,
$ilLog, $ilAccess;
64 return $this->
__raiseError(
'No valid target given.',
'Client');
70 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
74 $allowed_types = array(
'cat',
'grp',
'crs',
'fold',
'root');
75 if(!in_array($target_obj->getType(), $allowed_types))
77 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
80 if(!$ilAccess->checkAccess(
'create',
'',
$target_id,
"file"))
86 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
87 include_once
'./Modules/File/classes/class.ilFileException.php';
88 include_once
'./Modules/File/classes/class.ilObjFile.php';
96 if ($fileXMLParser->start())
100 $ilLog->write(__METHOD__.
': File type: '.
$file->getFileType());
103 $file->createReference();
108 $fileXMLParser->setFileContents();
111 return $file->getRefId();
115 return $this->
__raiseError(
"Could not add file",
"Server");
138 if(!$this->__checkSession($sid))
142 global $rbacsystem, $tree,
$ilLog, $ilAccess;
146 return $this->
__raiseError(
'Cannot perform update since file has been deleted.',
'CLIENT_OBJECT_DELETED');
156 $permission_ok =
false;
159 if($ilAccess->checkAccess(
'write',
'',$ref_id))
161 $permission_ok =
true;
168 return $this->
__raiseError(
'No permission to edit the File with id: '.$ref_id,
175 if (!is_object(
$file) ||
$file->getType()!=
"file")
177 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
181 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
182 include_once
'./Modules/File/classes/class.ilFileException.php';
188 if ($fileXMLParser->start())
190 $fileXMLParser->updateFileContents();
192 return $file->update();
218 if(!$this->__checkSession($sid))
224 return $this->
__raiseError(
'No ref id given. Aborting!',
227 global $rbacsystem, $tree,
$ilLog, $ilAccess;
239 return $this->
__raiseError(
"Object with ID $ref_id has been deleted.",
'Client');
243 $permission_ok =
false;
246 if($ilAccess->checkAccess(
'read',
'',$ref_id))
248 $permission_ok =
true;
255 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
261 if (!is_object(
$file) ||
$file->getType()!=
"file")
263 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
267 include_once
'./Modules/File/classes/class.ilFileXMLWriter.php';
271 $xmlWriter->setFile(
$file);
272 $xmlWriter->setAttachFileContents($attachFileContentsMode);
275 return $xmlWriter->getXML();