ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRemoteObjectBase Class Reference

Remote object app base class. More...

+ Inheritance diagram for ilRemoteObjectBase:
+ Collaboration diagram for ilRemoteObjectBase:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor. More...
 
 beforeCreate ()
 
 getRealmPlain ()
 Get realm plain. More...
 
 setOrganization ($a_organization)
 set organization More...
 
 getOrganization ()
 get organization More...
 
 getLocalInformation ()
 get local information More...
 
 setLocalInformation ($a_info)
 set local information More...
 
 getMID ()
 get mid More...
 
 setMID ($a_mid)
 set mid More...
 
 setRemoteLink ($a_link)
 set remote link More...
 
 getRemoteLink ()
 get remote link More...
 
 getFullRemoteLink ()
 get full remote link Including ecs generated hash and auth mode More...
 
 createAuthResource ($a_plain_realm)
 create authentication resource on ecs server More...
 
 doCreate ()
 Create remote object. More...
 
 doUpdate ()
 Update remote object. More...
 
 doDelete ()
 Delete remote object. More...
 
 doRead ()
 read settings More...
 
 createFromECSEContent (ilECSSetting $a_server, $a_ecs_content, $a_owner)
 create remote object from ECSContent object More...
 
 updateFromECSContent (ilECSSetting $a_server, $a_ecs_content, $a_owner)
 update remote object settings from ecs content More...
 
 isLocalObject ()
 Is remote object from same installation? More...
 
 handleCreate (ilECSSetting $a_server, $a_econtent_id, array $a_mids)
 Handle creation. More...
 
 handleUpdate (ilECSSetting $a_server, $a_econtent_id, array $a_mids)
 Handle update event. More...
 
 handleDelete (ilECSSetting $a_server, $a_econtent_id, $a_mid=0)
 Handle delete event. More...
 
 getAllResourceIds (ilECSSetting $a_server, $a_sender_only=false)
 Get all available resources. More...
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 
 read ()
 Read data from db. More...
 
 getId ()
 
 setId ($a_id)
 
 setRefId ($a_id)
 
 getRefId ()
 
 getType ()
 
 setType ($a_type)
 
 getPresentationTitle ()
 
 getTitle ()
 
 getUntranslatedTitle ()
 
 setTitle ($a_title)
 
 getDescription ()
 
 setDescription ($a_desc)
 
 getLongDescription ()
 
 getImportId ()
 
 setImportId ($a_import_id)
 
 getOwner ()
 
 getOwnerName ()
 
 setOwner ($a_owner)
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 create ($a_clone_mode=false)
 
 update ()
 
 MDUpdateListener ($a_element)
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 
 putInTree ($a_parent_ref)
 
 setPermissions ($a_parent_ref)
 
 createReference ()
 
 countReferences ()
 
 delete ()
 
 initDefaultRoles ()
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 
 cloneMetaData ($target_obj)
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getInstanceByEventType ($a_type)
 Get instance by ilECSEvent(QueueReader) type. More...
 
static _lookupOrganization ($a_obj_id)
 lookup organization More...
 
static _lookupMID ($a_obj_id)
 lookup owner mid More...
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupOwnerName ($a_owner_id)
 
static _getIdForImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 
static _lookupTitle ($a_id)
 
static _lookupOwner ($a_id)
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 
static _getLastUpdateOfObjects ($a_objs)
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 
static _resetDeletedDate ($a_ref_id)
 
static _lookupDeletedDate ($a_ref_id)
 
static _writeTitle ($a_obj_id, $a_title)
 
static _writeDescription ($a_obj_id, $a_desc)
 
static _writeImportId ($a_obj_id, $a_import_id)
 
static _lookupType ($a_id, $a_reference=false)
 
static _isInTrash ($a_ref_id)
 
static _hasUntrashedReference ($a_obj_id)
 
static _lookupObjectId ($a_ref_id)
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $a_show_path=true)
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const MAIL_SENDER = 6
 
const OBJECT_OWNER = 6
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 getTableName ()
 Get db table name. More...
 
 getECSObjectType ()
 Get ECS resource identifier, e.g. More...
 
 doCreateCustomFields (array &$a_fields)
 Add custom fields to db insert. More...
 
 doUpdateCustomFields (array &$a_fields)
 Add custom fields to db update. More...
 
 doReadCustomFields ($a_row)
 Read custom fields from db row. More...
 
 importMetadataFromJson ($a_json, ilECSSetting $a_server, array $a_definition, $a_mapping_mode)
 Add advanced metadata to json (export) More...
 
 updateCustomFromECSContent (ilECSSetting $a_server, $ecs_content)
 update remote object settings from ecs content More...
 
 sendNewContentNotification ($a_server_id)
 send notifications about new EContent More...
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate ()
 
 beforeCreate ()
 
 doUpdate ()
 
 beforeUpdate ()
 
 doMDUpdateListener ($a_element)
 
 beforeMDUpdateListener ($a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null)
 
 beforeCloneObject ()
 

Protected Attributes

 $local_information
 
 $remote_link
 
 $organization
 
 $mid
 
 $auth_hash = ''
 
 $realm_plain = ''
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Remote object app base class.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilRemoteObjectBase::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor.

Parameters
int$a_id
bool$a_call_by_reference
Returns
ilObject

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

References $DIC, and $ilDB.

36  {
37  global $DIC;
38 
39  $ilDB = $DIC['ilDB'];
40 
41  parent::__construct($a_id, $a_call_by_reference);
42  $this->db = $ilDB;
43  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ _lookupMID()

static ilRemoteObjectBase::_lookupMID (   $a_obj_id)
static

lookup owner mid

Parameters
int$a_obj_idobj_id
Returns
int

Definition at line 204 of file class.ilRemoteObjectBase.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSSettingsGUI\exportImported(), and ilECSImportedContentTableGUI\parse().

205  {
206  global $DIC;
207 
208  $ilDB = $DIC['ilDB'];
209 
210  $query = "SELECT mid FROM " . static::DB_TABLE_NAME .
211  " WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
212  $res = $ilDB->query($query);
213  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
214  return $row->mid;
215  }
216  return 0;
217  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupOrganization()

static ilRemoteObjectBase::_lookupOrganization (   $a_obj_id)
static

lookup organization

Parameters
int$a_obj_id
Returns
string

Definition at line 114 of file class.ilRemoteObjectBase.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjRemoteCategoryListGUI\getProperties(), ilObjRemoteWikiListGUI\getProperties(), ilObjRemoteTestListGUI\getProperties(), ilObjRemoteLearningModuleListGUI\getProperties(), ilObjRemoteGroupListGUI\getProperties(), ilObjRemoteGlossaryListGUI\getProperties(), ilObjRemoteFileListGUI\getProperties(), and ilObjRemoteCourseListGUI\getProperties().

115  {
116  global $DIC;
117 
118  $ilDB = $DIC['ilDB'];
119 
120  $query = "SELECT organization FROM " . static::DB_TABLE_NAME .
121  " WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
122  $res = $ilDB->query($query);
123  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
124  return $row->organization;
125  }
126  return '';
127  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ beforeCreate()

ilRemoteObjectBase::beforeCreate ( )

Definition at line 88 of file class.ilRemoteObjectBase.php.

References getECSObjectType(), getTableName(), and ilObject2\setOwner().

89  {
90  $this->setOwner(self::OBJECT_OWNER);
91  return parent::beforeCreate();
92  }
setOwner($a_owner)
+ Here is the call graph for this function:

◆ createAuthResource()

ilRemoteObjectBase::createAuthResource (   $a_plain_realm)

create authentication resource on ecs server

Returns
bool
Exceptions
ilECSConnectorException

Definition at line 287 of file class.ilRemoteObjectBase.php.

References $auth, $auth_hash, $DIC, $GLOBALS, $ilLog, ilObject2\getId(), ilECSSetting\getInstanceByServerId(), getMID(), getRemoteLink(), and ilECSImport\lookupServerId().

Referenced by getFullRemoteLink().

288  {
289  global $DIC;
290 
291  $ilLog = $DIC['ilLog'];
292 
293  include_once './Services/WebServices/ECS/classes/class.ilECSAuth.php';
294  include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
295  include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
296  include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
297 
298  try {
299  $server_id = ilECSImport::lookupServerId($this->getId());
300  $import_info = new ilECSImport($server_id, $this->getId());
301 
302  $connector = new ilECSConnector(ilECSSetting::getInstanceByServerId($server_id));
303  $auth = new ilECSAuth();
304  $auth->setPid($import_info->getMID());
305  // URL is deprecated
306  $auth->setUrl($this->getRemoteLink());
307  $realm = sha1($a_plain_realm);
308  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Using realm ' . $a_plain_realm);
309  $auth->setRealm($realm);
310  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ' Mid is ' . $this->getMID());
311  $this->auth_hash = $connector->addAuth(@json_encode($auth), $this->getMID());
312  return $this->auth_hash;
313  } catch (ilECSConnectorException $exc) {
314  $ilLog->write(__METHOD__ . ': Caught error from ECS Auth resource: ' . $exc->getMessage());
315  return false;
316  }
317  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getRemoteLink()
get remote link
global $DIC
Definition: saml.php:7
$auth
Definition: fileserver.php:48
Storage of ECS imported objects.
static lookupServerId($a_obj_id)
Lookup server id of imported content <type> $ilDB.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFromECSEContent()

ilRemoteObjectBase::createFromECSEContent ( ilECSSetting  $a_server,
  $a_ecs_content,
  $a_owner 
)

create remote object from ECSContent object

Parameters
ilECSSetting$a_server
object$a_ecs_contentobject with object settings
int$a_owner

Definition at line 431 of file class.ilRemoteObjectBase.php.

References ilObject\create(), ilObject2\createReference(), getECSObjectType(), ilECSSetting\getImportId(), ilECSUtils\getMatchableContent(), ilECSCategoryMapping\getMatchingCategory(), ilECSSetting\getServerId(), ilObject2\putInTree(), ilObject2\setPermissions(), and updateFromECSContent().

Referenced by handleUpdate().

432  {
433  $this->create();
434 
435  // won't work for personal workspace
436  $this->createReference();
437  $this->setPermissions($a_server->getImportId());
438 
439  include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
440  $matchable_content = ilECSUtils::getMatchableContent(
441  $this->getECSObjectType(),
442  $a_server->getServerId(),
443  $a_ecs_content,
444  $a_owner
445  );
446 
447  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
449  $a_server->getServerId(),
450  $matchable_content
451  ));
452 
453  $this->updateFromECSContent($a_server, $a_ecs_content, $a_owner);
454  }
putInTree($a_parent_ref)
getServerId()
Get current server id.
getImportId()
get import id
setPermissions($a_parent_ref)
getECSObjectType()
Get ECS resource identifier, e.g.
static getMatchableContent($a_resource_id, $a_server_id, $a_ecs_content, $a_owner)
Convert ECS content to rule matchable values.
create()
create
static getMatchingCategory($a_server_id, $a_matchable_content)
get matching category
updateFromECSContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
update remote object settings from ecs content
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCreate()

ilRemoteObjectBase::doCreate ( )

Create remote object.

Definition at line 322 of file class.ilRemoteObjectBase.php.

References $DIC, $ilDB, doCreateCustomFields(), ilObject2\getId(), and getTableName().

323  {
324  global $DIC;
325 
326  $ilDB = $DIC['ilDB'];
327 
328  $fields = array(
329  "obj_id" => array("integer", $this->getId()),
330  "local_information" => array("text", ""),
331  "remote_link" => array("text", ""),
332  "mid" => array("integer", 0),
333  "organization" => array("text", "")
334  );
335 
336  $this->doCreateCustomFields($fields);
337 
338  $ilDB->insert($this->getTableName(), $fields);
339  }
getTableName()
Get db table name.
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ doCreateCustomFields()

ilRemoteObjectBase::doCreateCustomFields ( array &  $a_fields)
protected

Add custom fields to db insert.

Parameters
array$a_fields

Definition at line 345 of file class.ilRemoteObjectBase.php.

Referenced by doCreate().

346  {
347  }
+ Here is the caller graph for this function:

◆ doDelete()

ilRemoteObjectBase::doDelete ( )

Delete remote object.

Definition at line 383 of file class.ilRemoteObjectBase.php.

References $DIC, $ilDB, $query, ilECSImport\_deleteByObjId(), ilObject2\getId(), and getTableName().

384  {
385  global $DIC;
386 
387  $ilDB = $DIC['ilDB'];
388 
389  //put here your module specific stuff
390  include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
392 
393  $query = "DELETE FROM " . $this->getTableName() .
394  " WHERE obj_id = " . $this->db->quote($this->getId(), 'integer') . " ";
395  $ilDB->manipulate($query);
396  }
getTableName()
Get db table name.
global $DIC
Definition: saml.php:7
static _deleteByObjId($a_obj_id)
Delete by obj_id.
$query
global $ilDB
+ Here is the call graph for this function:

◆ doRead()

ilRemoteObjectBase::doRead ( )

read settings

Definition at line 401 of file class.ilRemoteObjectBase.php.

References $query, $res, $row, doReadCustomFields(), ilDBConstants\FETCHMODE_OBJECT, ilObject2\getId(), getTableName(), setLocalInformation(), setMID(), setOrganization(), and setRemoteLink().

402  {
403  $query = "SELECT * FROM " . $this->getTableName() .
404  " WHERE obj_id = " . $this->db->quote($this->getId(), 'integer') . " ";
405  $res = $this->db->query($query);
406  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
407  $this->setLocalInformation($row->local_information);
408  $this->setRemoteLink($row->remote_link);
409  $this->setMID($row->mid);
410  $this->setOrganization($row->organization);
411 
412  $this->doReadCustomFields($row);
413  }
414  }
getTableName()
Get db table name.
setRemoteLink($a_link)
set remote link
doReadCustomFields($a_row)
Read custom fields from db row.
setOrganization($a_organization)
set organization
foreach($_POST as $key=> $value) $res
setLocalInformation($a_info)
set local information
$query
$row
+ Here is the call graph for this function:

◆ doReadCustomFields()

ilRemoteObjectBase::doReadCustomFields (   $a_row)
protected

Read custom fields from db row.

Parameters
object$a_row

Definition at line 420 of file class.ilRemoteObjectBase.php.

Referenced by doRead().

421  {
422  }
+ Here is the caller graph for this function:

◆ doUpdate()

ilRemoteObjectBase::doUpdate ( )

Update remote object.

Definition at line 352 of file class.ilRemoteObjectBase.php.

References $DIC, $ilDB, doUpdateCustomFields(), ilObject2\getId(), getLocalInformation(), getMID(), getOrganization(), getRemoteLink(), and getTableName().

353  {
354  global $DIC;
355 
356  $ilDB = $DIC['ilDB'];
357 
358  $fields = array(
359  "local_information" => array("text", $this->getLocalInformation()),
360  "remote_link" => array("text", $this->getRemoteLink()),
361  "mid" => array("integer", $this->getMID()),
362  "organization" => array("text", $this->getOrganization())
363  );
364 
365  $this->doUpdateCustomFields($fields);
366 
367  $where = array("obj_id" => array("integer", $this->getId()));
368 
369  $ilDB->update($this->getTableName(), $fields, $where);
370  }
getTableName()
Get db table name.
getOrganization()
get organization
getRemoteLink()
get remote link
global $DIC
Definition: saml.php:7
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
global $ilDB
getLocalInformation()
get local information
+ Here is the call graph for this function:

◆ doUpdateCustomFields()

ilRemoteObjectBase::doUpdateCustomFields ( array &  $a_fields)
protected

Add custom fields to db update.

Parameters
array$a_fields

Definition at line 376 of file class.ilRemoteObjectBase.php.

Referenced by doUpdate().

377  {
378  }
+ Here is the caller graph for this function:

◆ getAllResourceIds()

ilRemoteObjectBase::getAllResourceIds ( ilECSSetting  $a_server,
  $a_sender_only = false 
)

Get all available resources.

Parameters
ilECSSetting$a_server
bool$a_sender_only
Returns
array

Definition at line 823 of file class.ilRemoteObjectBase.php.

References $DIC, $ilLog, $list, and getECSObjectType().

824  {
825  global $DIC;
826 
827  $ilLog = $DIC['ilLog'];
828 
829  try {
830  include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
831  $connector = new ilECSConnector($a_server);
832  $connector->addHeader('X-EcsQueryStrings', $a_sender_only ? 'sender=true' : 'all=true'); // #11301
833  $list = $connector->getResourceList($this->getECSObjectType());
834  if ($list instanceof ilECSResult) {
835  return $list->getResult()->getLinkIds();
836  }
837  } catch (ilECSConnectorException $exc) {
838  $ilLog->write(__METHOD__ . ': Error getting resource list. ' . $exc->getMessage());
839  }
840  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
getECSObjectType()
Get ECS resource identifier, e.g.
+ Here is the call graph for this function:

◆ getECSObjectType()

ilRemoteObjectBase::getECSObjectType ( )
abstractprotected

Get ECS resource identifier, e.g.

"/campusconnect/courselinks"

Returns
string

Referenced by beforeCreate(), createFromECSEContent(), getAllResourceIds(), handleUpdate(), and updateFromECSContent().

+ Here is the caller graph for this function:

◆ getFullRemoteLink()

ilRemoteObjectBase::getFullRemoteLink ( )

get full remote link Including ecs generated hash and auth mode

Returns
string
Exceptions
ilECSConnectorException

Definition at line 246 of file class.ilRemoteObjectBase.php.

References $auth_hash, $DIC, $GLOBALS, $ilUser, $server, $user, createAuthResource(), ilObject2\getId(), ilECSSetting\getInstanceByServerId(), getMID(), getRemoteLink(), and ilECSImport\lookupServerId().

247  {
248  global $DIC;
249 
250  $ilUser = $DIC['ilUser'];
251 
252 
253  include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
254  $server_id = ilECSImport::lookupServerId($this->getId());
256 
257  include_once('./Services/WebServices/ECS/classes/class.ilECSUser.php');
258  $user = new ilECSUser($ilUser);
259  $ecs_user_data = $user->toGET();
260  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Using ecs user data ' . $ecs_user_data);
261 
262  // check token mechanism enabled
263  include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
264  $part = new ilECSParticipantSetting($server_id, $this->getMID());
265  if (!$part->isTokenEnabled()) {
266  return $this->getRemoteLink();
267  }
268 
269  $auth_hash = $this->createAuthResource($this->getRemoteLink() . $user->toREALM());
270  $ecs_url_hash = 'ecs_hash_url=' . urlencode($server->getServerURI() . '/sys/auths/' . $auth_hash);
271 
272  if (strpos($this->getRemoteLink(), '?')) {
273  $link = $this->getRemoteLink() . '&ecs_hash=' . $auth_hash . $ecs_user_data . '&' . $ecs_url_hash;
274  } else {
275  $link = $this->getRemoteLink() . '?ecs_hash=' . $auth_hash . $ecs_user_data . '&' . $ecs_url_hash;
276  }
277  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ECS full link: ' . $link);
278  return $link;
279  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getRemoteLink()
get remote link
global $DIC
Definition: saml.php:7
$server
Definition: sabredav.php:48
$ilUser
Definition: imgupload.php:18
static lookupServerId($a_obj_id)
Lookup server id of imported content <type> $ilDB.
$user
Definition: migrateto20.php:57
createAuthResource($a_plain_realm)
create authentication resource on ecs server
Stores relevant user data.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ getInstanceByEventType()

static ilRemoteObjectBase::getInstanceByEventType (   $a_type)
static

Get instance by ilECSEvent(QueueReader) type.

Parameters
int$a_type
Returns
ilRemoteObjectBase

Definition at line 51 of file class.ilRemoteObjectBase.php.

References $a_type, ilECSEventQueueReader\TYPE_REMOTE_CATEGORY, ilECSEventQueueReader\TYPE_REMOTE_COURSE, ilECSEventQueueReader\TYPE_REMOTE_FILE, ilECSEventQueueReader\TYPE_REMOTE_GLOSSARY, ilECSEventQueueReader\TYPE_REMOTE_GROUP, ilECSEventQueueReader\TYPE_REMOTE_LEARNING_MODULE, ilECSEventQueueReader\TYPE_REMOTE_TEST, and ilECSEventQueueReader\TYPE_REMOTE_WIKI.

Referenced by ilECSEventQueueReader\getAllResourceIds(), and ilECSTaskScheduler\handleEvents().

52  {
53  switch ($a_type) {
55  include_once 'Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php';
56  return new ilObjRemoteCourse();
57 
59  include_once 'Modules/RemoteCategory/classes/class.ilObjRemoteCategory.php';
60  return new ilObjRemoteCategory();
61 
63  include_once 'Modules/RemoteFile/classes/class.ilObjRemoteFile.php';
64  return new ilObjRemoteFile();
65 
67  include_once 'Modules/RemoteGlossary/classes/class.ilObjRemoteGlossary.php';
68  return new ilObjRemoteGlossary();
69 
71  include_once 'Modules/RemoteGroup/classes/class.ilObjRemoteGroup.php';
72  return new ilObjRemoteGroup();
73 
75  include_once 'Modules/RemoteLearningModule/classes/class.ilObjRemoteLearningModule.php';
76  return new ilObjRemoteLearningModule();
77 
79  include_once 'Modules/RemoteWiki/classes/class.ilObjRemoteWiki.php';
80  return new ilObjRemoteWiki();
81 
83  include_once 'Modules/RemoteTest/classes/class.ilObjRemoteTest.php';
84  return new ilObjRemoteTest();
85  }
86  }
Remote test app class.
Remote file app class.
Remote glossary app class.
Remote learning module app class.
Remote wiki app class.
$a_type
Definition: workflow.php:92
Remote course app class.
Remote group app class.
Remote category app class.
+ Here is the caller graph for this function:

◆ getLocalInformation()

ilRemoteObjectBase::getLocalInformation ( )

get local information

Returns
string

Definition at line 163 of file class.ilRemoteObjectBase.php.

References $local_information.

Referenced by doUpdate().

164  {
166  }
+ Here is the caller graph for this function:

◆ getMID()

ilRemoteObjectBase::getMID ( )

get mid

Returns
int

Definition at line 183 of file class.ilRemoteObjectBase.php.

References $mid.

Referenced by createAuthResource(), doUpdate(), and getFullRemoteLink().

184  {
185  return $this->mid;
186  }
+ Here is the caller graph for this function:

◆ getOrganization()

ilRemoteObjectBase::getOrganization ( )

get organization

Returns
string

Definition at line 153 of file class.ilRemoteObjectBase.php.

References $organization.

Referenced by doUpdate().

154  {
155  return $this->organization;
156  }
+ Here is the caller graph for this function:

◆ getRealmPlain()

ilRemoteObjectBase::getRealmPlain ( )

Get realm plain.

Returns
type

Definition at line 133 of file class.ilRemoteObjectBase.php.

References $realm_plain.

134  {
135  return $this->realm_plain;
136  }

◆ getRemoteLink()

ilRemoteObjectBase::getRemoteLink ( )

get remote link

Returns
string

Definition at line 234 of file class.ilRemoteObjectBase.php.

References $remote_link.

Referenced by createAuthResource(), doUpdate(), and getFullRemoteLink().

235  {
236  return $this->remote_link;
237  }
+ Here is the caller graph for this function:

◆ getTableName()

ilRemoteObjectBase::getTableName ( )
abstractprotected

Get db table name.

Returns
string

Referenced by beforeCreate(), doCreate(), doDelete(), doRead(), and doUpdate().

+ Here is the caller graph for this function:

◆ handleCreate()

ilRemoteObjectBase::handleCreate ( ilECSSetting  $a_server,
  $a_econtent_id,
array  $a_mids 
)

Handle creation.

called by ilTaskScheduler

Parameters
ilECSSetting$a_server
type$a_econtent_id
array$a_mids

Definition at line 633 of file class.ilRemoteObjectBase.php.

References handleUpdate().

634  {
635  return $this->handleUpdate($a_server, $a_econtent_id, $a_mids);
636  }
handleUpdate(ilECSSetting $a_server, $a_econtent_id, array $a_mids)
Handle update event.
+ Here is the call graph for this function:

◆ handleDelete()

ilRemoteObjectBase::handleDelete ( ilECSSetting  $a_server,
  $a_econtent_id,
  $a_mid = 0 
)

Handle delete event.

called by ilTaskScheduler

Parameters
ilECSSetting$a_server
int$a_econtent_id
int$a_mid
Returns
boolean

Definition at line 787 of file class.ilRemoteObjectBase.php.

References $DIC, $ilLog, ilObject\$ref_id, ilObject\$tree, ilObject\_getAllReferences(), ilECSImport\_lookupObjIds(), ilObjectFactory\getInstanceByRefId(), and ilECSSetting\getServerId().

Referenced by handleUpdate().

788  {
789  global $DIC;
790 
791  $tree = $DIC['tree'];
792  $ilLog = $DIC['ilLog'];
793 
794 
795  include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
796 
797  // there is no information about the original mid anymore.
798  // Therefor delete any remote objects with given econtent id
799  $obj_ids = ilECSImport::_lookupObjIds($a_server->getServerId(), $a_econtent_id);
800  $ilLog->write(__METHOD__ . ': Received obj_ids ' . print_r($obj_ids, true));
801 
802  foreach ($obj_ids as $obj_id) {
803  $references = ilObject::_getAllReferences($obj_id);
804  foreach ($references as $ref_id) {
805  if ($tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id, false)) {
806  $ilLog->write(__METHOD__ . ': Deleting obsolete remote course: ' . $tmp_obj->getTitle());
807  $tmp_obj->delete();
808  $tree->deleteTree($tree->getNodeData($ref_id));
809  }
810  unset($tmp_obj);
811  }
812  }
813  return true;
814  }
getServerId()
Get current server id.
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjIds($a_server_id, $a_econtent_id)
Lookup obj_id.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleUpdate()

ilRemoteObjectBase::handleUpdate ( ilECSSetting  $a_server,
  $a_econtent_id,
array  $a_mids 
)

Handle update event.

called by ilTaskScheduler

Parameters
ilECSSetting$a_server
int$a_econtent_id
array$a_mids
Returns
boolean

Definition at line 648 of file class.ilRemoteObjectBase.php.

References $DIC, $GLOBALS, $ilLog, $mid, $res, ilECSImport\_isImported(), createFromECSEContent(), getECSObjectType(), ilObject2\getId(), ilECSEContentDetails\getInstance(), ilObjectFactory\getInstanceByObjId(), ilECSParticipantSettings\getInstanceByServerId(), ilECSSetting\getServerId(), handleDelete(), ilECSConnector\HTTP_CODE_NOT_FOUND, sendNewContentNotification(), and ilECSImport\setEContentId().

Referenced by handleCreate().

649  {
650  global $DIC;
651 
652  $ilLog = $DIC['ilLog'];
653 
654  // get content details
655  include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
657  $a_server->getServerId(),
658  $a_econtent_id,
659  $this->getECSObjectType()
660  );
661  if (!$details instanceof ilECSEContentDetails) {
662  $this->handleDelete($a_server, $a_econtent_id);
663  $ilLog->write(__METHOD__ . ': Handling delete of deprecated remote object. DONE');
664  return;
665  }
666 
667  $ilLog->write(__METHOD__ . ': Receivers are ' . print_r($details->getReceivers(), true));
668  $ilLog->write(__METHOD__ . ': Senders are ' . print_r($details->getSenders(), true));
669 
670  // check owner (sender mid)
671  include_once('./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
672  if (!ilECSParticipantSettings::getInstanceByServerId($a_server->getServerId())->isImportAllowed($details->getSenders())) {
673  $ilLog->write('Ignoring disabled participant. MID: ' . $details->getOwner());
674  return true;
675  }
676 
677  // new mids
678  include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
679  include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
680  foreach (array_intersect($a_mids, $details->getReceivers()) as $mid) {
681  try {
682  $connector = new ilECSConnector($a_server);
683  $res = $connector->getResource($this->getECSObjectType(), $a_econtent_id);
684  if ($res->getHTTPCode() == ilECSConnector::HTTP_CODE_NOT_FOUND) {
685  continue;
686  }
687  $json = $res->getResult();
688  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Received json: ' . print_r($json, true));
689  if (!is_object($json)) {
690  // try as array (workaround for invalid content)
691  $json = $json[0];
692  if (!is_object($json)) {
693  throw new ilECSConnectorException('invalid json');
694  }
695  }
696  } catch (ilECSConnectorException $exc) {
697  $ilLog->write(__METHOD__ . ': Error parsing result. ' . $exc->getMessage());
698  $ilLog->logStack();
699  return false;
700  }
701 
702  // Update existing
703 
704  // Check receiver mid
705  if ($obj_id = ilECSImport::_isImported($a_server->getServerId(), $a_econtent_id, $mid)) {
706  $ilLog->write(__METHOD__ . ': Handling update for existing object');
707  $remote = ilObjectFactory::getInstanceByObjId($obj_id, false);
708  if (!$remote instanceof ilRemoteObjectBase) {
709  $ilLog->write(__METHOD__ . ': Cannot instantiate remote object. Got object type ' . $remote->getType());
710  continue;
711  }
712  $remote->updateFromECSContent($a_server, $json, $details->getMySender());
713  } else {
714  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': my sender ' . $details->getMySender() . 'vs mid' . $mid);
715 
716  $ilLog->write(__METHOD__ . ': Handling create for non existing object');
717  $this->createFromECSEContent($a_server, $json, $details->getMySender());
718 
719  // update import status
720  $ilLog->write(__METHOD__ . ': Updating import status');
721  include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
722  $import = new ilECSImport($a_server->getServerId(), $this->getId());
723  $import->setEContentId($a_econtent_id);
724  // Store receiver mid
725  $import->setMID($mid);
726  $import->save();
727 
728  $ilLog->write(__METHOD__ . ': Sending notification');
729  $this->sendNewContentNotification($a_server->getServerId());
730  }
731  }
732 
733  $ilLog->write(__METHOD__ . ': done');
734  return true;
735  }
sendNewContentNotification($a_server_id)
send notifications about new EContent
getServerId()
Get current server id.
global $DIC
Definition: saml.php:7
handleDelete(ilECSSetting $a_server, $a_econtent_id, $a_mid=0)
Handle delete event.
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
getECSObjectType()
Get ECS resource identifier, e.g.
static getInstanceByServerId($a_server_id)
Get instance by server id.
foreach($_POST as $key=> $value) $res
Storage of ECS imported objects.
static _isImported($a_server_id, $a_econtent_id, $a_mid, $a_sub_id=null)
check if econtent is imported for a specific mid
Remote object app base class.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
setEContentId($a_id)
set econtent id
createFromECSEContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
create remote object from ECSContent object
static getInstance($a_server_id, $a_econtent_id, $a_resource_type)
Get data from server.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importMetadataFromJson()

ilRemoteObjectBase::importMetadataFromJson (   $a_json,
ilECSSetting  $a_server,
array  $a_definition,
  $a_mapping_mode 
)
protected

Add advanced metadata to json (export)

Parameters
object$a_json
ilECSSetting$a_server
array$a_definition
int$a_mapping_mode

Definition at line 518 of file class.ilRemoteObjectBase.php.

References $additional, $DIC, ilObject\$id, $ilLog, $target, ilObject\$type, ilObject2\getId(), ilECSDataMappingSettings\getInstanceByServerId(), ilAdvancedMDValues\getInstancesForObjectId(), ilECSSetting\getServerId(), ilObject2\getType(), and ilECSUtils\TYPE_TIMEPLACE.

Referenced by ilObjRemoteCourse\updateCustomFromECSContent().

519  {
520  global $DIC;
521 
522  $ilLog = $DIC['ilLog'];
523 
524  $ilLog->write("importing metadata from json: " . print_r($a_json, true));
525 
526  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
527  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
528  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
529 
531  $values_records = ilAdvancedMDValues::getInstancesForObjectId($this->getId(), $this->getType());
532  foreach ($values_records as $values_record) {
533  // this correctly binds group and definitions
534  $values_record->read();
535  }
536 
537  $do_save = false;
538 
539  foreach ($a_definition as $id => $type) {
540  if (is_array($type)) {
541  $target = $type[1];
542  $type = $type[0];
543  } else {
544  $target = $id;
545  }
546 
547  $timePlace = null;
548  if ($field = $mappings->getMappingByECSName($a_mapping_mode, $id)) {
549  // find element in records
550  $adv_md_def = null;
551  foreach ($values_records as $values_record) {
552  $adv_md_defs = $values_record->getDefinitions();
553  if (isset($adv_md_defs[$field])) {
554  $adv_md_def = $adv_md_defs[$field];
555  break;
556  }
557  }
558  if (!$adv_md_def) {
559  continue;
560  }
561 
562  $raw_value = $a_json->$target;
563 
565  if (!is_object($timePlace)) {
566  include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
567  if (is_object($raw_value)) {
568  $timePlace = new ilECSTimePlace();
569  $timePlace->loadFromJSON($raw_value);
570  } else {
571  $timePlace = new ilECSTimePlace();
572  }
573  }
574  $raw_value = $timePlace;
575  }
576 
577  if ($adv_md_def->importFromECS($type, $raw_value, $id)) {
578  $do_save = true;
579  }
580  }
581  }
582 
583  if ($do_save) {
584  foreach ($values_records as $values_record) {
585  $additional = array();
586  foreach ($values_record->getADTGroup()->getElements() as $element_id => $element) {
587  if (!$element->isNull()) {
588  $additional[$element_id] = array("disabled" => array("integer", 1));
589  }
590  }
591  $values_record->write($additional);
592  }
593  }
594  }
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
static getInstanceByServerId($a_server_id)
Get singleton instance.
Representation of ECS EContent Time Place.
getServerId()
Get current server id.
global $DIC
Definition: saml.php:7
const TYPE_TIMEPLACE
$additional
Definition: goto.php:50
$target
Definition: test.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLocalObject()

ilRemoteObjectBase::isLocalObject ( )

Is remote object from same installation?

Returns
boolean

Definition at line 611 of file class.ilRemoteObjectBase.php.

References ilECSExport\_isRemote(), ilECSImport\_lookupEContentId(), ilObject2\getId(), and ilECSImport\lookupServerId().

612  {
613  include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
614  include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
618  )) {
619  return false;
620  }
621  return true;
622  }
static _lookupEContentId($a_obj_id)
get econent_id
static _isRemote($a_server_id, $a_econtent_id)
is remote object
static lookupServerId($a_obj_id)
Lookup server id of imported content <type> $ilDB.
+ Here is the call graph for this function:

◆ sendNewContentNotification()

ilRemoteObjectBase::sendNewContentNotification (   $a_server_id)
protected

send notifications about new EContent

Definition at line 740 of file class.ilRemoteObjectBase.php.

References ilObject\$desc, $lang, $message, ilMail\_getAutoGeneratedMessageString(), ilLanguageFactory\_getLanguage(), ilLink\_getStaticLink(), ilObject2\getDescription(), ilECSSetting\getInstanceByServerId(), ilObject2\getRefId(), ilObject2\getTitle(), and ilObject2\getType().

Referenced by handleUpdate().

741  {
742  include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
743  $settings = ilECSSetting::getInstanceByServerId($a_server_id);
744  if (!count($rcps = $settings->getEContentRecipients())) {
745  return;
746  }
747 
748  include_once('./Services/Mail/classes/class.ilMail.php');
749  include_once('./Services/Language/classes/class.ilLanguageFactory.php');
750 
752  $lang->loadLanguageModule('ecs');
753 
754  $mail = new ilMail(self::MAIL_SENDER);
755  $message = $lang->txt('ecs_' . $this->getType() . '_created_body_a') . "\n\n";
756  $message .= $lang->txt('title') . ': ' . $this->getTitle() . "\n";
757  if (strlen($desc = $this->getDescription())) {
758  $message .= $lang->txt('desc') . ': ' . $desc . "\n";
759  }
760 
761  include_once('./Services/Link/classes/class.ilLink.php');
762  $href = ilLink::_getStaticLink($this->getRefId(), $this->getType(), true);
763  $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n";
765 
766  $mail->sendMail(
767  $settings->getEContentRecipientsAsString(),
768  '',
769  '',
770  $lang->txt('ecs_new_econtent_subject'),
771  $message,
772  array(),
773  array('normal')
774  );
775  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
static _getLanguage($a_lang_key='')
Get langauge object.
catch(Exception $e) $message
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
Get auto generated info string.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLocalInformation()

ilRemoteObjectBase::setLocalInformation (   $a_info)

set local information

Parameters
string$a_info

Definition at line 173 of file class.ilRemoteObjectBase.php.

Referenced by doRead().

174  {
175  $this->local_information = $a_info;
176  }
+ Here is the caller graph for this function:

◆ setMID()

ilRemoteObjectBase::setMID (   $a_mid)

set mid

Parameters
int$a_midmid

Definition at line 193 of file class.ilRemoteObjectBase.php.

Referenced by doRead(), and updateFromECSContent().

194  {
195  $this->mid = $a_mid;
196  }
+ Here is the caller graph for this function:

◆ setOrganization()

ilRemoteObjectBase::setOrganization (   $a_organization)

set organization

Parameters
string$a_organization

Definition at line 143 of file class.ilRemoteObjectBase.php.

Referenced by doRead(), and updateFromECSContent().

144  {
145  $this->organization = $a_organization;
146  }
+ Here is the caller graph for this function:

◆ setRemoteLink()

ilRemoteObjectBase::setRemoteLink (   $a_link)

set remote link

Parameters
string$a_linklink to original object

Definition at line 224 of file class.ilRemoteObjectBase.php.

Referenced by doRead(), and updateFromECSContent().

225  {
226  $this->remote_link = $a_link;
227  }
+ Here is the caller graph for this function:

◆ updateCustomFromECSContent()

ilRemoteObjectBase::updateCustomFromECSContent ( ilECSSetting  $a_server,
  $ecs_content 
)
protected

update remote object settings from ecs content

Parameters
ilECSSetting$a_server
object$a_ecs_contentobject with object settings

Definition at line 602 of file class.ilRemoteObjectBase.php.

Referenced by updateFromECSContent().

603  {
604  }
+ Here is the caller graph for this function:

◆ updateFromECSContent()

ilRemoteObjectBase::updateFromECSContent ( ilECSSetting  $a_server,
  $a_ecs_content,
  $a_owner 
)

update remote object settings from ecs content

Parameters
ilECSSetting$a_server
object$a_ecs_contentobject with object settings
int$a_owner

Definition at line 463 of file class.ilRemoteObjectBase.php.

References $DIC, $ilLog, getECSObjectType(), ilObject2\getId(), ilECSUtils\getMatchableContent(), ilECSSetting\getServerId(), ilECSCategoryMapping\handleUpdate(), ilECSUtils\lookupParticipantName(), ilObject2\setDescription(), setMID(), setOrganization(), setRemoteLink(), ilObject2\setTitle(), ilObject2\update(), and updateCustomFromECSContent().

Referenced by createFromECSEContent().

464  {
465  global $DIC;
466 
467  $ilLog = $DIC['ilLog'];
468 
469  $ilLog->write('updateFromECSContent: ' . print_r($a_ecs_content, true));
470 
471  // Get organisation for owner (ObjectListGUI performance)
472  $organisation = null;
473  if ($a_owner) {
474  include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
475  $organisation = ilECSUtils::lookupParticipantName($a_owner, $a_server->getServerId());
476  $ilLog->write('found organisation: ' . $organisation);
477  }
478 
479  $this->setMID($a_owner); // obsolete?
480  $this->setOrganization($organisation);
481  $this->setTitle($a_ecs_content->title);
482  $this->setDescription($a_ecs_content->abstract);
483  $this->setRemoteLink($a_ecs_content->url);
484 
485  $ilLog->write('updateCustomFromECSContent');
486  $this->updateCustomFromECSContent($a_server, $a_ecs_content);
487 
488  // we are updating late so custom values can be set
489 
490  $ilLog->write('ilObject->update()');
491  $this->update();
492 
493  include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
494  $matchable_content = ilECSUtils::getMatchableContent(
495  $this->getECSObjectType(),
496  $a_server->getServerId(),
497  $a_ecs_content,
498  $a_owner
499  );
500 
501  // rule-based category mapping
502  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
504  $this->getId(),
505  $a_server->getServerId(),
506  $matchable_content
507  );
508  }
static lookupParticipantName($a_owner, $a_server_id)
Lookup participant name.
setDescription($a_desc)
getServerId()
Get current server id.
global $DIC
Definition: saml.php:7
static handleUpdate($a_obj_id, $a_server_id, $a_matchable_content)
Handle update of ecs content and create references.
setRemoteLink($a_link)
set remote link
updateCustomFromECSContent(ilECSSetting $a_server, $ecs_content)
update remote object settings from ecs content
getECSObjectType()
Get ECS resource identifier, e.g.
static getMatchableContent($a_resource_id, $a_server_id, $a_ecs_content, $a_owner)
Convert ECS content to rule matchable values.
setOrganization($a_organization)
set organization
setTitle($a_title)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $auth_hash

ilRemoteObjectBase::$auth_hash = ''
protected

Definition at line 21 of file class.ilRemoteObjectBase.php.

Referenced by createAuthResource(), and getFullRemoteLink().

◆ $local_information

ilRemoteObjectBase::$local_information
protected

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

Referenced by getLocalInformation().

◆ $mid

ilRemoteObjectBase::$mid
protected

Definition at line 20 of file class.ilRemoteObjectBase.php.

Referenced by getMID(), and handleUpdate().

◆ $organization

ilRemoteObjectBase::$organization
protected

Definition at line 19 of file class.ilRemoteObjectBase.php.

Referenced by getOrganization().

◆ $realm_plain

ilRemoteObjectBase::$realm_plain = ''
protected

Definition at line 23 of file class.ilRemoteObjectBase.php.

Referenced by getRealmPlain().

◆ $remote_link

ilRemoteObjectBase::$remote_link
protected

Definition at line 18 of file class.ilRemoteObjectBase.php.

Referenced by getRemoteLink().

◆ MAIL_SENDER

const ilRemoteObjectBase::MAIL_SENDER = 6

Definition at line 25 of file class.ilRemoteObjectBase.php.

◆ OBJECT_OWNER

const ilRemoteObjectBase::OBJECT_OWNER = 6

Definition at line 26 of file class.ilRemoteObjectBase.php.


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