26 $this->content_obj = $a_content_object;
37 switch($a_content_obj->
getType())
40 include_once
'Modules/Course/classes/class.ilECSCourseSettings.php';
44 include_once
'Modules/Category/classes/class.ilECSCategorySettings.php';
48 include_once
'Modules/File/classes/class.ilECSFileSettings.php';
52 include_once
'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
56 include_once
'Modules/Group/classes/class.ilECSGroupSettings.php';
60 include_once
'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
64 include_once
'Modules/Wiki/classes/class.ilECSWikiSettings.php';
92 include_once(
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
96 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
122 $obj_id = $this->content_obj->getId();
125 include_once
'./Services/WebServices/ECS/classes/class.ilECSExport.php';
126 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
146 $lng->loadLanguageModule(
'ecs');
150 $ecs->setTitle($lng->txt(
'ecs_'.$a_type.
'_export'));
158 $off =
new ilRadioOption($lng->txt(
'ecs_'.$a_type.
'_export_disabled'),0);
159 $exp->addOption($off);
160 $on =
new ilRadioOption($lng->txt(
'ecs_'.$a_type.
'_export_enabled'),1);
161 $exp->addOption($on);
171 $receivers = array();
172 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
177 $participants = null;
182 $participants = $details->getReceivers();
186 foreach($participants as $mid)
188 $receivers[] = $sid.
'_'.$mid;
194 foreach($exportablePart as $pInfo)
196 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
200 $partSetting->getCommunityName().
': '.$partSetting->getTitle(),
203 $com->
setValue($pInfo[
'sid'].
'_'.$pInfo[
'mid']);
204 $publish_for->addOption($com);
206 $on->addSubItem($publish_for);
227 foreach((array)
$_POST[
'ecs_sid'] as $sid_mid)
229 $tmp = explode(
'_',$sid_mid);
230 $mids[$tmp[0]][] = $tmp[1];
235 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
236 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
237 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
251 if(!count($mids[$server_id]))
283 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
287 if($export_settings->isExported())
292 $this->
doUpdate($a_server, $export_settings, $a_mids);
297 $this->
doDelete($a_server, $export_settings);
306 $this->
doAdd($a_server, $export_settings, $a_mids);
337 include_once
'./Services/WebServices/ECS/classes/class.ilECSExport.php';
339 foreach($export_servers as $server_id)
341 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
347 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
348 $export_settings =
new ilECSExport($server_id, $this->content_obj->getId());
351 if($export_settings->isExported())
363 $ilLog->write(__METHOD__.
': Cannot handle ECS content update. '.$exc->getMessage());
382 $ilLog->write(__METHOD__.
': Starting ECS add resource...');
386 include_once
'Services/WebServices/ECS/classes/class.ilECSConnector.php';
395 $a_export_settings->
save();
415 include_once
'Services/WebServices/ECS/classes/class.ilECSConnector.php';
420 $ilLog->write(__METHOD__.
': Missing eid. Aborting.');
429 $ilLog->write(__METHOD__.
': Start updating ECS content - '.print_r($a_mids,
true));
434 $econtent_id, json_encode($json));
454 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
455 include_once
'./Services/WebServices/ECS/classes/class.ilECSConnector.php';
460 $ilLog->write(__METHOD__.
': Missing eid. Aborting.');
465 $ilLog->write(__METHOD__.
': Start deleting ECS content...');
471 $a_export_settings->
save();
485 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
491 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
492 include_once
'./Services/WebServices/ECS/classes/class.ilECSExport.php' ;
494 foreach($a_subbtree_nodes as $node)
496 if(in_array($node[
'obj_id'],$exported))
507 $settings->doDelete(
$server, $export_settings);
523 $receivers = array();
524 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
525 foreach((array) $a_server_id as $sid)
527 $participants = null;
531 $participants = $details->getReceivers();
535 foreach($participants as $mid)
541 return (array) $receivers;
558 include_once(
'./Services/Mail/classes/class.ilMail.php');
559 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
562 $lang->loadLanguageModule(
'ecs');
565 $mail =
new ilMail(self::MAIL_SENDER);
566 $message =
$lang->txt(
'ecs_export_created_body_a').
"\n\n";
567 $message .=
$lang->txt(
'title').
': '.$this->content_obj->getTitle().
"\n";
568 if(strlen($desc = $this->content_obj->getDescription()))
570 $message .=
$lang->txt(
'desc').
': '.$desc.
"\n";
574 $message .= (
"\n".$lang->txt(
'ecs_published_for'));
581 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
586 $receivers = $details->getReceivers();
590 foreach($receivers as $member)
594 include_once
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
597 $message .= (
"\n\n".$part->getParticipantName().
"\n");
598 $message .= ($part->getDescription());
607 $message .= (
' '.$lang->txt(
'ecs_not_published').
"\n\n");
612 $ilLog->write(__METHOD__.
': Cannot read approvements.');
616 include_once(
'./Services/Link/classes/class.ilLink.php');
618 $message .=
$lang->txt(
"perma_link").
': '.$href.
"\n\n";
623 $lang->txt(
'ecs_new_approval_subject'),
624 $message,array(),array(
'normal'));
631 if($this->content_obj->getType() ==
'crs')
633 $GLOBALS[
'ilLog']->write(__METHOD__.
': Permission update');
634 if($this->content_obj->getType() ==
'crs')
636 $GLOBALS[
'rbacadmin']->grantPermission(
639 $this->content_obj->getRefId()
653 $json =
new stdClass();
654 $json->lang =
'en_EN';
656 $json->etype = $a_etype;
657 $json->title = $this->content_obj->getTitle();
658 $json->abstract = $this->content_obj->getLongDescription();
660 include_once(
'./Services/Link/classes/class.ilLink.php');
661 $json->url =
ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType());
675 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
676 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
677 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
680 include_once
"Services/WebServices/ECS/classes/class.ilECSUtils.php";
683 foreach($a_definition as $id => $type)
697 $value = isset($values[$field]) ? $values[$field] :
'';
702 $a_json->$target = explode(
',', $value);
706 $a_json->$target = (int)$value;
710 $a_json->$target = (string)$value;
714 if(!isset($a_json->$target))
716 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
719 $a_json->$target->{
'set'.ucfirst($id)}($value);
732 abstract protected function buildJson(
ilECSSetting $a_server);