ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilECSObjectSettings Class Reference

Handles object exports to ECS. More...

+ Inheritance diagram for ilECSObjectSettings:
+ Collaboration diagram for ilECSObjectSettings:

Public Member Functions

 __construct (ilObject $a_content_object)
 Constructor. More...
 
 getContentObject ()
 Get content object. More...
 
 addSettingsToForm (ilPropertyFormGUI $a_form, $a_type)
 Fill ECS export settings "multiple servers". More...
 
 handleSettingsUpdate ()
 Update ECS Export Settings. More...
 
 handleContentUpdate ()
 Update ECS Content. More...
 
 doDelete (ilECSSetting $a_server, ilECSExport $a_export_settings)
 Delete ECS resource. More...
 

Static Public Member Functions

static getInstanceByObject (ilObject $a_content_obj)
 Get settings handler for repository object. More...
 
static _handleDelete (array $a_subbtree_nodes)
 

Data Fields

const MAIL_SENDER = 6
 

Protected Member Functions

 getECSObjectType ()
 Get ECS resource identifier, e.g. More...
 
 isActive ()
 Is ECS (for current object) active? More...
 
 handleSettingsForServer (ilECSSetting $a_server, $a_export, $a_mids)
 Save ECS settings (add- update- deleteResource) More...
 
 doAdd (ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids)
 Add resource to ECS. More...
 
 doUpdate (ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids=null)
 Update ECS resource. More...
 
 getParticipants ($a_server_id, $a_econtent_id)
 Get participants for server and ecs resource. More...
 
 sendNewContentNotification (ilECSSetting $a_server, $a_econtent_id)
 send notifications about new EContent More...
 
 handlePermissionUpdate (ilECSSetting $server)
 
 getJsonCore ($a_etype)
 Build core json structure. More...
 
 addMetadataToJson (&$a_json, ilECSSetting $a_server, array $a_definition)
 Add advanced metadata to json (export) More...
 
 buildJson (ilECSSetting $a_server)
 Build resource-specific json. More...
 

Protected Attributes

 $content_obj
 

Detailed Description

Handles object exports to ECS.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Id
class.ilObjCourseGUI.php 31646 2011-11-14 11:39:37Z jluetzen

Definition at line 13 of file class.ilECSObjectSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSObjectSettings::__construct ( ilObject  $a_content_object)

Constructor.

Parameters
ilObject$a_content_object

Definition at line 24 of file class.ilECSObjectSettings.php.

25 {
26 $this->content_obj = $a_content_object;
27 }

Member Function Documentation

◆ _handleDelete()

static ilECSObjectSettings::_handleDelete ( array  $a_subbtree_nodes)
static
    handle delete
    Objects that are moved to the trash call ECS-Remove
See also
ilRepUtil
Parameters
array$a_subbtree_nodes

Definition at line 482 of file class.ilECSObjectSettings.php.

483 {
484 // active?
485 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
486 if(!ilECSServerSettings::getInstance()->activeServerExists())
487 {
488 return;
489 }
490
491 include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
492 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php' ;
493 $exported = ilECSExport::getExportedIds();
494 foreach($a_subbtree_nodes as $node)
495 {
496 if(in_array($node['obj_id'],$exported))
497 {
498 if($content_obj = ilObjectFactory::getInstanceByRefId($node['child'],false))
499 {
501
502 // Read export server ids
503 foreach(ilECSExport::getExportServerIds($node['obj_id']) as $sid)
504 {
506 $export_settings = new ilECSExport($sid, $content_obj->getId());
507 $settings->doDelete($server, $export_settings);
508 }
509 }
510 }
511 }
512 }
Storage of ECS exported objects.
static getExportedIds()
Get exported ids @global ilDB $ilDB.
static getExportServerIds($a_obj_id)
lookup server ids of exported materials @global ilDB $ilDB
static getInstanceByObject(ilObject $a_content_obj)
Get settings handler for repository object.
static getInstance()
Get singleton instance.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$server

References $content_obj, $server, ilECSExport\getExportedIds(), ilECSExport\getExportServerIds(), ilECSServerSettings\getInstance(), getInstanceByObject(), ilObjectFactory\getInstanceByRefId(), and ilECSSetting\getInstanceByServerId().

Referenced by ilRepUtil\deleteObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMetadataToJson()

ilECSObjectSettings::addMetadataToJson ( $a_json,
ilECSSetting  $a_server,
array  $a_definition 
)
protected

Add advanced metadata to json (export)

Parameters
object$a_json
ilECSSetting$a_server
array$a_definition

Definition at line 673 of file class.ilECSObjectSettings.php.

674 {
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');
679
680 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
681 $values = ilECSUtils::getAdvancedMDValuesForObjId($this->content_obj->getId());
682
683 foreach($a_definition as $id => $type)
684 {
685 if(is_array($type))
686 {
687 $target = $type[1];
688 $type = $type[0];
689 }
690 else
691 {
692 $target = $id;
693 }
694
695 if($field = $mappings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, $id))
696 {
697 $value = isset($values[$field]) ? $values[$field] : '';
698
699 switch($type)
700 {
702 $a_json->$target = explode(',', $value);
703 break;
704
706 $a_json->$target = (int)$value;
707 break;
708
710 $a_json->$target = (string)$value;
711 break;
712
714 if(!isset($a_json->$target))
715 {
716 include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
717 $a_json->$target = new ilECSTimePlace();
718 }
719 $a_json->$target->{'set'.ucfirst($id)}($value);
720 break;
721 }
722 }
723 }
724 }
static getInstanceByServerId($a_server_id)
Get singleton instance.
getServerId()
Get current server id.
Representation of ECS EContent Time Place.
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
const TYPE_TIMEPLACE

References ilECSUtils\getAdvancedMDValuesForObjId(), ilECSDataMappingSettings\getInstanceByServerId(), ilECSSetting\getServerId(), ilECSDataMappingSetting\MAPPING_EXPORT, ilECSUtils\TYPE_ARRAY, ilECSUtils\TYPE_INT, ilECSUtils\TYPE_STRING, and ilECSUtils\TYPE_TIMEPLACE.

Referenced by ilECSCourseSettings\buildJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSettingsToForm()

ilECSObjectSettings::addSettingsToForm ( ilPropertyFormGUI  $a_form,
  $a_type 
)

Fill ECS export settings "multiple servers".

to be used in ilObject->initEditForm()

Parameters
ilPropertyFormGUI$a_form

Definition at line 113 of file class.ilECSObjectSettings.php.

114 {
115 global $lng;
116
117 if(!$this->isActive($a_type))
118 {
119 return;
120 }
121
122 $obj_id = $this->content_obj->getId();
123
124 // Return if no participant is enabled for export and the current object is not released
125 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
126 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
127
128 if(!$this->getContentObject()->withReferences())
129 {
130 return TRUE;
131 }
132
134 if(!$exportablePart and !ilECSExport::_isExported($obj_id))
135 {
136 return true;
137 }
138 if(
139 $GLOBALS['tree']->checkForParentType($GLOBALS['tree']->getParentId($this->getContentObject()->getRefId()),'crs',false) or
140 $GLOBALS['tree']->checkForParentType($GLOBALS['tree']->getParentId($this->getContentObject()->getRefId()),'grp',false)
141 )
142 {
143 return true;
144 }
145
146 $lng->loadLanguageModule('ecs');
147
148 // show ecs property form section
149 $ecs = new ilFormSectionHeaderGUI();
150 $ecs->setTitle($lng->txt('ecs_'.$a_type.'_export'));
151 $a_form->addItem($ecs);
152
153
154 // release or not
155 $exp = new ilRadioGroupInputGUI($lng->txt('ecs_'.$a_type.'_export_obj_settings'),'ecs_export');
156 $exp->setRequired(true);
157 $exp->setValue(ilECSExport::_isExported($obj_id) ? 1 : 0);
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);
162 $a_form->addItem($exp);
163
164 // Show all exportable participants
165 $publish_for = new ilCheckboxGroupInputGUI($lng->txt('ecs_publish_for'),'ecs_sid');
166
167 // @TODO: Active checkboxes for recipients
168 //$publish_for->setValue((array) $members);
169
170 // Read receivers
171 $receivers = array();
172 include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
173 foreach(ilECSExport::getExportServerIds($obj_id) as $sid)
174 {
175 $exp = new ilECSExport($sid, $obj_id);
176
177 $participants = null;
178 $details = ilECSEContentDetails::getInstance($sid, $exp->getEContentId(),
179 $this->getECSObjectType());
180 if($details instanceof ilECSEContentDetails)
181 {
182 $participants = $details->getReceivers();
183 }
184 if($participants)
185 {
186 foreach($participants as $mid)
187 {
188 $receivers[] = $sid.'_'.$mid;
189 }
190 }
191 }
192 $publish_for->setValue($receivers);
193
194 foreach($exportablePart as $pInfo)
195 {
196 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
197 $partSetting = new ilECSParticipantSetting($pInfo['sid'], $pInfo['mid']);
198
199 $com = new ilCheckboxInputGUI(
200 $partSetting->getCommunityName().': '.$partSetting->getTitle(),
201 'sid_mid'
202 );
203 $com->setValue($pInfo['sid'].'_'.$pInfo['mid']);
204 $publish_for->addOption($com);
205 }
206 $on->addSubItem($publish_for);
207 return true;
208 }
This class represents a property in a property form.
This class represents a checkbox property in a property form.
Presentation of ecs content details (http://...campusconnect/courselinks/id/details)
static getInstance($a_server_id, $a_econtent_id, $a_resource_type)
Get data from server.
static _isExported($a_obj_id)
Check if object is exported.
getContentObject()
Get content object.
isActive()
Is ECS (for current object) active?
static getExportableParticipants($a_type)
Get participants which are enabled and export is allowed.
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $lng
Definition: privfeed.php:40

References $GLOBALS, $lng, ilECSExport\_isExported(), ilPropertyFormGUI\addItem(), getContentObject(), ilECSParticipantSettings\getExportableParticipants(), ilECSExport\getExportServerIds(), ilECSEContentDetails\getInstance(), and isActive().

+ Here is the call graph for this function:

◆ buildJson()

ilECSObjectSettings::buildJson ( ilECSSetting  $a_server)
abstractprotected

Build resource-specific json.

Parameters
ilECSSetting$a_server
Returns
object

Reimplemented in ilECSCategorySettings, ilECSCourseSettings, ilECSFileSettings, ilECSGlossarySettings, ilECSGroupSettings, ilECSLearningModuleSettings, ilECSTestSettings, and ilECSWikiSettings.

Referenced by doAdd(), and doUpdate().

+ Here is the caller graph for this function:

◆ doAdd()

ilECSObjectSettings::doAdd ( ilECSSetting  $a_server,
ilECSExport  $a_export_settings,
array  $a_mids 
)
protected

Add resource to ECS.

Parameters
ilECSSetting$a_server
ilECSExport$a_export_settings
array$a_mids

Definition at line 378 of file class.ilECSObjectSettings.php.

379 {
380 global $ilLog;
381
382 $ilLog->write(__METHOD__.': Starting ECS add resource...');
383
384 $json = $this->buildJson($a_server);
385
386 include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
387 $connector = new ilECSConnector($a_server);
388 $connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, implode(',',$a_mids));
389 $econtent_id = $connector->addResource($this->getECSObjectType(),
390 json_encode($json));
391
392 // status changed
393 $a_export_settings->setExported(true);
394 $a_export_settings->setEContentId($econtent_id);
395 $a_export_settings->save();
396
397 $this->handlePermissionUpdate($a_server,true);
398
399 // Send mail
400 $this->sendNewContentNotification($a_server, $econtent_id);
401 }
setExported($a_status)
Set exported.
setEContentId($a_id)
set econtent id
sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id)
send notifications about new EContent
handlePermissionUpdate(ilECSSetting $server)
getECSObjectType()
Get ECS resource identifier, e.g.
buildJson(ilECSSetting $a_server)
Build resource-specific json.

References $ilLog, buildJson(), getECSObjectType(), handlePermissionUpdate(), ilECSConnector\HEADER_MEMBERSHIPS, ilECSExport\save(), sendNewContentNotification(), ilECSExport\setEContentId(), and ilECSExport\setExported().

Referenced by handleSettingsForServer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doDelete()

ilECSObjectSettings::doDelete ( ilECSSetting  $a_server,
ilECSExport  $a_export_settings 
)

Delete ECS resource.

as it is called from self::_handleDelete() it has to be public...

Parameters
type$a_server_id
Exceptions
ilECSConnectorException

Definition at line 447 of file class.ilECSObjectSettings.php.

448 {
449 global $ilLog;
450
451 // already exported?
452 if($a_export_settings->isExported())
453 {
454 include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
455 include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
456
457 $econtent_id = $a_export_settings->getEContentId();
458 if(!$econtent_id)
459 {
460 $ilLog->write(__METHOD__.': Missing eid. Aborting.');
461 throw new ilECSConnectorException('Missing ECS content ID. Aborting.');
462 }
463 $connector = new ilECSConnector($a_server);
464
465 $ilLog->write(__METHOD__.': Start deleting ECS content...');
466 $connector->deleteResource($this->getECSObjectType(),
467 $econtent_id);
468
469 // status changed
470 $a_export_settings->setExported(false);
471 $a_export_settings->save();
472 }
473 }
getEContentId()
get econtent id
isExported()
check if an object is exported or not

References $ilLog, ilECSExport\getEContentId(), getECSObjectType(), ilECSExport\isExported(), ilECSExport\save(), and ilECSExport\setExported().

Referenced by handleSettingsForServer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilECSObjectSettings::doUpdate ( ilECSSetting  $a_server,
ilECSExport  $a_export_settings,
array  $a_mids = null 
)
protected

Update ECS resource.

Parameters
ilECSSetting$a_server
ilECSExport$a_export_settings
array$a_mids
Exceptions
ilECSConnectorException

Definition at line 411 of file class.ilECSObjectSettings.php.

412 {
413 global $ilLog;
414
415 include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
416
417 $econtent_id = $a_export_settings->getEContentId();
418 if(!$econtent_id)
419 {
420 $ilLog->write(__METHOD__.': Missing eid. Aborting.');
421 throw new ilECSConnectorException('Missing ECS content ID. Aborting.');
422 }
423 $connector = new ilECSConnector($a_server);
424
425 if(!$a_mids)
426 {
427 $a_mids = $this->getParticipants($a_server->getServerId(), $econtent_id);
428 }
429 $ilLog->write(__METHOD__.': Start updating ECS content - '.print_r($a_mids,true));
430 $connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS,implode(',',(array) $a_mids));
431
432 $json = $this->buildJson($a_server);
433 $connector->updateResource($this->getECSObjectType(),
434 $econtent_id, json_encode($json));
435
436 $this->handlePermissionUpdate($a_server,true);
437 }
getParticipants($a_server_id, $a_econtent_id)
Get participants for server and ecs resource.

References $ilLog, buildJson(), ilECSExport\getEContentId(), getECSObjectType(), getParticipants(), ilECSSetting\getServerId(), handlePermissionUpdate(), and ilECSConnector\HEADER_MEMBERSHIPS.

Referenced by handleContentUpdate(), and handleSettingsForServer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentObject()

ilECSObjectSettings::getContentObject ( )

Get content object.

Returns
ilObject

Definition at line 73 of file class.ilECSObjectSettings.php.

74 {
75 return $this->content_obj;
76 }

References $content_obj.

Referenced by addSettingsToForm(), ilECSCourseSettings\buildJson(), and getJsonCore().

+ Here is the caller graph for this function:

◆ getECSObjectType()

ilECSObjectSettings::getECSObjectType ( )
abstractprotected

Get ECS resource identifier, e.g.

"/campusconnect/courselinks"

Returns
string

Reimplemented in ilECSCategorySettings, ilECSCourseSettings, ilECSFileSettings, ilECSGlossarySettings, ilECSGroupSettings, ilECSLearningModuleSettings, ilECSTestSettings, and ilECSWikiSettings.

Referenced by doAdd(), doDelete(), doUpdate(), and getParticipants().

+ Here is the caller graph for this function:

◆ getInstanceByObject()

static ilECSObjectSettings::getInstanceByObject ( ilObject  $a_content_obj)
static

Get settings handler for repository object.

Parameters
ilObject$a_content_obj
Returns
ilECSObjectSettings

Definition at line 35 of file class.ilECSObjectSettings.php.

36 {
37 switch($a_content_obj->getType())
38 {
39 case 'crs':
40 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
41 return new ilECSCourseSettings($a_content_obj);
42
43 case 'cat':
44 include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
45 return new ilECSCategorySettings($a_content_obj);
46
47 case 'file':
48 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
49 return new ilECSFileSettings($a_content_obj);
50
51 case 'glo':
52 include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
53 return new ilECSGlossarySettings($a_content_obj);
54
55 case 'grp':
56 include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
57 return new ilECSGroupSettings($a_content_obj);
58
59 case 'lm':
60 include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
61 return new ilECSLearningModuleSettings($a_content_obj);
62
63 case 'wiki':
64 include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
65 return new ilECSWikiSettings($a_content_obj);
66 }
67 }
Class ilECSCategorySettings.
Class ilECSCourseSettings.
Class ilECSFileSettings.
Class ilECSGlossarySettings.
Class ilECSGroupSettings.
Class ilECSLearningModuleSettings.
Class ilECSWikiSettings.
getType()
get object type @access public

References ilObject\getType().

Referenced by _handleDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJsonCore()

ilECSObjectSettings::getJsonCore (   $a_etype)
protected

Build core json structure.

Parameters
string$a_etype
Returns
object

Definition at line 651 of file class.ilECSObjectSettings.php.

652 {
653 $json = new stdClass();
654 $json->lang = 'en_EN'; // :TODO: obsolet?
655 $json->id = 'il_'.IL_INST_ID.'_'.$this->getContentObject()->getType().'_'.$this->getContentObject()->getId();
656 $json->etype = $a_etype;
657 $json->title = $this->content_obj->getTitle();
658 $json->abstract = $this->content_obj->getLongDescription();
659
660 include_once('./Services/Link/classes/class.ilLink.php');
661 $json->url = ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType());
662
663 return $json;
664 }

References ilLink\_getLink(), and getContentObject().

Referenced by ilECSCategorySettings\buildJson(), ilECSCourseSettings\buildJson(), ilECSFileSettings\buildJson(), ilECSGlossarySettings\buildJson(), ilECSGroupSettings\buildJson(), ilECSLearningModuleSettings\buildJson(), ilECSTestSettings\buildJson(), and ilECSWikiSettings\buildJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticipants()

ilECSObjectSettings::getParticipants (   $a_server_id,
  $a_econtent_id 
)
protected

Get participants for server and ecs resource.

Parameters
int$a_server_id
int$a_econtent_id
Returns
array

Definition at line 521 of file class.ilECSObjectSettings.php.

522 {
523 $receivers = array();
524 include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
525 foreach((array) $a_server_id as $sid)
526 {
527 $participants = null;
528 $details = ilECSEContentDetails::getInstance($sid, $a_econtent_id,$this->getECSObjectType());
529 if($details instanceof ilECSEContentDetails)
530 {
531 $participants = $details->getReceivers();
532 }
533 if($participants)
534 {
535 foreach($participants as $mid)
536 {
537 $receivers[] = $mid;
538 }
539 }
540 }
541 return (array) $receivers;
542 }

References getECSObjectType(), and ilECSEContentDetails\getInstance().

Referenced by doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleContentUpdate()

ilECSObjectSettings::handleContentUpdate ( )

Update ECS Content.

to be used AFTER metadata-/content-updates

Returns
bool

Definition at line 328 of file class.ilECSObjectSettings.php.

329 {
330 global $ilLog;
331
332 if(!$this->isActive())
333 {
334 return true;
335 }
336
337 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
338 $export_servers = ilECSExport::getExportServerIds($this->content_obj->getId());
339 foreach($export_servers as $server_id)
340 {
341 include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
343 if($server->isEnabled())
344 {
345 try
346 {
347 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
348 $export_settings = new ilECSExport($server_id, $this->content_obj->getId());
349
350 // already exported, update ecs
351 if($export_settings->isExported())
352 {
353 $this->doUpdate($server, $export_settings);
354 }
355 // not exported yet, nothing to do
356 else
357 {
358
359 }
360 }
361 catch(ilECSConnectorException $exc)
362 {
363 $ilLog->write(__METHOD__.': Cannot handle ECS content update. '.$exc->getMessage());
364 return false;
365 }
366 }
367 }
368 return true;
369 }
doUpdate(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids=null)
Update ECS resource.

References $ilLog, $server, doUpdate(), ilECSExport\getExportServerIds(), ilECSSetting\getInstanceByServerId(), and isActive().

+ Here is the call graph for this function:

◆ handlePermissionUpdate()

ilECSObjectSettings::handlePermissionUpdate ( ilECSSetting  $server)
protected

Definition at line 629 of file class.ilECSObjectSettings.php.

630 {
631 if($this->content_obj->getType() == 'crs')
632 {
633 $GLOBALS['ilLog']->write(__METHOD__.': Permission update');
634 if($this->content_obj->getType() == 'crs')
635 {
636 $GLOBALS['rbacadmin']->grantPermission(
637 $server->getGlobalRole(),
638 ilRbacReview::_getOperationIdsByName(array('join','visible')),
639 $this->content_obj->getRefId()
640 );
641 }
642 }
643 }
static _getOperationIdsByName($operations)
get ops_id's by name.

References $GLOBALS, $server, and ilRbacReview\_getOperationIdsByName().

Referenced by doAdd(), and doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSettingsForServer()

ilECSObjectSettings::handleSettingsForServer ( ilECSSetting  $a_server,
  $a_export,
  $a_mids 
)
protected

Save ECS settings (add- update- deleteResource)

Parameters
ilECSSetting$a_server
bool$a_export
arrayarray of participant mids
Exceptions
ilECSConnectorException

Definition at line 279 of file class.ilECSObjectSettings.php.

280 {
281 try
282 {
283 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
284 $export_settings = new ilECSExport($a_server->getServerId(), $this->content_obj->getId());
285
286 // already exported?
287 if($export_settings->isExported())
288 {
289 // still exportable: update ecs
290 if((bool)$a_export)
291 {
292 $this->doUpdate($a_server, $export_settings, $a_mids);
293 }
294 // not exportable anymore
295 else
296 {
297 $this->doDelete($a_server, $export_settings);
298 }
299 }
300 // not exported yet
301 else
302 {
303 // now to be exported
304 if($a_export)
305 {
306 $this->doAdd($a_server, $export_settings, $a_mids);
307 }
308 // was not and will not be exported
309 else
310 {
311
312 }
313 }
314 }
315 catch(ilECSConnectorException $exc)
316 {
317 throw $exc;
318 }
319 }
doAdd(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids)
Add resource to ECS.
doDelete(ilECSSetting $a_server, ilECSExport $a_export_settings)
Delete ECS resource.

References doAdd(), doDelete(), doUpdate(), and ilECSSetting\getServerId().

Referenced by handleSettingsUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSettingsUpdate()

ilECSObjectSettings::handleSettingsUpdate ( )

Update ECS Export Settings.

Processes post data from addSettingstoForm() to be used in ilObject->update() AFTER object data has been updated

Returns
bool

Definition at line 218 of file class.ilECSObjectSettings.php.

219 {
220 if(!$this->isActive())
221 {
222 return true;
223 }
224
225 // Parse post data
226 $mids = array();
227 foreach((array) $_POST['ecs_sid'] as $sid_mid)
228 {
229 $tmp = explode('_',$sid_mid);
230 $mids[$tmp[0]][] = $tmp[1];
231 }
232
233 try
234 {
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';
238
239 // Update for each server
240 foreach(ilECSParticipantSettings::getExportServers() as $server_id)
241 {
243 if($server->isEnabled())
244 {
245 // Export
246 $export = true;
247 if(!$_POST['ecs_export'])
248 {
249 $export = false;
250 }
251 if(!count($mids[$server_id]))
252 {
253 $export = false;
254 }
256 $server,
257 $export,
258 $mids[$server_id]
259 );
260 }
261 }
262 }
263 catch(ilECSConnectorException $exc)
264 {
265 ilUtil::sendFailure('Error exporting to ECS server: '.$exc->getMessage());
266 return false;
267 }
268 return true;
269 }
handleSettingsForServer(ilECSSetting $a_server, $a_export, $a_mids)
Save ECS settings (add- update- deleteResource)
static getExportServers()
Get server ids which allow an export @global <type> $ilDB.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, $server, ilECSParticipantSettings\getExportServers(), ilECSSetting\getInstanceByServerId(), handleSettingsForServer(), isActive(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ isActive()

ilECSObjectSettings::isActive ( )
protected

Is ECS (for current object) active?

Returns
boolean

Definition at line 90 of file class.ilECSObjectSettings.php.

91 {
92 include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
93 if(ilECSServerSettings::getInstance()->activeServerExists())
94 {
95 // imported objects cannot be exported
96 include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
97 if(!ilECSImport::lookupServerId($this->content_obj->getId()))
98 {
99 return true;
100 }
101 }
102
103 return false;
104 }
static lookupServerId($a_obj_id)
Lookup server id of imported content @global <type> $ilDB.

References ilECSServerSettings\getInstance(), and ilECSImport\lookupServerId().

Referenced by addSettingsToForm(), handleContentUpdate(), and handleSettingsUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNewContentNotification()

ilECSObjectSettings::sendNewContentNotification ( ilECSSetting  $a_server,
  $a_econtent_id 
)
protected

send notifications about new EContent

Returns
bool

Definition at line 549 of file class.ilECSObjectSettings.php.

550 {
551 global $ilLog;
552
553 if(!count($rcps = $a_server->getApprovalRecipients()))
554 {
555 return true;
556 }
557
558 include_once('./Services/Mail/classes/class.ilMail.php');
559 include_once('./Services/Language/classes/class.ilLanguageFactory.php');
560
562 $lang->loadLanguageModule('ecs');
563
564 // @TODO: read mail
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()))
569 {
570 $message .= $lang->txt('desc').': '.$desc."\n";
571 }
572
573 // Participant info
574 $message .= ("\n".$lang->txt('ecs_published_for'));
575
576 try
577 {
578 $found = false;
579
580 $receivers = null;
581 include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
582 $details = ilECSEContentDetails::getInstance($a_server->getServerId(),
583 $a_econtent_id, $this->getECSObjectType());
584 if($details instanceof ilECSEContentDetails)
585 {
586 $receivers = $details->getReceivers();
587 }
588 if($receivers)
589 {
590 foreach($receivers as $member)
591 {
592 $found = true;
593
594 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
595 $part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member);
596
597 $message .= ("\n\n".$part->getParticipantName()."\n");
598 $message .= ($part->getDescription());
599 }
600 }
601 if($found)
602 {
603 $message .= "\n\n";
604 }
605 else
606 {
607 $message .= (' '.$lang->txt('ecs_not_published')."\n\n");
608 }
609 }
611 {
612 $ilLog->write(__METHOD__.': Cannot read approvements.');
613 return false;
614 }
615
616 include_once('./Services/Link/classes/class.ilLink.php');
617 $href = ilLink::_getStaticLink($this->content_obj->getRefId(),'crs',true);
618 $message .= $lang->txt("perma_link").': '.$href."\n\n";
620
621 $mail->sendMail($a_server->getApprovalRecipientsAsString(),
622 '','',
623 $lang->txt('ecs_new_approval_subject'),
624 $message,array(),array('normal'));
625
626 return true;
627 }
static getInstanceByServerId($a_server_id)
Get instance by server id.
getApprovalRecipientsAsString()
get approval recipients as string
getApprovalRecipients()
get approval recipients
static _getLanguage($a_lang_key='')
Get langauge object.
Class Mail this class handles base functions for mail handling.
static _getAutoGeneratedMessageString($lang=null)
get auto generated info string

References $ilLog, $lang, ilMail\_getAutoGeneratedMessageString(), ilLanguageFactory\_getLanguage(), ilLink\_getStaticLink(), ilECSSetting\getApprovalRecipients(), ilECSSetting\getApprovalRecipientsAsString(), ilECSEContentDetails\getInstance(), ilECSCommunityReader\getInstanceByServerId(), and ilECSSetting\getServerId().

Referenced by doAdd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $content_obj

ilECSObjectSettings::$content_obj
protected

Definition at line 15 of file class.ilECSObjectSettings.php.

Referenced by _handleDelete(), and getContentObject().

◆ MAIL_SENDER

const ilECSObjectSettings::MAIL_SENDER = 6

Definition at line 17 of file class.ilECSObjectSettings.php.


The documentation for this class was generated from the following file: