19 declare(strict_types=1);
    51         $this->main_tpl = $DIC->ui()->mainTemplate();
    53         $this->
lng = $DIC->language();
    54         $this->
logger = $DIC->logger()->obj();
    55         $this->tree = $DIC->repositoryTree();
    56         $this->rbacAdmin = $DIC->rbac()->admin();
    58         $this->content_obj = $a_content_object;
    66         switch ($a_content_obj->
getType()) {
   112             #if(!ilECSImportManager::getInstance()->lookupServerId($this->content_obj->getId()))   130         $obj_id = $this->content_obj->getId();
   136         $this->
lng->loadLanguageModule(
'ecs');
   140         $ecs->setTitle($this->
lng->txt(
'ecs_' . $a_type . 
'_export'));
   147         $exp->setValue($export_manager->_isExported($obj_id) ? 
"1" : 
"0");
   148         $off = 
new ilRadioOption($this->
lng->txt(
'ecs_' . $a_type . 
'_export_disabled'), 
"0");
   149         $exp->addOption($off);
   150         $on = 
new ilRadioOption($this->
lng->txt(
'ecs_' . $a_type . 
'_export_enabled'), 
"1");
   151         $exp->addOption($on);
   161         $receivers = array();
   162         foreach ($export_manager->getExportServerIds($obj_id) as $sid) {
   165             $participants = null;
   168                 $exp->getEContentId(),
   172                 $participants = $details->getReceivers();
   175                 foreach ($participants as $mid) {
   176                     $receivers[] = $sid . 
'_' . $mid;
   182         foreach ($exportable_participants as $pInfo) {
   186                 $partSetting->getCommunityName() . 
': ' . $partSetting->getTitle(),
   189             $com->
setValue($pInfo[
'sid'] . 
'_' . $pInfo[
'mid']);
   190             $publish_for->addOption($com);
   192         $on->addSubItem($publish_for);
   197         FieldFactory $field_factory,
   200         $type = $this->content_obj->getType();
   208         $this->
lng->loadLanguageModule(
'ecs');
   211         $potential_receivers = [];
   213         foreach ($exportable_participants as $participant) {
   215             $potential_receivers[$participant[
'sid'] . 
'_' . $participant[
'mid']] = $field_factory->checkbox(
   216                 $participant_setting->getCommunityName() . 
': ' . $participant_setting->getTitle()
   222             array_keys($potential_receivers)
   225         $inputs[
'ecs_export'] = $field_factory->optionalGroup(
   226             $potential_receivers,
   227             $this->
lng->txt(
'ecs_' . $type . 
'_export_obj_settings')
   231         return $field_factory->section(
$inputs, $this->
lng->txt(
'ecs_' . $type . 
'_export'))
   237         array $exportable_participants
   239         $this->
logger->debug(
'Show ecs settings.');
   241             $this->
logger->debug(
'Object type is not active. => no settings.');
   245         $obj_id = $this->content_obj->getId();
   249             $this->
logger->debug(
'Called without references. => no settings.');
   253         if (!$exportable_participants && !$export_manager->
_isExported($obj_id)) {
   254             $this->
logger->debug(
'Object type is not exportable. => no settings.');
   258             $this->tree->checkForParentType($this->tree->getParentId($this->getContentObject()->getRefId()), 
'crs', 
false) ||
   259             $this->tree->checkForParentType($this->tree->getParentId($this->getContentObject()->getRefId()), 
'grp', 
false)
   261             $this->
logger->debug(
'Parent crs/grp in path. => no settings.');
   270         return $refinery->custom()->transformation(
   271             function (?array $vs): array {
   272                 if ($vs[
'ecs_export'] === null) {
   274                         'is_exported' => false
   279                     'is_exported' => 
true,
   280                     'values' => array_keys($vs[
'ecs_export'])
   288         array $potential_receivers
   290         $obj_id = $this->content_obj->getId();
   291         $active_receivers = null;
   295             $participants = null;
   298                 $exp->getEContentId(),
   302                 $participants = $details->getReceivers();
   304             if ($participants === null) {
   307             foreach ($participants as $mid) {
   308                 $active_receivers[$sid . 
'_' . $mid] = 
true;
   312         if ($active_receivers === null) {
   316         $missing_keys = (array_diff($potential_receivers, array_keys($active_receivers)));
   317         foreach ($missing_keys as $key) {
   318             $active_receivers[$key] = 
false;
   321         return $active_receivers;
   326         return $this->
handleSettings($section[
'is_exported'], $section[
'values']);
   338             (
bool) $form->
getInput(
"ecs_export"),
   346         array $selected_receivers
   354         foreach ((array) $selected_receivers as $sid_mid) {
   355             $tmp = explode(
'_', $sid_mid);
   356             if (1 === count($tmp)) {
   357                 $mids[$tmp[0]][] = $tmp[0];
   359                 $mids[$tmp[0]][] = $tmp[1];
   374                         !isset($mids[$server_id]) ||
   375                         !is_array($mids[$server_id]) ||
   376                         !count($mids[$server_id])) {
   382                         $mids[$server_id] ?? []
   387             $this->main_tpl->setOnScreenMessage(
'failure', 
'Error exporting to ECS server: ' . $exc->getMessage());
   404         if ($export_settings->isExported()) {
   407                 $this->
doUpdate($a_server, $export_settings, $a_mids);
   411                 $this->
doDelete($a_server, $export_settings);
   416             $this->
doAdd($a_server, $export_settings, $a_mids);
   431         $export_servers = $exportManager->getExportServerIds($this->content_obj->getId());
   432         foreach ($export_servers as $server_id) {
   436                     $export_settings = 
new ilECSExport($server_id, $this->content_obj->getId());
   439                     if ($export_settings->isExported()) {
   443                     $this->
logger->warning(__METHOD__ . 
': Cannot handle ECS content update. ' . $exc->getMessage());
   456         $this->
logger->info(__METHOD__ . 
': Starting ECS add resource...');
   462         $econtent_id = $connector->addResource(
   464             json_encode($json, JSON_THROW_ON_ERROR)
   470         $a_export_settings->
save();
   490             $this->
logger->warning(__METHOD__ . 
': Missing eid. Aborting.');
   498         $this->
logger->info(__METHOD__ . 
': Start updating ECS content - ' . print_r($a_mids, 
true));
   502         $connector->updateResource(
   505             json_encode($json, JSON_THROW_ON_ERROR)
   524                 $this->
logger->warning(__METHOD__ . 
': Missing eid. Aborting.');
   529             $this->
logger->info(__METHOD__ . 
': Start deleting ECS content...');
   530             $connector->deleteResource(
   537             $a_export_settings->
save();
   554         $exported = $exportManager->getExportedIds();
   555         foreach ($a_subbtree_nodes as $node) {
   561                 $settings = self::getInstanceByObject($content_obj);
   564                 foreach ($exportManager->getExportServerIds($node[
'obj_id']) as $sid) {
   566                     $export_settings = 
new ilECSExport($sid, $content_obj->getId());
   568                         $settings->doDelete(
$server, $export_settings);
   580         $receivers = array();
   581         foreach ((array) $a_server_id as $sid) {
   582             $participants = null;
   585                 $participants = $details->getReceivers();
   588                 foreach ($participants as $mid) {
   606         $lang->loadLanguageModule(
'ecs');
   609         $mail = 
new ilMail(self::MAIL_SENDER);
   610         $message = $lang->txt(
'ecs_export_created_body_a') . 
"\n\n";
   611         $message .= $lang->txt(
'title') . 
': ' . $this->content_obj->getTitle() . 
"\n";
   612         if (($desc = $this->content_obj->getDescription()) !== 
'') {
   613             $message .= $lang->txt(
'desc') . 
': ' . $desc . 
"\n";
   617         $message .= (
"\n" . $lang->txt(
'ecs_published_for'));
   629                 $receivers = $details->getReceivers();
   632                 foreach ($receivers as $member) {
   637                     $message .= (
"\n\n" . $part->getParticipantName() . 
"\n");
   638                     $message .= ($part->getDescription());
   644                 $message .= (
' ' . $lang->txt(
'ecs_not_published') . 
"\n\n");
   647             $this->
logger->warning(__METHOD__ . 
': Cannot read approvements.');
   652         $message .= $lang->txt(
"perma_link") . 
': ' . $href . 
"\n\n";
   659             $lang->txt(
'ecs_new_approval_subject'),
   673             ($this->content_obj->getType() === 
'crs') ||
   674             ($this->content_obj->getType() === 
'grp')
   676             $this->
logger->info(__METHOD__ . 
': Permission update for courses/groups');
   677             $this->rbacAdmin->grantPermission(
   680                 $this->content_obj->getRefId()
   691         $json->lang = 
'en_EN'; 
   693         $json->etype = $a_etype;
   694         $json->title = $this->content_obj->getTitle();
   695         $json->abstract = $this->content_obj->getLongDescription();
   697         $json->url = ilLink::_getLink($this->content_obj->getRefId(), $this->content_obj->getType());
   711         foreach ($a_definition as 
$id => $type) {
   712             if (is_array($type)) {
   713                 [$type , $target] = $type;
   719                 $value = $values[$field] ?? 
'';
   723                         $a_json->{$target} = explode(
',', $value);
   727                         $a_json->{$target} = (
int) $value;
   731                         $a_json->{$target} = (string) $value;
   735                         if (!isset($a_json->{$target})) {
   738                         $a_json->{$target}->{
'set' . ucfirst(
$id)}($value);
 
ilGlobalTemplateInterface $main_tpl
 
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getParticipants(int $a_server_id, int $a_econtent_id)
Get participants for server and ecs resource. 
 
getTrafoForECSExportSection(Refinery $refinery)
 
static getInstanceByServerId(int $a_server_id)
Get singleton instance. 
 
handleContentUpdate()
Update ECS Content. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Representation of ECS EContent Time Place. 
 
getServerId()
Get current server id. 
 
Storage of an ECS exported object. 
 
setExported(bool $a_status)
Set exported. 
 
static getInstance()
Get the singelton instance of this ilECSExportManager. 
 
doUpdate(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids=null)
Update ECS resource. 
 
isActive()
Is ECS (for current object) active? 
 
getApprovalRecipientsAsString()
get approval recipients as string 
 
static _handleDelete(array $a_subbtree_nodes)
handle delete Objects that are moved to the trash call ECS-Remove 
 
static getInstance()
Get singleton instance. 
 
static _getOperationIdsByName(array $operations)
get ops_id's by name. 
 
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
 
getECSObjectType()
Get ECS resource identifier, e.g. 
 
__construct(ilObject $a_content_object)
Constructor. 
 
addMetadataToJson(object $a_json, ilECSSetting $a_server, array $a_definition)
Add advanced metadata to json (export) 
 
getSettingsSection(FieldFactory $field_factory, Refinery $refinery)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getContentObject()
Get content object. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getInstanceByObject(ilObject $a_content_obj)
Get settings handler for repository object. 
 
ecsCanBeActivatedForObject(ilECSExportManager $export_manager, array $exportable_participants)
 
sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id)
send notifications about new EContent 
 
isExported()
check if an object is exported or not 
 
getEContentId()
get econtent id 
 
Class ilECSGroupSettings. 
 
setValue(string $a_value)
 
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
 
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server. 
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
getExportServerIds(int $a_obj_id)
lookup server ids of exported materials 
 
handlePermissionUpdate(ilECSSetting $server)
Handle permission update. 
 
doAdd(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids)
Add resource to ECS. 
 
getValueForECSExportOptionalGroup(ilECSExportManager $export_manager, array $potential_receivers)
 
buildJson(ilECSSetting $a_server)
Build resource-specific json. 
 
_isExported(int $a_obj_id)
Check if object is exported. 
 
static _getLanguage(string $a_lang_key='')
Get language object. 
 
getGlobalRole()
get global role 
 
getJsonCore(string $a_etype)
Build core json structure. 
 
setEContentId(int $a_id)
set econtent id 
 
saveSettingsSection(array $section)
 
handleSettingsUpdate(ilPropertyFormGUI $form)
Update ECS Export Settings. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
static getInstanceFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)
Get data from server. 
 
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
 
Manage the ECS exported contents. 
 
handleSettingsForServer(ilECSSetting $a_server, bool $a_export, array $a_mids)
Save ECS settings (add- update- deleteResource) 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class ilRbacAdmin Core functions for role based access control. 
 
getApprovalRecipients()
get approval recipients 
 
Handles object exports to ECS. 
 
addSettingsToForm(ilPropertyFormGUI $a_form, $a_type)
Fill ECS export settings "multiple servers". 
 
doDelete(ilECSSetting $a_server, ilECSExport $a_export_settings)
Delete ECS resource. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class ilECSCourseSettings. 
 
handleSettings(bool $ecs_export, array $selected_receivers)