本文整理汇总了PHP中ilSession::_duplicate方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSession::_duplicate方法的具体用法?PHP ilSession::_duplicate怎么用?PHP ilSession::_duplicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSession
的用法示例。
在下文中一共展示了ilSession::_duplicate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasicSessionBehaviour
/**
* @group IL_Init
*/
public function testBasicSessionBehaviour()
{
global $ilUser;
include_once "./Services/Authentication/classes/class.ilSession.php";
$result = "";
ilSession::_writeData("123456", "Testdata");
if (ilSession::_exists("123456")) {
$result .= "exists-";
}
if (ilSession::_getData("123456") == "Testdata") {
$result .= "write-get-";
}
$duplicate = ilSession::_duplicate("123456");
if (ilSession::_getData($duplicate) == "Testdata") {
$result .= "duplicate-";
}
ilSession::_destroy("123456");
if (!ilSession::_exists("123456")) {
$result .= "destroy-";
}
ilSession::_destroyExpiredSessions();
if (ilSession::_exists($duplicate)) {
$result .= "destroyExp-";
}
ilSession::_destroyByUserId($ilUser->getId());
if (!ilSession::_exists($duplicate)) {
$result .= "destroyByUser-";
}
$this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
}
示例2: initNextExecution
/**
* Call next task scheduler run
*/
protected function initNextExecution()
{
global $ilLog;
// Start task execution as backend process
include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
$soap_client = new ilSoapClient();
$soap_client->setResponseTimeout(1);
$soap_client->enableWSDL(true);
$ilLog->write(__METHOD__ . ': Trying to call Soap client...');
$new_session_id = ilSession::_duplicate($_COOKIE['PHPSESSID']);
$client_id = $_COOKIE['ilClientId'];
if ($soap_client->init() and 0) {
$ilLog->write(__METHOD__ . ': Calling soap handleECSTasks method...');
$res = $soap_client->call('handleECSTasks', array($new_session_id . '::' . $client_id, $this->settings->getServerId()));
} else {
$ilLog->write(__METHOD__ . ': SOAP call failed. Calling clone method manually. ');
include_once './webservice/soap/include/inc.soap_functions.php';
$res = ilSoapFunctions::handleECSTasks($new_session_id . '::' . $client_id, $this->settings->getServerId());
}
}
示例3: cloneAllObject
/**
* clone all objects according to this container
*
* @param string $session_id
* @param string $client_id
* @param string $new_type
* @param int $ref_id
* @param int $clone_source
* @param array $options
* @return new refid if clone has finished or parameter ref id if cloning is still in progress
*/
public function cloneAllObject($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call = false)
{
global $ilLog;
include_once './Services/Link/classes/class.ilLink.php';
include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
global $ilAccess, $ilErr, $rbacsystem, $tree, $ilUser;
// Save wizard options
$copy_id = ilCopyWizardOptions::_allocateCopyId();
$wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
$wizard_options->saveOwner($ilUser->getId());
$wizard_options->saveRoot($clone_source);
// add entry for source container
$wizard_options->initContainer($clone_source, $ref_id);
foreach ($options as $source_id => $option) {
$wizard_options->addEntry($source_id, $option);
}
$wizard_options->read();
$wizard_options->storeTree($clone_source);
// Special handling for course in existing courses
if ($new_type == 'crs' and ilObject::_lookupType(ilObject::_lookupObjId($ref_id)) == 'crs') {
$ilLog->write(__METHOD__ . ': Copy course in course...');
$ilLog->write(__METHOD__ . ': Added mapping, source ID: ' . $clone_source . ', target ID: ' . $ref_id);
$wizard_options->read();
$wizard_options->dropFirstNode();
$wizard_options->appendMapping($clone_source, $ref_id);
}
#print_r($options);
// Duplicate session to avoid logout problems with backgrounded SOAP calls
$new_session_id = ilSession::_duplicate($session_id);
// Start cloning process using soap call
include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
$soap_client = new ilSoapClient();
$soap_client->setResponseTimeout(30);
$soap_client->enableWSDL(true);
$ilLog->write(__METHOD__ . ': Trying to call Soap client...');
if ($soap_client->init()) {
$ilLog->write(__METHOD__ . ': Calling soap clone method...');
$res = $soap_client->call('ilClone', array($new_session_id . '::' . $client_id, $copy_id));
} else {
$ilLog->write(__METHOD__ . ': SOAP call failed. Calling clone method manually. ');
$wizard_options->disableSOAP();
$wizard_options->read();
include_once './webservice/soap/include/inc.soap_functions.php';
$res = ilSoapFunctions::ilClone($new_session_id . '::' . $client_id, $copy_id);
}
// Check if copy is in progress or if this has been called by soap (don't wait for finishing)
if ($soap_call || ilCopyWizardOptions::_isFinished($copy_id)) {
return $res;
} else {
return $ref_id;
}
}