33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
55 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
57 include_once
'./include/inc.header.php';
58 global $rbacsystem, $tree,
$ilLog;
62 return $this->
__raiseError(
'No valid target given.',
'Client');
68 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
72 $allowed_types = array(
'cat',
'grp',
'crs',
'fold');
73 if(!in_array($target_obj->getType(), $allowed_types))
75 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
78 if(!$rbacsystem->checkAccess(
'create',
$target_id,
"file"))
84 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
85 include_once
'./Modules/File/classes/class.ilFileException.php';
86 include_once
'./Modules/File/classes/class.ilObjFile.php';
94 if ($fileXMLParser->start())
98 $ilLog->write(__METHOD__.
': File type: '.
$file->getFileType());
101 $file->createReference();
106 $fileXMLParser->setFileContents();
109 return $file->getRefId();
113 return $this->
__raiseError(
"Could not add file",
"Server");
134 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
136 include_once
'./include/inc.header.php';
137 global $rbacsystem, $tree,
$ilLog;
141 return $this->
__raiseError(
'Cannot perform update since file has been deleted.',
'CLIENT_OBJECT_DELETED');
151 $permission_ok =
false;
154 if($rbacsystem->checkAccess(
'edit',$ref_id))
156 $permission_ok =
true;
163 return $this->
__raiseError(
'No permission to edit the File with id: '.$ref_id,
170 if (!is_object(
$file) ||
$file->getType()!=
"file")
172 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
176 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
177 include_once
'./Modules/File/classes/class.ilFileException.php';
183 if ($fileXMLParser->start())
185 $fileXMLParser->updateFileContents();
187 return $file->update();
211 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
215 return $this->
__raiseError(
'No ref id given. Aborting!',
218 include_once
'./include/inc.header.php';
219 global $rbacsystem, $tree,
$ilLog;
231 return $this->
__raiseError(
"Object with ID $ref_id has been deleted.",
'Client');
235 $permission_ok =
false;
238 if($rbacsystem->checkAccess(
'read',$ref_id))
240 $permission_ok =
true;
247 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
253 if (!is_object(
$file) ||
$file->getType()!=
"file")
255 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
259 include_once
'./Modules/File/classes/class.ilFileXMLWriter.php';
263 $xmlWriter->setFile(
$file);
264 $xmlWriter->setAttachFileContents($attachFileContentsMode);
267 return $xmlWriter->getXML();