ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapFileAdministration Class Reference
+ Inheritance diagram for ilSoapFileAdministration:
+ Collaboration diagram for ilSoapFileAdministration:

Public Member Functions

 ilSoapFileAdministration ()
 addFile ($sid, $target_id, $file_xml)
 add an File with id.
 updateFile ($sid, $ref_id, $file_xml)
 update a File with id.
 getFileXML ($sid, $ref_id, $attachFileContentsMode)
 get File xml
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 __checkSession ($sid)
 initErrorWriter ()
 Overwrite error handler.
 __explodeSid ($sid)
 __setMessage ($a_str)
 __getMessage ()
 __appendMessage ($a_str)
 __setMessageCode ($a_code)
 __getMessageCode ()
 initAuth ($sid)
 initIlias ()
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 __raiseError ($a_message, $a_code)
 getNIC ($sid)
 get client information from current as xml result set
 isFault ($object)
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true
 getInstallationInfoXML ()
 getClientInfoXML ($clientid)

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true

Detailed Description

Definition at line 35 of file class.ilSoapFileAdministration.php.

Member Function Documentation

ilSoapFileAdministration::addFile (   $sid,
  $target_id,
  $file_xml 
)

add an File with id.

Parameters
string$session_idcurrent session
int$target_idrefid of parent in repository
string$file_xmlqti xml description of test
Returns
int reference id in the tree, 0 if not successful

Definition at line 51 of file class.ilSoapFileAdministration.php.

References $file, ilFileException\$ID_MISMATCH, $ilLog, $target_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
{
return $this->__raiseError('No valid target given.', 'Client');
}
{
return $this->__raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_TARGET_DELETED');
}
// Check access
$allowed_types = array('cat','grp','crs','fold');
if(!in_array($target_obj->getType(), $allowed_types))
{
return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"', 'Client');
}
if(!$rbacsystem->checkAccess('create',$target_id,"file"))
{
return $this->__raiseError('No permission to create Files in target '.$target_id.'!', 'Client');
}
// create object, put it into the tree and use the parser to update the settings
include_once './Modules/File/classes/class.ilFileXMLParser.php';
include_once './Modules/File/classes/class.ilFileException.php';
include_once './Modules/File/classes/class.ilObjFile.php';
$file = new ilObjFile();
try
{
$fileXMLParser = new ilFileXMLParser($file, $file_xml);
if ($fileXMLParser->start())
{
global $ilLog;
$ilLog->write(__METHOD__.': File type: '.$file->getFileType());
$file->create();
$file->createReference();
$file->putInTree($target_id);
$file->setPermissions($target_id);
// we now can save the file contents since we know the obj id now.
$fileXMLParser->setFileContents();
#$file->update();
return $file->getRefId();
}
else
{
return $this->__raiseError("Could not add file", "Server");
}
}
catch(ilFileException $exception) {
return $this->__raiseError($exception->getMessage(), $exception->getCode() == ilFileException::$ID_MISMATCH ? "Client" : "Server");
}
}

+ Here is the call graph for this function:

ilSoapFileAdministration::getFileXML (   $sid,
  $ref_id,
  $attachFileContentsMode 
)

get File xml

Parameters
string$sid
int$ref_id
boolean$attachFileContentsMode
Returns
xml following ilias_file_x.dtd

Definition at line 213 of file class.ilSoapFileAdministration.php.

References $file, $ilLog, $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($ref_id))
{
return $this->__raiseError('No ref id given. Aborting!',
'Client');
}
global $rbacsystem, $tree, $ilLog;
// get obj_id
{
return $this->__raiseError('No File found for id: '.$ref_id,
'Client');
}
{
return $this->__raiseError("Object with ID $ref_id has been deleted.", 'Client');
}
// Check access
$permission_ok = false;
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if($rbacsystem->checkAccess('read',$ref_id))
{
$permission_ok = true;
break;
}
}
if(!$permission_ok)
{
return $this->__raiseError('No permission to edit the object with id: '.$ref_id,
'Server');
}
if (!is_object($file) || $file->getType()!= "file")
{
return $this->__raiseError('Wrong obj id or type for File with id '.$ref_id,
'Server');
}
// store into xml result set
include_once './Modules/File/classes/class.ilFileXMLWriter.php';
// create writer
$xmlWriter = new ilFileXMLWriter();
$xmlWriter->setFile($file);
$xmlWriter->setAttachFileContents($attachFileContentsMode);
$xmlWriter->start();
return $xmlWriter->getXML();
}

+ Here is the call graph for this function:

ilSoapFileAdministration::ilSoapFileAdministration ( )

Definition at line 37 of file class.ilSoapFileAdministration.php.

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

ilSoapFileAdministration::updateFile (   $sid,
  $ref_id,
  $file_xml 
)

update a File with id.

Parameters
string$session_idcurrent session
int$ref_idrefid id of File in repository
string$file_xmlqti xml description of test
Returns
boolean true, if update successful, false otherwise

Definition at line 133 of file class.ilSoapFileAdministration.php.

References $file, ilFileException\$ID_MISMATCH, $ilLog, $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
{
return $this->__raiseError('Cannot perform update since file has been deleted.', 'CLIENT_OBJECT_DELETED');
}
// get obj_id
{
return $this->__raiseError('No File found for id: '.$ref_id,
'Client');
}
// Check access
$permission_ok = false;
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if($rbacsystem->checkAccess('edit',$ref_id))
{
$permission_ok = true;
break;
}
}
if(!$permission_ok)
{
return $this->__raiseError('No permission to edit the File with id: '.$ref_id,
'Server');
}
if (!is_object($file) || $file->getType()!= "file")
{
return $this->__raiseError('Wrong obj id or type for File with id '.$ref_id,
'Server');
}
include_once './Modules/File/classes/class.ilFileXMLParser.php';
include_once './Modules/File/classes/class.ilFileException.php';
$fileXMLParser = new ilFileXMLParser($file, $file_xml, $obj_id);
try
{
if ($fileXMLParser->start())
{
$fileXMLParser->updateFileContents();
return $file->update();
}
}
catch(ilFileException $exception)
{
return $this->__raiseError($exception->getMessage(),
$exception->getCode() == ilFileException::$ID_MISMATCH ? "Client" : "Server");
}
return false;
}

+ Here is the call graph for this function:


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