ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 getContentObject ()
 Get content object.
 addSettingsToForm (ilPropertyFormGUI $a_form, $a_type)
 Fill ECS export settings "multiple servers".
 handleSettingsUpdate ()
 Update ECS Export Settings.
 handleContentUpdate ()
 Update ECS Content.
 doDelete (ilECSSetting $a_server, ilECSExport $a_export_settings)
 Delete ECS resource.

Static Public Member Functions

static getInstanceByObject (ilObject $a_content_obj)
 Get settings handler for repository object.
static _handleDelete (array $a_subbtree_nodes)
 handle delete Objects that are moved to the trash call ECS-Remove

Data Fields

const MAIL_SENDER = 6

Protected Member Functions

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

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

ilECSObjectSettings::__construct ( ilObject  $a_content_object)

Constructor.

Parameters
ilObject$a_content_object

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

{
$this->content_obj = $a_content_object;
}

Member Function Documentation

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.

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

Referenced by ilRepUtil\deleteObjects().

{
// active?
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
if(!ilECSServerSettings::getInstance()->activeServerExists())
{
return;
}
include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
include_once './Services/WebServices/ECS/classes/class.ilECSExport.php' ;
foreach($a_subbtree_nodes as $node)
{
if(in_array($node['obj_id'],$exported))
{
{
// Read export server ids
foreach(ilECSExport::getExportServerIds($node['obj_id']) as $sid)
{
$export_settings = new ilECSExport($sid, $content_obj->getId());
$settings->doDelete($server, $export_settings);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by ilECSCourseSettings\buildJson().

{
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$values = ilAdvancedMDValues::_getValuesByObjId($this->content_obj->getId());
foreach($a_definition as $id => $type)
{
if(is_array($type))
{
$target = $type[1];
$type = $type[0];
}
else
{
$target = $id;
}
if($field = $mappings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, $id))
{
$value = isset($values[$field]) ? $values[$field] : '';
switch($type)
{
$a_json->$target = explode(',', $value);
break;
$a_json->$target = (int)$value;
break;
$a_json->$target = (string)$value;
break;
if(!isset($a_json->$target))
{
include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
$a_json->$target = new ilECSTimePlace();
}
$a_json->$target->{'set'.ucfirst($id)}($value);
break;
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $GLOBALS, $lng, ilECSExport\_isExported(), ilPropertyFormGUI\addItem(), getContentObject(), getECSObjectType(), ilECSParticipantSettings\getExportableParticipants(), ilECSExport\getExportServerIds(), ilECSEContentDetails\getInstance(), isActive(), ilFormPropertyGUI\setRequired(), ilCheckboxInputGUI\setValue(), and ilCheckboxGroupInputGUI\setValue().

{
global $lng;
if(!$this->isActive())
{
return;
}
$obj_id = $this->content_obj->getId();
// Return if no participant is enabled for export and the current object is not released
include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
if(!$this->getContentObject()->withReferences())
{
return TRUE;
}
if(!$exportablePart and !ilECSExport::_isExported($obj_id))
{
return true;
}
if(
$GLOBALS['tree']->checkForParentType($GLOBALS['tree']->getParentId($this->getContentObject()->getRefId()),'crs',false) or
$GLOBALS['tree']->checkForParentType($GLOBALS['tree']->getParentId($this->getContentObject()->getRefId()),'grp',false)
)
{
return true;
}
$lng->loadLanguageModule('ecs');
// show ecs property form section
$ecs = new ilFormSectionHeaderGUI();
$ecs->setTitle($lng->txt('ecs_'.$a_type.'_export'));
$a_form->addItem($ecs);
// release or not
$exp = new ilRadioGroupInputGUI($lng->txt('ecs_'.$a_type.'_export_obj_settings'),'ecs_export');
$exp->setRequired(true);
$exp->setValue(ilECSExport::_isExported($obj_id) ? 1 : 0);
$off = new ilRadioOption($lng->txt('ecs_'.$a_type.'_export_disabled'),0);
$exp->addOption($off);
$on = new ilRadioOption($lng->txt('ecs_'.$a_type.'_export_enabled'),1);
$exp->addOption($on);
$a_form->addItem($exp);
// Show all exportable participants
$publish_for = new ilCheckboxGroupInputGUI($lng->txt('ecs_publish_for'),'ecs_sid');
// @TODO: Active checkboxes for recipients
//$publish_for->setValue((array) $members);
// Read receivers
$receivers = array();
include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
foreach(ilECSExport::getExportServerIds($obj_id) as $sid)
{
$exp = new ilECSExport($sid, $obj_id);
$participants = null;
$details = ilECSEContentDetails::getInstance($sid, $exp->getEContentId(),
$this->getECSObjectType());
if($details instanceof ilECSEContentDetails)
{
$participants = $details->getReceivers();
}
if($participants)
{
foreach($participants as $mid)
{
$receivers[] = $sid.'_'.$mid;
}
}
}
$publish_for->setValue($receivers);
foreach($exportablePart as $pInfo)
{
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
$partSetting = new ilECSParticipantSetting($pInfo['sid'], $pInfo['mid']);
$com = new ilCheckboxInputGUI(
$partSetting->getCommunityName().': '.$partSetting->getTitle(),
'sid_mid'
);
$com->setValue($pInfo['sid'].'_'.$pInfo['mid']);
$publish_for->addOption($com);
}
$on->addSubItem($publish_for);
return true;
}

+ Here is the call graph for this function:

ilECSObjectSettings::buildJson ( ilECSSetting  $a_server)
abstractprotected

Build resource-specific json.

Parameters
ilECSSetting$a_server
Returns
object

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

Referenced by doAdd(), and doUpdate().

+ Here is the caller graph for this function:

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.

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

Referenced by handleSettingsForServer().

{
global $ilLog;
$ilLog->write(__METHOD__.': Starting ECS add resource...');
$json = $this->buildJson($a_server);
include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
$connector = new ilECSConnector($a_server);
$connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, implode(',',$a_mids));
$econtent_id = $connector->addResource($this->getECSObjectType(),
json_encode($json));
// status changed
$a_export_settings->setExported(true);
$a_export_settings->setEContentId($econtent_id);
$a_export_settings->save();
$this->handlePermissionUpdate($a_server,true);
// Send mail
$this->sendNewContentNotification($a_server, $econtent_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by handleSettingsForServer().

{
global $ilLog;
// already exported?
if($a_export_settings->isExported())
{
include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
$econtent_id = $a_export_settings->getEContentId();
if(!$econtent_id)
{
$ilLog->write(__METHOD__.': Missing eid. Aborting.');
throw new ilECSConnectorException('Missing ECS content ID. Aborting.');
}
$connector = new ilECSConnector($a_server);
$ilLog->write(__METHOD__.': Start deleting ECS content...');
$connector->deleteResource($this->getECSObjectType(),
$econtent_id);
// status changed
$a_export_settings->setExported(false);
$a_export_settings->save();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by handleContentUpdate(), and handleSettingsForServer().

{
global $ilLog;
include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
$econtent_id = $a_export_settings->getEContentId();
if(!$econtent_id)
{
$ilLog->write(__METHOD__.': Missing eid. Aborting.');
throw new ilECSConnectorException('Missing ECS content ID. Aborting.');
}
$connector = new ilECSConnector($a_server);
if(!$a_mids)
{
$a_mids = $this->getParticipants($a_server->getServerId(), $econtent_id);
}
$ilLog->write(__METHOD__.': Start updating ECS content - '.print_r($a_mids,true));
$connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS,implode(',',(array) $a_mids));
$json = $this->buildJson($a_server);
$connector->updateResource($this->getECSObjectType(),
$econtent_id, json_encode($json));
$this->handlePermissionUpdate($a_server,true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSObjectSettings::getContentObject ( )

Get content object.

Returns
object ilObject

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

References $content_obj.

Referenced by addSettingsToForm(), and getJsonCore().

{
}

+ Here is the caller graph for this function:

ilECSObjectSettings::getECSObjectType ( )
abstractprotected

Get ECS resource identifier, e.g.

"/campusconnect/courselinks"

Returns
string

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

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

+ Here is the caller graph for this function:

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.

References ilObject\getType().

Referenced by _handleDelete().

{
switch($a_content_obj->getType())
{
case 'crs':
include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
return new ilECSCourseSettings($a_content_obj);
case 'cat':
include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
return new ilECSCategorySettings($a_content_obj);
case 'file':
include_once 'Modules/File/classes/class.ilECSFileSettings.php';
return new ilECSFileSettings($a_content_obj);
case 'glo':
include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
return new ilECSGlossarySettings($a_content_obj);
case 'grp':
include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
return new ilECSGroupSettings($a_content_obj);
case 'lm':
include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
return new ilECSLearningModuleSettings($a_content_obj);
case 'wiki':
include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
return new ilECSWikiSettings($a_content_obj);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSObjectSettings::getJsonCore (   $a_etype)
protected

Build core json structure.

Parameters
string$a_etype
Returns
object

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

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

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

{
$json = new stdClass();
$json->lang = 'en_EN'; // :TODO: obsolet?
$json->id = 'il_'.IL_INST_ID.'_'.$this->getContentObject()->getType().'_'.$this->getContentObject()->getId();
$json->etype = $a_etype;
$json->title = $this->content_obj->getTitle();
$json->abstract = $this->content_obj->getLongDescription();
include_once('./Services/Link/classes/class.ilLink.php');
$json->url = ilLink::_getLink($this->content_obj->getRefId(),$this->content_obj->getType());
return $json;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by doUpdate().

{
$receivers = array();
include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
foreach((array) $a_server_id as $sid)
{
$participants = null;
$details = ilECSEContentDetails::getInstance($sid, $a_econtent_id,$this->getECSObjectType());
if($details instanceof ilECSEContentDetails)
{
$participants = $details->getReceivers();
}
if($participants)
{
foreach($participants as $mid)
{
$receivers[] = $mid;
}
}
}
return (array) $receivers;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSObjectSettings::handleContentUpdate ( )

Update ECS Content.

to be used AFTER metadata-/content-updates

Returns
bool

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

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

{
global $ilLog;
if(!$this->isActive())
{
return true;
}
include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
$export_servers = ilECSExport::getExportServerIds($this->content_obj->getId());
foreach($export_servers as $server_id)
{
include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
if($server->isEnabled())
{
try
{
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$export_settings = new ilECSExport($server_id, $this->content_obj->getId());
// already exported, update ecs
if($export_settings->isExported())
{
$this->doUpdate($server, $export_settings);
}
// not exported yet, nothing to do
else
{
}
}
{
$ilLog->write(__METHOD__.': Cannot handle ECS content update. '.$exc->getMessage());
return false;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilECSObjectSettings::handlePermissionUpdate ( ilECSSetting  $server)
protected

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

References $GLOBALS, ilRbacReview\_getOperationIdsByName(), and ilECSSetting\getGlobalRole().

Referenced by doAdd(), and doUpdate().

{
if($this->content_obj->getType() == 'crs')
{
$GLOBALS['ilLog']->write(__METHOD__.': Permission update');
if($this->content_obj->getType() == 'crs')
{
$GLOBALS['rbacadmin']->grantPermission(
$server->getGlobalRole(),
ilRbacReview::_getOperationIdsByName(array('join','visible')),
$this->content_obj->getRefId()
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by handleSettingsUpdate().

{
try
{
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$export_settings = new ilECSExport($a_server->getServerId(), $this->content_obj->getId());
// already exported?
if($export_settings->isExported())
{
// still exportable: update ecs
if((bool)$a_export)
{
$this->doUpdate($a_server, $export_settings, $a_mids);
}
// not exportable anymore
else
{
$this->doDelete($a_server, $export_settings);
}
}
// not exported yet
else
{
// now to be exported
if($a_export)
{
$this->doAdd($a_server, $export_settings, $a_mids);
}
// was not and will not be exported
else
{
}
}
}
{
throw $exc;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

{
if(!$this->isActive())
{
return true;
}
// Parse post data
$mids = array();
foreach((array) $_POST['ecs_sid'] as $sid_mid)
{
$tmp = explode('_',$sid_mid);
$mids[$tmp[0]][] = $tmp[1];
}
try
{
include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
// Update for each server
{
if($server->isEnabled())
{
// Export
$export = true;
if(!$_POST['ecs_export'])
{
$export = false;
}
if(!count($mids[$server_id]))
{
$export = false;
}
$export,
$mids[$server_id]
);
}
}
}
{
ilUtil::sendFailure('Error exporting to ECS server: '.$exc->getMessage());
return false;
}
return true;
}

+ Here is the call graph for this function:

ilECSObjectSettings::isActive ( )
protected

Is ECS (for current object) active?

Returns
boolean

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

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

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

{
include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
if(ilECSServerSettings::getInstance()->activeServerExists())
{
// imported objects cannot be exported
include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
if(!ilECSImport::lookupServerId($this->content_obj->getId()))
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

Referenced by doAdd().

{
global $ilLog;
if(!count($rcps = $a_server->getApprovalRecipients()))
{
return true;
}
include_once('./Services/Mail/classes/class.ilMail.php');
include_once('./Services/Language/classes/class.ilLanguageFactory.php');
$lang->loadLanguageModule('ecs');
// @TODO: read mail
$mail = new ilMail(self::MAIL_SENDER);
$message = $lang->txt('ecs_export_created_body_a')."\n\n";
$message .= $lang->txt('title').': '.$this->content_obj->getTitle()."\n";
if(strlen($desc = $this->content_obj->getDescription()))
{
$message .= $lang->txt('desc').': '.$desc."\n";
}
// Participant info
$message .= ("\n".$lang->txt('ecs_published_for'));
try
{
$found = false;
$receivers = null;
include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
$a_econtent_id, $this->getECSObjectType());
if($details instanceof ilECSEContentDetails)
{
$receivers = $details->getReceivers();
}
if($receivers)
{
foreach($receivers as $member)
{
$found = true;
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
$part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member);
$message .= ("\n\n".$part->getParticipantName()."\n");
$message .= ($part->getDescription());
}
}
if($found)
{
$message .= "\n\n";
}
else
{
$message .= (' '.$lang->txt('ecs_not_published')."\n\n");
}
}
{
$ilLog->write(__METHOD__.': Cannot read approvements.');
return false;
}
include_once('./Services/Link/classes/class.ilLink.php');
$href = ilLink::_getStaticLink($this->content_obj->getRefId(),'crs',true);
$message .= $lang->txt("perma_link").': '.$href."\n\n";
$mail->sendMail($a_server->getApprovalRecipientsAsString(),
'','',
$lang->txt('ecs_new_approval_subject'),
$message,array(),array('normal'));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilECSObjectSettings::$content_obj
protected

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

Referenced by _handleDelete(), and getContentObject().

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: