62 $this->content_obj = $a_cont_obj;
64 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
65 $this->export_settings =
new ilECSExport($this->content_obj->getId());
79 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
84 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
86 foreach($a_subbtree_nodes as $node)
88 if(in_array($node[
'obj_id'],$exported))
95 $writer->deleteECSContent();
117 $this->exportable = $a_status;
141 $this->owner = $a_id;
164 $this->mids = $a_mids;
189 if($this->export_settings->isExported())
218 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
223 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
240 if($this->export_settings->isExported())
253 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
258 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
271 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
272 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
276 $this->log->write(__METHOD__.
': Start deleting ECS content...');
279 if(!$this->export_settings->getEContentId())
281 $this->log->write(__METHOD__.
': Missing eid. Aborting.');
284 $connector->deleteResource($this->export_settings->getEContentId());
285 $this->export_settings->setExported(
false);
286 $this->export_settings->save();
303 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
304 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
308 $this->log->write(__METHOD__.
': Starting course export...');
315 $econtent_id = $connector->addResource(json_encode($this->json));
317 $this->export_settings->setExported(
true);
318 $this->export_settings->setEContentId($econtent_id);
319 $this->export_settings->save();
345 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
348 $content =
$reader->getEContent();
349 if(!is_array($content) or !is_object($content[0]))
351 $this->log->write(__METHOD__.
': Error reading EContent with id: '.$this->export_settings->getEContentId());
352 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php');
355 $this->json = $content[0];
358 #var_dump("<pre>",json_encode($this->json),"</pre>");
360 $connector->updateResource($this->export_settings->getEContentId(),json_encode($this->json));
376 include_once(
'Services/WebServices/ECS/classes/class.ilECSSettings.php');
378 if(!count($rcps = $settings->getApprovalRecipients()))
383 include_once(
'./Services/Mail/classes/class.ilMail.php');
384 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
387 $lang->loadLanguageModule(
'ecs');
390 $message =
$lang->txt(
'ecs_export_created_body_a').
"\n\n";
391 $message .=
$lang->txt(
'title').
': '.$this->content_obj->getTitle().
"\n";
392 if(strlen($desc = $this->content_obj->getDescription()))
394 $message .=
$lang->txt(
'desc').
': '.$desc.
"\n";
398 $message .= (
"\n".$lang->txt(
'ecs_published_for'));
400 $export =
new ilECSExport($this->content_obj->getId());
403 include_once
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php';
408 foreach(
$reader->getEContent() as $econ)
410 foreach($econ->getEligibleMembers() as $member)
414 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
417 $message .= (
"\n\n".$part->getParticipantName().
"\n");
418 $message .= ($part->getDescription());
427 $message .= (
' '.$lang->txt(
'ecs_not_published').
"\n\n");
432 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
436 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
439 include_once(
'classes/class.ilLink.php');
441 $message .=
$lang->txt(
"perma_link").
': '.$href.
"\n\n";
444 $error = $mail->sendMail($settings->getApprovalRecipientsAsString(),
446 $lang->txt(
'ecs_new_approval_subject'),
447 $message,array(),array(
'normal'));
460 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContent.php');
474 ######################################################
475 include_once(
'./classes/class.ilLink.php');
476 $this->json->setURL(
ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType()));
477 $this->json->setTitle($this->content_obj->getTitle());
480 ######################################################
481 if($this->mode == self::UPDATE_ALL)
490 $this->json->setEligibleMembers($members);
494 include_once(
'./Services/MetaData/classes/class.ilMDLanguage.php');
496 $this->json->setStatus($this->content_obj->isActivated() ?
'online' :
'offline');
497 $this->json->setInfo($this->content_obj->getDescription());
500 ######################################################
501 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
502 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
503 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
504 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
509 if($field = $mappings->getMappingByECSName(
'study_courses'))
511 $value = isset($values[$field]) ? $values[$field] :
'';
512 $this->json->setStudyCourses($value);
515 if($field = $mappings->getMappingByECSName(
'lecturer'))
517 $value = isset($values[$field]) ? $values[$field] :
'';
518 $this->json->setLecturers($value);
521 if($field = $mappings->getMappingByECSName(
'courseType'))
523 $value = isset($values[$field]) ? $values[$field] :
'';
524 $this->json->setCourseType($value);
527 if($field = $mappings->getMappingByECSName(
'courseID'))
529 $value = isset($values[$field]) ? $values[$field] :
'';
530 $this->json->setCourseID($value);
533 if($field = $mappings->getMappingByECSName(
'credits'))
535 $value = isset($values[$field]) ? $values[$field] :
'';
536 $this->json->setCredits($value);
539 if($field = $mappings->getMappingByECSName(
'semester_hours'))
541 $value = isset($values[$field]) ? $values[$field] :
'';
542 $this->json->setSemesterHours($value);
545 if($field = $mappings->getMappingByECSName(
'term'))
547 $value = isset($values[$field]) ? $values[$field] :
'';
548 $this->json->setTerm($value);
551 if($field = $mappings->getMappingByECSName(
'begin'))
553 $value = isset($values[$field]) ? $values[$field] :
'';
554 $this->json->getTimePlace()->setBegin($value);
556 if($field = $mappings->getMappingByECSName(
'end'))
558 $value = isset($values[$field]) ? $values[$field] :
'';
559 $this->json->getTimePlace()->setEnd($value);
561 if($field = $mappings->getMappingByECSName(
'room'))
563 $value = isset($values[$field]) ? $values[$field] :
'';
564 $this->json->getTimePlace()->setRoom($value);
566 if($field = $mappings->getMappingByECSName(
'cycle'))
568 $value = isset($values[$field]) ? $values[$field] :
'';
569 $this->json->getTimePlace()->setCycle($value);