24 include_once
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php';
64 $this->content_obj = $a_cont_obj;
66 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
67 $this->export_settings =
new ilECSExport($this->content_obj->getId());
81 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
86 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
88 foreach($a_subbtree_nodes as $node)
90 if(in_array($node[
'obj_id'],$exported))
97 $writer->deleteECSContent();
119 $this->exportable = $a_status;
143 $this->owner = $a_id;
166 $this->mids = $a_mids;
191 if($this->export_settings->isExported())
220 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
225 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
242 if($this->export_settings->isExported())
255 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
260 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
273 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
274 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
278 $this->log->write(__METHOD__.
': Start deleting ECS content...');
281 if(!$this->export_settings->getEContentId())
283 $this->log->write(__METHOD__.
': Missing eid. Aborting.');
286 $connector->deleteResource($this->export_settings->getEContentId());
287 $this->export_settings->setExported(
false);
288 $this->export_settings->save();
305 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
306 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
310 $this->log->write(__METHOD__.
': Starting course export...');
317 $econtent_id = $connector->addResource(json_encode($this->json));
319 $this->export_settings->setExported(
true);
320 $this->export_settings->setEContentId($econtent_id);
321 $this->export_settings->save();
347 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
350 $content =
$reader->getEContent();
351 if(!is_array($content) or !is_object($content[0]))
353 $this->log->write(__METHOD__.
': Error reading EContent with id: '.$this->export_settings->getEContentId());
354 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php');
357 $this->json = $content[0];
360 #var_dump("<pre>",json_encode($this->json),"</pre>");
362 $connector->updateResource($this->export_settings->getEContentId(),json_encode($this->json));
378 include_once(
'Services/WebServices/ECS/classes/class.ilECSSettings.php');
380 if(!count($rcps = $settings->getApprovalRecipients()))
385 include_once(
'./Services/Mail/classes/class.ilMail.php');
386 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
389 $lang->loadLanguageModule(
'ecs');
392 $message =
$lang->txt(
'ecs_export_created_body_a').
"\n\n";
393 $message .=
$lang->txt(
'title').
': '.$this->content_obj->getTitle().
"\n";
394 if(strlen(
$desc = $this->content_obj->getDescription()))
396 $message .=
$lang->txt(
'desc').
': '.
$desc.
"\n";
400 $message .= (
"\n".$lang->txt(
'ecs_published_for'));
402 $export =
new ilECSExport($this->content_obj->getId());
405 include_once
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php';
410 foreach(
$reader->getEContent() as $econ)
412 foreach($econ->getEligibleMembers() as $member)
416 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
419 $message .= (
"\n\n".$part->getParticipantName().
"\n");
420 $message .= ($part->getDescription());
429 $message .= (
' '.$lang->txt(
'ecs_not_published').
"\n\n");
434 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
438 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
441 include_once(
'classes/class.ilLink.php');
443 $message .=
$lang->txt(
"perma_link").
': '.$href.
"\n\n";
446 $error = $mail->sendMail($settings->getApprovalRecipientsAsString(),
448 $lang->txt(
'ecs_new_approval_subject'),
449 $message,array(),array(
'normal'));
462 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContent.php');
476 ######################################################
477 include_once(
'./classes/class.ilLink.php');
478 $this->json->setURL(
ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType()));
479 $this->json->setTitle($this->content_obj->getTitle());
482 ######################################################
483 if($this->mode == self::UPDATE_ALL)
492 $this->json->setEligibleMembers($members);
496 include_once(
'./Services/MetaData/classes/class.ilMDLanguage.php');
498 $this->json->setStatus($this->content_obj->isActivated() ?
'online' :
'offline');
499 $this->json->setInfo($this->content_obj->getDescription());
502 ######################################################
503 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
504 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
505 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
506 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
511 if($field = $mappings->getMappingByECSName(
'study_courses'))
513 $value = isset($values[$field]) ? $values[$field] :
'';
514 $this->json->setStudyCourses($value);
517 if($field = $mappings->getMappingByECSName(
'lecturer'))
519 $value = isset($values[$field]) ? $values[$field] :
'';
520 $this->json->setLecturers($value);
523 if($field = $mappings->getMappingByECSName(
'courseType'))
525 $value = isset($values[$field]) ? $values[$field] :
'';
526 $this->json->setCourseType($value);
529 if($field = $mappings->getMappingByECSName(
'courseID'))
531 $value = isset($values[$field]) ? $values[$field] :
'';
532 $this->json->setCourseID($value);
535 if($field = $mappings->getMappingByECSName(
'credits'))
537 $value = isset($values[$field]) ? $values[$field] :
'';
538 $this->json->setCredits($value);
541 if($field = $mappings->getMappingByECSName(
'semester_hours'))
543 $value = isset($values[$field]) ? $values[$field] :
'';
544 $this->json->setSemesterHours($value);
547 if($field = $mappings->getMappingByECSName(
'term'))
549 $value = isset($values[$field]) ? $values[$field] :
'';
550 $this->json->setTerm($value);
553 if($field = $mappings->getMappingByECSName(
'begin'))
555 $value = isset($values[$field]) ? $values[$field] :
'';
556 $this->json->getTimePlace()->setBegin($value);
558 if($field = $mappings->getMappingByECSName(
'end'))
560 $value = isset($values[$field]) ? $values[$field] :
'';
561 $this->json->getTimePlace()->setEnd($value);
563 if($field = $mappings->getMappingByECSName(
'room'))
565 $value = isset($values[$field]) ? $values[$field] :
'';
566 $this->json->getTimePlace()->setRoom($value);
568 if($field = $mappings->getMappingByECSName(
'cycle'))
570 $value = isset($values[$field]) ? $values[$field] :
'';
571 $this->json->getTimePlace()->setCycle($value);