18 declare(strict_types=1);
45 $this->main_tpl = $DIC->ui()->mainTemplate();
47 $this->
lng = $DIC->language();
48 $this->
logger = $DIC->logger()->obj();
49 $this->tree = $DIC->repositoryTree();
50 $this->rbacAdmin = $DIC->rbac()->admin();
52 $this->content_obj = $a_content_object;
60 switch ($a_content_obj->
getType()) {
106 #if(!ilECSImportManager::getInstance()->lookupServerId($this->content_obj->getId())) 122 $this->
logger->debug(
'Show ecs settings.');
124 $this->
logger->debug(
'Object type is not active. => no settings.');
128 $obj_id = $this->content_obj->getId();
132 $this->
logger->debug(
'Called withot references. => no settings.');
137 if (!$exportableParticipants && !$exportManager->_isExported($obj_id)) {
138 $this->
logger->debug(
'Object type is not exportable. => no settings.');
142 $this->tree->checkForParentType($this->tree->getParentId($this->getContentObject()->getRefId()),
'crs',
false) ||
143 $this->tree->checkForParentType($this->tree->getParentId($this->getContentObject()->getRefId()),
'grp',
false)
145 $this->
logger->debug(
'Parent crs/grp in path. => no settings.');
149 $this->
lng->loadLanguageModule(
'ecs');
153 $ecs->setTitle($this->
lng->txt(
'ecs_' . $a_type .
'_export'));
160 $exp->setValue($exportManager->_isExported($obj_id) ?
"1" :
"0");
161 $off =
new ilRadioOption($this->
lng->txt(
'ecs_' . $a_type .
'_export_disabled'),
"0");
162 $exp->addOption($off);
163 $on =
new ilRadioOption($this->
lng->txt(
'ecs_' . $a_type .
'_export_enabled'),
"1");
164 $exp->addOption($on);
174 $receivers = array();
175 foreach ($exportManager->getExportServerIds($obj_id) as $sid) {
178 $participants = null;
181 $exp->getEContentId(),
185 $participants =
$details->getReceivers();
188 foreach ($participants as $mid) {
189 $receivers[] = $sid .
'_' . $mid;
195 foreach ($exportableParticipants as $pInfo) {
199 $partSetting->getCommunityName() .
': ' . $partSetting->getTitle(),
202 $com->
setValue($pInfo[
'sid'] .
'_' . $pInfo[
'mid']);
203 $publish_for->addOption($com);
205 $on->addSubItem($publish_for);
225 foreach ((array) $_POST[
'ecs_sid'] as $sid_mid) {
226 $tmp = explode(
'_', $sid_mid);
227 $mids[$tmp[0]][] = $tmp[1];
237 if (!$_POST[
'ecs_export']) {
241 !isset($mids[$server_id]) ||
242 !is_array($mids[$server_id]) ||
243 !count($mids[$server_id])) {
249 $mids[$server_id] ?? []
254 $this->main_tpl->setOnScreenMessage(
'failure',
'Error exporting to ECS server: ' . $exc->getMessage());
271 if ($export_settings->isExported()) {
274 $this->
doUpdate($a_server, $export_settings, $a_mids);
278 $this->
doDelete($a_server, $export_settings);
283 $this->
doAdd($a_server, $export_settings, $a_mids);
298 $export_servers = $exportManager->getExportServerIds($this->content_obj->getId());
299 foreach ($export_servers as $server_id) {
303 $export_settings =
new ilECSExport($server_id, $this->content_obj->getId());
306 if ($export_settings->isExported()) {
310 $this->
logger->warning(__METHOD__ .
': Cannot handle ECS content update. ' . $exc->getMessage());
323 $this->
logger->info(__METHOD__ .
': Starting ECS add resource...');
329 $econtent_id = $connector->addResource(
331 json_encode($json, JSON_THROW_ON_ERROR)
337 $a_export_settings->
save();
357 $this->
logger->warning(__METHOD__ .
': Missing eid. Aborting.');
365 $this->
logger->info(__METHOD__ .
': Start updating ECS content - ' . print_r($a_mids,
true));
369 $connector->updateResource(
372 json_encode($json, JSON_THROW_ON_ERROR)
391 $this->
logger->warning(__METHOD__ .
': Missing eid. Aborting.');
396 $this->
logger->info(__METHOD__ .
': Start deleting ECS content...');
397 $connector->deleteResource(
404 $a_export_settings->
save();
421 $exported = $exportManager->getExportedIds();
422 foreach ($a_subbtree_nodes as $node) {
428 $settings = self::getInstanceByObject($content_obj);
431 foreach ($exportManager->getExportServerIds($node[
'obj_id']) as $sid) {
433 $export_settings =
new ilECSExport($sid, $content_obj->getId());
447 $receivers = array();
448 foreach ((array) $a_server_id as $sid) {
449 $participants = null;
452 $participants =
$details->getReceivers();
455 foreach ($participants as $mid) {
473 $lang->loadLanguageModule(
'ecs');
476 $mail =
new ilMail(self::MAIL_SENDER);
478 $message .=
$lang->txt(
'title') .
': ' . $this->content_obj->getTitle() .
"\n";
479 if (($desc = $this->content_obj->getDescription()) !==
'') {
496 $receivers =
$details->getReceivers();
499 foreach ($receivers as $member) {
504 $message .= (
"\n\n" . $part->getParticipantName() .
"\n");
505 $message .= ($part->getDescription());
511 $message .= (
' ' .
$lang->txt(
'ecs_not_published') .
"\n\n");
514 $this->
logger->warning(__METHOD__ .
': Cannot read approvements.');
519 $message .=
$lang->txt(
"perma_link") .
': ' . $href .
"\n\n";
526 $lang->txt(
'ecs_new_approval_subject'),
540 ($this->content_obj->getType() ===
'crs') ||
541 ($this->content_obj->getType() ===
'grp')
543 $this->
logger->info(__METHOD__ .
': Permission update for courses/groups');
544 $this->rbacAdmin->grantPermission(
547 $this->content_obj->getRefId()
558 $json->lang =
'en_EN';
560 $json->etype = $a_etype;
561 $json->title = $this->content_obj->getTitle();
562 $json->abstract = $this->content_obj->getLongDescription();
564 $json->url =
ilLink::_getLink($this->content_obj->getRefId(), $this->content_obj->getType());
578 foreach ($a_definition as
$id =>
$type) {
579 if (is_array(
$type)) {
586 $value = $values[$field] ??
'';
590 $a_json->{$target} = explode(
',', $value);
594 $a_json->{$target} = (
int) $value;
598 $a_json->{$target} = (string) $value;
602 if (!isset($a_json->{$target})) {
605 $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.
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)
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.
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="")
Get static link.
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
handlePermissionUpdate(ilECSSetting $server)
Handle permission update.
doAdd(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids)
Add resource to ECS.
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
buildJson(ilECSSetting $a_server)
Build resource-specific json.
static _getLanguage(string $a_lang_key='')
Get language object.
getGlobalRole()
get global role
handleSettingsUpdate()
Update ECS Export Settings.
getJsonCore(string $a_etype)
Build core json structure.
setEContentId(int $a_id)
set econtent id
static getInstanceFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)
Get data from server.
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...