63 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
64 $this->settings = $setting;
81 if(self::$instances[$a_server_id])
83 return self::$instances[$a_server_id];
85 return self::$instances[$a_server_id] =
96 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
98 foreach($servers->getServers() as
$server)
101 if($sched->checkNextExecution())
103 $sched->initNextExecution();
113 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
118 $sched->startTaskExecution();
153 $this->log->write(__METHOD__.
': Caught exception: '.$exc->getMessage());
169 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
171 $this->event_reader->refresh();
187 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
191 if(!$event = $this->event_reader->shift())
193 $this->log->write(__METHOD__.
': No more pending events found. DONE');
199 $this->log->write(__METHOD__.
': Handling delete. DONE');
205 $this->log->write(__METHOD__.
': Handling new creation. DONE');
213 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
220 $this->log->write(__METHOD__.
': Cannot read Econtent. '.$e->getMessage());
226 $this->log->write(__METHOD__.
': Handling delete of deprecated remote courses. DONE');
231 $this->log->write(__METHOD__.
': Handling update. DONE');
240 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
241 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
242 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
243 include_once(
'./Services/WebServices/ECS/classes/class.ilECSReaderException.php');
244 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriter.php');
245 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php');
249 $econtent_id = $export->getEContentId();
257 $econtent =
$reader->getEContent();
258 $details =
$reader->getEContentDetails();
264 $ilLog->write(__METHOD__.
': Cannot create object instance. Aborting...');
269 $writer->setExportable(
false);
270 $writer->setOwnerId($details->getFirstSender());
271 $writer->setParticipantIds($details->getReceivers());
275 $writer->setExportable(
true);
284 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e1->getMessage());
289 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e2->getMessage());
294 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e2->getMessage());
310 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
320 $GLOBALS[
'ilLog']->write(__METHOD__.
': Received obj_ids '.print_r($obj_ids,
true));
321 foreach($obj_ids as $obj_id)
324 foreach($references as
$ref_id)
328 $this->log->write(__METHOD__.
': Deleting obsolete remote course: '.$tmp_obj->getTitle());
330 $tree->deleteTree($tree->getNodeData($ref_id));
349 $GLOBALS[
'ilLog']->write(__METHOD__.
': Receivers are '. print_r($details->
getReceivers(),
true));
351 include_once(
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
354 $ilLog->write(
'Ignoring disabled participant. MID: '.$content->
getOwner());
358 include_once(
'Services/WebServices/ECS/classes/class.ilECSImport.php');
361 #foreach($this->mids as $mid)
362 foreach(array_intersect($this->mids,$details->
getReceivers()) as $mid)
367 $ilLog->write(__METHOD__.
': Handling update for existing object');
369 if($remote->getType() !=
'rcrs')
371 $this->log->write(__METHOD__.
': Cannot instantiate remote course. Got object type '.$remote->getType());
374 $remote->updateFromECSContent($this->
getServer()->getServerId(),$content);
378 $ilLog->write(__METHOD__.
': Handling create for non existing object');
379 include_once(
'./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
403 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' ".
404 "AND time_limit_until < ".time().
" ".
405 "AND time_limit_unlimited = 0 ".
406 "AND (time_limit_until - time_limit_from) < 7200";
412 $this->log->write(__METHOD__.
': Deleting deprecated ECS user account '.$user_obj->getLogin());
431 $this->mids = array();
433 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
435 foreach(
$reader->getCommunities() as $com)
437 foreach($com->getParticipants() as $part)
441 $this->mids[] = $part->getMID();
442 $this->log->write(
'Fetch MID: '.$part->getMID());
465 if(!$this->settings->isEnabled())
470 if(!$this->settings->checkImportId())
472 $this->log->write(__METHOD__.
': Import ID is deleted or not of type "category". Aborting');
479 $query =
'UPDATE settings SET '.
480 'value = '.$ilDB->quote(time() + $this->settings->getPollingTime(),
'text').
' '.
481 'WHERE module = '.$ilDB->quote(
'ecs',
'text').
' '.
482 'AND keyword = '.$ilDB->quote(
'next_execution_'.$this->settings->getServerId(),
'text').
' '.
483 'AND value < '.$ilDB->quote(time(),
'text');
484 $affected_rows = $ilDB->manipulate(
$query);
505 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
508 $soap_client->setResponseTimeout(1);
509 $soap_client->enableWSDL(
true);
511 $ilLog->write(__METHOD__.
': Trying to call Soap client...');
515 if($soap_client->init() and 0)
517 $ilLog->write(__METHOD__.
': Calling soap handleECSTasks method...');
518 $res = $soap_client->call(
'handleECSTasks',array($new_session_id.
'::'.
$client_id,$this->settings->getServerId()));
522 $ilLog->write(__METHOD__.
': SOAP call failed. Calling clone method manually. ');
523 include_once(
'./webservice/soap/include/inc.soap_functions.php');