24 include_once
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php';
25 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
66 $this->content_obj = $a_cont_obj;
67 $this->server_id = $a_server_id;
69 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
84 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
90 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
92 foreach($a_subbtree_nodes as $node)
94 if(in_array($node[
'obj_id'],$exported))
104 $writer->deleteECSContent();
136 $this->exportable = $a_status;
160 $this->owner = $a_id;
183 $this->mids = $a_mids;
208 if($this->export_settings->isExported())
237 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
242 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
258 if($this->export_settings->isExported())
271 $this->log->write(__METHOD__.
': Error connecting to ECS server. '.$exc->getMessage());
276 $this->log->write(__METHOD__.
': Cannot update ECS content. '.$exc->getMessage());
289 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
290 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
294 $this->log->write(__METHOD__.
': Start deleting ECS content...');
297 if(!$this->export_settings->getEContentId())
299 $this->log->write(__METHOD__.
': Missing eid. Aborting.');
302 $connector->deleteResource($this->export_settings->getEContentId());
303 $this->export_settings->setExported(
false);
304 $this->export_settings->save();
321 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
322 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
326 $this->log->write(__METHOD__.
': Starting course export...');
334 #$connector->addHeader(ilECSConnector::HEADER_COMMUNITIES, )
335 $econtent_id = $connector->addResource(json_encode($this->json));
337 $this->export_settings->setExported(
true);
338 $this->export_settings->setEContentId($econtent_id);
339 $this->export_settings->save();
365 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
369 $content =
$reader->getEContent();
370 $details =
$reader->getEContentDetails();
374 $this->log->write(__METHOD__.
': Error reading EContent with id: '.$this->export_settings->getEContentId());
375 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php');
378 $this->json = $content;
381 #$connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, implode(',',$this->getParticipantIds()));
391 $connector->updateResource($this->export_settings->getEContentId(),json_encode($this->json));
407 include_once(
'Services/WebServices/ECS/classes/class.ilECSSetting.php');
409 if(!count($rcps = $settings->getApprovalRecipients()))
414 include_once(
'./Services/Mail/classes/class.ilMail.php');
415 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
418 $lang->loadLanguageModule(
'ecs');
422 $message =
$lang->txt(
'ecs_export_created_body_a').
"\n\n";
423 $message .=
$lang->txt(
'title').
': '.$this->content_obj->getTitle().
"\n";
424 if(strlen($desc = $this->content_obj->getDescription()))
426 $message .=
$lang->txt(
'desc').
': '.$desc.
"\n";
430 $message .= (
"\n".$lang->txt(
'ecs_published_for'));
435 include_once
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php';
442 foreach(
$reader->getEContentDetails()->getReceivers() as $member)
446 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
449 $message .= (
"\n\n".$part->getParticipantName().
"\n");
450 $message .= ($part->getDescription());
460 $message .= (
' '.$lang->txt(
'ecs_not_published').
"\n\n");
465 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
470 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read approvements.');
474 include_once(
'classes/class.ilLink.php');
476 $message .=
$lang->txt(
"perma_link").
': '.$href.
"\n\n";
479 $error = $mail->sendMail($settings->getApprovalRecipientsAsString(),
481 $lang->txt(
'ecs_new_approval_subject'),
482 $message,array(),array(
'normal'));
495 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContent.php');
509 ######################################################
510 include_once(
'./classes/class.ilLink.php');
511 $this->json->setURL(
ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType()));
512 $this->json->setTitle($this->content_obj->getTitle());
515 ######################################################
516 if($this->mode == self::UPDATE_ALL)
527 if($this->mode == self::UPDATE_ALL)
530 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
533 $this->json->organisation = $part->getOrganisation()->getName();
537 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.$e->getMessage());
542 include_once(
'./Services/MetaData/classes/class.ilMDLanguage.php');
544 $this->json->setStatus($this->content_obj->isActivated() ?
'online' :
'offline');
545 $this->json->setInfo($this->content_obj->getDescription());
548 ######################################################
549 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
550 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
551 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
552 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
559 $value = isset($values[$field]) ? $values[$field] :
'';
560 $this->json->setStudyCourses($value);
565 $value = isset($values[$field]) ? $values[$field] :
'';
566 $this->json->setLecturers($value);
571 $value = isset($values[$field]) ? $values[$field] :
'';
572 $this->json->setCourseType($value);
577 $value = isset($values[$field]) ? $values[$field] :
'';
578 $this->json->setCourseID($value);
583 $value = isset($values[$field]) ? $values[$field] :
'';
584 $this->json->setCredits($value);
589 $value = isset($values[$field]) ? $values[$field] :
'';
590 $this->json->setSemesterHours($value);
595 $value = isset($values[$field]) ? $values[$field] :
'';
596 $this->json->setTerm($value);
601 $value = isset($values[$field]) ? $values[$field] :
'';
602 $this->json->getTimePlace()->setBegin($value);
606 $value = isset($values[$field]) ? $values[$field] :
'';
607 $this->json->getTimePlace()->setEnd($value);
611 $value = isset($values[$field]) ? $values[$field] :
'';
612 $this->json->getTimePlace()->setRoom($value);
616 $value = isset($values[$field]) ? $values[$field] :
'';
617 $this->json->getTimePlace()->setCycle($value);