33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
52 if(!$this->__checkSession($sid))
56 global $rbacsystem, $tree,
$ilLog, $ilAccess;
60 return $this->
__raiseError(
'No valid target given.',
'Client');
66 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
70 $allowed_types =
array(
'cat',
'grp',
'crs',
'fold',
'root');
71 if(!in_array($target_obj->getType(), $allowed_types))
73 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
76 if(!$ilAccess->checkAccess(
'create',
'',
$target_id,
"file"))
82 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
83 include_once
'./Modules/File/classes/class.ilFileException.php';
84 include_once
'./Modules/File/classes/class.ilObjFile.php';
92 if ($fileXMLParser->start())
96 $ilLog->write(__METHOD__.
': File type: '.
$file->getFileType());
99 $file->createReference();
104 $fileXMLParser->setFileContents();
107 return $file->getRefId();
111 return $this->
__raiseError(
"Could not add file",
"Server");
134 if(!$this->__checkSession($sid))
138 global $rbacsystem, $tree,
$ilLog, $ilAccess;
142 return $this->
__raiseError(
'Cannot perform update since file has been deleted.',
'CLIENT_OBJECT_DELETED');
152 $permission_ok =
false;
155 if($ilAccess->checkAccess(
'write',
'',$ref_id))
157 $permission_ok =
true;
164 return $this->
__raiseError(
'No permission to edit the File with id: '.$ref_id,
171 if (!is_object(
$file) ||
$file->getType()!=
"file")
173 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
177 include_once
'./Modules/File/classes/class.ilFileXMLParser.php';
178 include_once
'./Modules/File/classes/class.ilFileException.php';
184 if ($fileXMLParser->start())
187 $fileXMLParser->updateFileContents();
189 return $file->update();
215 if(!$this->__checkSession($sid))
221 return $this->
__raiseError(
'No ref id given. Aborting!',
224 global $rbacsystem, $tree,
$ilLog, $ilAccess;
236 return $this->
__raiseError(
"Object with ID $ref_id has been deleted.",
'Client');
240 $permission_ok =
false;
243 if($ilAccess->checkAccess(
'read',
'',$ref_id))
245 $permission_ok =
true;
252 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
258 if (!is_object(
$file) ||
$file->getType()!=
"file")
260 return $this->
__raiseError(
'Wrong obj id or type for File with id '.$ref_id,
264 include_once
'./Modules/File/classes/class.ilFileXMLWriter.php';
268 $xmlWriter->setFile(
$file);
269 $xmlWriter->setAttachFileContents($attachFileContentsMode);
272 return $xmlWriter->getXML();
addFile($sid, $target_id, $file_xml)
add an File with id.
static _isInTrash($a_ref_id)
checks wether object is in trash
Exercise XML Parser which completes/updates a given file by an xml string.
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjectId($a_ref_id)
lookup object id
updateFile($sid, $ref_id, $file_xml)
update a File with id.
__raiseError($a_message, $a_code)
Class to report exception.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
getFileXML($sid, $ref_id, $attachFileContentsMode)
get File xml
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file