ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapUtils Class Reference
+ Inheritance diagram for ilSoapUtils:
+ Collaboration diagram for ilSoapUtils:

Public Member Functions

 ilSoapUtils ()
 ignoreUserAbort ()
 disableSOAPCheck ()
 sendMail ($sid, $to, $cc, $bcc, $sender, $subject, $message, $attach)
 saveTempFileAsMediaObject ($sid, $name, $tmp_name)
 getMobsOfObject ($sid, $a_type, $a_id)
 ilCloneDependencies ($sid, $copy_identifier)
 clone object dependencies (e.g.
 ilClone ($sid, $copy_identifier)
 Clone object.
 handleECSTasks ($sid)
- 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)
 __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)

Static Public Member Functions

static validateXML ($xml)
 validates an xml file, if dtd is attached
- 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

Private Member Functions

 callNextNode ($sid, $cp_options)
 Call next node using soap.
 callNextDependency ($sid, $cp_options)
 cloneNode ($node, $cp_options)
 Clone node.
 cloneDependencies ($node, $cp_options)
 cloneDependencies
 linkNode ($node, $cp_options)
 Link node.

Additional Inherited Members

- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null

Detailed Description

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

Member Function Documentation

ilSoapUtils::callNextDependency (   $sid,
  $cp_options 
)
private

Definition at line 306 of file class.ilSoapUtils.php.

References $ilLog, $res, and ilCloneDependencies().

Referenced by ilCloneDependencies().

{
global $ilLog;
$cp_options->dropFirstDependenciesNode();
if($cp_options->isSOAPEnabled())
{
// Start next soap call
include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
$soap_client = new ilSoapClient();
$soap_client->setTimeout(1);
$soap_client->setResponseTimeout(1);
$soap_client->enableWSDL(true);
$soap_client->init();
$soap_client->call('ilCloneDependencies',array($sid,$cp_options->getCopyId()));
}
else
{
$ilLog->write(__METHOD__.': Cannot call SOAP server');
$cp_options->read();
include_once('./webservice/soap/include/inc.soap_functions.php');
$res = ilSoapFunctions::ilCloneDependencies($sid,$cp_options->getCopyId());
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::callNextNode (   $sid,
  $cp_options 
)
private

Call next node using soap.

Parameters
objectcopx wizard options instance private

Definition at line 279 of file class.ilSoapUtils.php.

References $ilLog, $res, and ilClone().

Referenced by ilClone().

{
global $ilLog;
$cp_options->dropFirstNode();
if($cp_options->isSOAPEnabled())
{
// Start next soap call
include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
$soap_client = new ilSoapClient();
$soap_client->setTimeout(1);
$soap_client->setResponseTimeout(1);
$soap_client->enableWSDL(true);
$soap_client->init();
$soap_client->call('ilClone',array($sid,$cp_options->getCopyId()));
}
else
{
$ilLog->write(__METHOD__.': Cannot call SOAP server');
$cp_options->read();
include_once('./webservice/soap/include/inc.soap_functions.php');
$res = ilSoapFunctions::ilClone($sid,$cp_options->getCopyId());
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::cloneDependencies (   $node,
  $cp_options 
)
private

cloneDependencies

private

Parameters

Definition at line 391 of file class.ilSoapUtils.php.

References $ilLog, $target_id, and ilObjectFactory\getInstanceByRefId().

Referenced by ilCloneDependencies().

{
global $ilLog;
$source_id = $node['child'];
$mappings = $cp_options->getMappings();
if(!isset($mappings[$source_id]))
{
$ilLog->write(__METHOD__.': Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No mapping found.');
return true;
}
$target_id = $mappings[$source_id];
$orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
$orig->cloneDependencies($target_id,$cp_options->getCopyId());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::cloneNode (   $node,
  $cp_options 
)
private

Clone node.

private

Parameters

Definition at line 340 of file class.ilSoapUtils.php.

References $ilLog, $target_id, and ilObjectFactory\getInstanceByRefId().

Referenced by ilClone().

{
global $ilLog,$tree,$ilAccess;
#sleep(20);
$source_id = $node['child'];
$parent_id = $node['parent'];
$options = $cp_options->getOptions($node['child']);
$mappings = $cp_options->getMappings();
if(!$ilAccess->checkAccess('copy','',$node['child']))
{
$ilLog->write(__METHOD__.': No copy permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
return false;
}
if(!isset($mappings[$parent_id]))
{
$ilLog->write(__METHOD__.': Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
return true;
}
$target_id = $mappings[$parent_id];
if(!$tree->isInTree($target_id))
{
$ilLog->write(__METHOD__.': Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. Object has been deleted.');
return false;
}
$orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
$new_obj = $orig->cloneObject((int) $target_id,$cp_options->getCopyId());
if(!is_object($new_obj))
{
$ilLog->write(__METHOD__.': Error copying '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
return false;
}
// Finally add new mapping entry
$cp_options->appendMapping($source_id,$new_obj->getRefId());
return $new_obj->getRefId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::disableSOAPCheck ( )

Definition at line 47 of file class.ilSoapUtils.php.

{
$this->sauth->disableSOAPCheck();
}
ilSoapUtils::getMobsOfObject (   $sid,
  $a_type,
  $a_id 
)

Definition at line 121 of file class.ilSoapUtils.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), and ilObjMediaObject\_getMobsOfObject().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
return ilObjMediaObject::_getMobsOfObject($a_type, $a_id);
}

+ Here is the call graph for this function:

ilSoapUtils::handleECSTasks (   $sid)

Definition at line 486 of file class.ilSoapUtils.php.

References $ilLog, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), and ilECSTaskScheduler\_getInstance().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
global $ilLog;
$ilLog->write(__METHOD__.': Starting task execution...');
$scheduler->startTaskExecution();
return true;
}

+ Here is the call graph for this function:

ilSoapUtils::ignoreUserAbort ( )

Definition at line 42 of file class.ilSoapUtils.php.

{
ignore_user_abort();
}
ilSoapUtils::ilClone (   $sid,
  $copy_identifier 
)

Clone object.

public

Parameters
stringsoap session id
intcopy identifier (ilCopyWizarardOptions)

Definition at line 209 of file class.ilSoapUtils.php.

References $ilLog, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), ilCopyWizardOptions\_getInstance(), callNextNode(), cloneNode(), ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilCopyWizardOptions\COPY_WIZARD_OMIT, ilCloneDependencies(), and linkNode().

Referenced by callNextNode().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
global $ilLog,$ilUser;
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
// Check owner of copy procedure
if(!$cp_options->checkOwner($ilUser->getId()))
{
$ilLog->write(__METHOD__.': Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
return false;
}
// Fetch first node
if(($node = $cp_options->fetchFirstNode()) === false)
{
$ilLog->write(__METHOD__.': Finished copy step 1. Starting copying of object dependencies...');
return $this->ilCloneDependencies($sid,$copy_identifier);
}
// Check options of this node
$options = $cp_options->getOptions($node['child']);
$new_ref_id = 0;
switch($options['type'])
{
$ilLog->write(__METHOD__.': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
// set mapping to zero
$cp_options->appendMapping($node['child'],0);
$this->callNextNode($sid,$cp_options);
break;
$ilLog->write(__METHOD__.': Start cloning node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$new_ref_id = $this->cloneNode($node,$cp_options);
$this->callNextNode($sid,$cp_options);
break;
$ilLog->write(__METHOD__.': Start linking node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$new_ref_id = $this->linkNode($node,$cp_options);
$this->callNextNode($sid,$cp_options);
break;
default:
$ilLog->write(__METHOD__.': No valid action type given for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$this->callNextNode($sid,$cp_options);
break;
}
return $new_ref_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::ilCloneDependencies (   $sid,
  $copy_identifier 
)

clone object dependencies (e.g.

course start objects, preconditions ...)

public

Parameters

Definition at line 141 of file class.ilSoapUtils.php.

References $ilLog, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), ilCopyWizardOptions\_getInstance(), callNextDependency(), cloneDependencies(), ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, and ilCopyWizardOptions\COPY_WIZARD_OMIT.

Referenced by callNextDependency(), and ilClone().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
global $ilLog,$ilUser;
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$cp_options = ilCopyWizardOptions::_getInstance($copy_identifier);
// Check owner of copy procedure
if(!$cp_options->checkOwner($ilUser->getId()))
{
$ilLog->write(__METHOD__.': Permission check failed for user id: '.$ilUser->getId().', copy id: '.$copy_identifier);
return false;
}
// Fetch first node
if(($node = $cp_options->fetchFirstDependenciesNode()) === false)
{
$cp_options->deleteAll();
$ilLog->write(__METHOD__.': Finished copy step 2. Copy completed');
return true;
}
// Check options of this node
$options = $cp_options->getOptions($node['child']);
$new_ref_id = 0;
switch($options['type'])
{
$ilLog->write(__METHOD__.': Omitting node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$this->callNextDependency($sid,$cp_options);
break;
$ilLog->write(__METHOD__.': Nothing to do for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$this->callNextDependency($sid,$cp_options);
break;
$ilLog->write(__METHOD__.': Start cloning dependencies: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$this->cloneDependencies($node,$cp_options);
$this->callNextDependency($sid,$cp_options);
break;
default:
$ilLog->write(__METHOD__.': No valid action type given for node: '.$node['obj_id'].', '.$node['title'].', '.$node['type']);
$this->callNextDependency($sid,$cp_options);
break;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::ilSoapUtils ( )

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

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

ilSoapUtils::linkNode (   $node,
  $cp_options 
)
private

Link node.

private

Parameters

Definition at line 417 of file class.ilSoapUtils.php.

References $ilLog, $target_id, and ilObjectFactory\getInstanceByRefId().

Referenced by ilClone().

{
global $ilLog,$ilAccess;
$source_id = $node['child'];
$parent_id = $node['parent'];
$options = $cp_options->getOptions($node['child']);
$mappings = $cp_options->getMappings();
if(!$ilAccess->checkAccess('write','',$node['child']))
{
$ilLog->write(__METHOD__.': No write permission granted: '.$source_id.', '.$node['title'].', '.$node['type']);
return false;
}
if(!isset($mappings[$parent_id]))
{
$ilLog->write(__METHOD__.': Omitting node '.$source_id.', '.$node['title'].', '.$node['type']. '. No target found.');
return true;
}
$target_id = $mappings[$parent_id];
$orig = ilObjectFactory::getInstanceByRefId((int) $source_id);
$new_ref_id = $orig->createReference();
$orig->putInTree($target_id);
$orig->setPermissions($target_id);
$orig->setRefId($new_ref_id);
$orig->initDefaultRoles();
if(!($new_ref_id))
{
$ilLog->write(__METHOD__.': Error linking '.$source_id.', '.$node['title'].', '.$node['type'].'. No target found.');
return false;
}
// Finally add new mapping entry
$cp_options->appendMapping($source_id,$new_ref_id);
return $new_ref_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapUtils::saveTempFileAsMediaObject (   $sid,
  $name,
  $tmp_name 
)

Definition at line 108 of file class.ilSoapUtils.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), and ilObjMediaObject\_saveTempFileAsMediaObject().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
}

+ Here is the call graph for this function:

ilSoapUtils::sendMail (   $sid,
  $to,
  $cc,
  $bcc,
  $sender,
  $subject,
  $message,
  $attach 
)

Definition at line 52 of file class.ilSoapUtils.php.

References $ilLog, ilSoapAdministration\__checkSession(), and ilSoapAdministration\__raiseError().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once './include/inc.header.php';
global $ilLog;
include_once 'Services/Mail/classes/class.ilMimeMail.php';
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($sender);
$mmail->To(explode(',',$to));
$mmail->Subject($subject);
$mmail->Body($message);
if($cc)
{
$mmail->Cc(explode(',',$cc));
}
if($bcc)
{
$mmail->Bcc(explode(',',$bcc));
}
if($attach)
{
// mjansen: switched separator from "," to "#:#" because of mantis bug #6039
// for backward compatibility we have to check if the substring "#:#" exists as leading separator
// otherwise we should use ";"
if(strpos($attach, '#:#') === 0)
{
$attach = substr($attach, strlen('#:#'));
$attachments = explode('#:#', $attach);
}
else
{
$attachments = explode(',', $attach);
}
foreach ($attachments as $attachment)
{
$mmail->Attach($attachment);
}
}
$mmail->Send();
$ilLog->write('SOAP: sendMail(): '.$to.', '.$cc.', '.$bcc);
return true;
}

+ Here is the call graph for this function:

static ilSoapUtils::validateXML (   $xml)
static

validates an xml file, if dtd is attached

Parameters
$xmlcurrent xml stream
Returns
true, if correct, or String with error messages

Definition at line 464 of file class.ilSoapUtils.php.

References domxml_open_mem().

{
// validate to prevent wrong XMLs
$dom = @domxml_open_mem($xml, DOMXML_LOAD_VALIDATING, $error);
if ($error)
{
$msg = array();
if (is_array($error))
{
foreach ($error as $err) {
$msg []= "(".$err["line"].",".$err["col"]."): ".$err["errormessage"];
}
}
else
{
$msg[] = $error;
}
$msg = join("\n",$msg);
return $msg;
}
return true;
}

+ Here is the call graph for this function:


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