ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 Read data from db. More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ($a_clone_mode=false)
 
 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! 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) @access public More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. 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, $a_table)
 lookup organization More...
 
static _lookupMID ($a_obj_id, $a_table)
 lookup owner mid More...
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type)
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public 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 _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. 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 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
 
 $ilias
 
 $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
 
 $obj_data_record
 object_data record More...
 

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 = ''
 

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

Reimplemented from ilObject2.

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

36 {
37 global $ilDB;
38
39 parent::__construct($a_id,$a_call_by_reference);
40 $this->db = $ilDB;
41 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ _lookupMID()

static ilRemoteObjectBase::_lookupMID (   $a_obj_id,
  $a_table 
)
static

lookup owner mid

Parameters
int$a_obj_idobj_id
string$a_table
Returns
int

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

205 {
206 global $ilDB;
207
208 $query = "SELECT mid FROM ".$a_table.
209 " WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
210 $res = $ilDB->query($query);
211 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
212 {
213 return $row->mid;
214 }
215 return 0;
216 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjRemoteCategory\_lookupMID(), ilObjRemoteCourse\_lookupMID(), ilObjRemoteFile\_lookupMID(), ilObjRemoteGlossary\_lookupMID(), ilObjRemoteGroup\_lookupMID(), ilObjRemoteLearningModule\_lookupMID(), ilObjRemoteTest\_lookupMID(), and ilObjRemoteWiki\_lookupMID().

+ Here is the caller graph for this function:

◆ _lookupOrganization()

static ilRemoteObjectBase::_lookupOrganization (   $a_obj_id,
  $a_table 
)
static

lookup organization

Parameters
int$a_obj_id
string$a_table
Returns
string

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

115 {
116 global $ilDB;
117
118 $query = "SELECT organization FROM ".$a_table.
119 " WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
120 $res = $ilDB->query($query);
121 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
122 {
123 return $row->organization;
124 }
125 return '';
126 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjRemoteCategory\_lookupOrganization(), ilObjRemoteCourse\_lookupOrganization(), ilObjRemoteFile\_lookupOrganization(), ilObjRemoteGlossary\_lookupOrganization(), ilObjRemoteGroup\_lookupOrganization(), ilObjRemoteLearningModule\_lookupOrganization(), ilObjRemoteTest\_lookupOrganization(), and ilObjRemoteWiki\_lookupOrganization().

+ Here is the caller graph for this function:

◆ beforeCreate()

ilRemoteObjectBase::beforeCreate ( )

Reimplemented from ilObject2.

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

88 {
89 $this->setOwner(self::OBJECT_OWNER);
90 return parent::beforeCreate();
91 }
setOwner($a_owner)
set object owner

References ilObject2\setOwner().

+ 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 289 of file class.ilRemoteObjectBase.php.

290 {
291 global $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 {
300 $server_id = ilECSImport::lookupServerId($this->getId());
301 $import_info = new ilECSImport($server_id, $this->getId());
302
303 $connector = new ilECSConnector(ilECSSetting::getInstanceByServerId($server_id));
304 $auth = new ilECSAuth();
305 $auth->setPid($import_info->getMID());
306 // URL is deprecated
307 $auth->setUrl($this->getRemoteLink());
308 $realm = sha1($a_plain_realm);
309 $GLOBALS['ilLog']->write(__METHOD__.': Using realm '.$a_plain_realm);
310 $auth->setRealm($realm);
311 $GLOBALS['ilLog']->write(__METHOD__.' Mid is '.$this->getMID());
312 $this->auth_hash = $connector->addAuth(@json_encode($auth),$this->getMID());
313 return $this->auth_hash;
314 }
315 catch(ilECSConnectorException $exc)
316 {
317 $ilLog->write(__METHOD__.': Caught error from ECS Auth resource: '.$exc->getMessage());
318 return false;
319 }
320 }
Storage of ECS imported objects.
static lookupServerId($a_obj_id)
Lookup server id of imported content @global <type> $ilDB.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getId()
get object id @access public
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

Referenced by getFullRemoteLink().

+ 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 432 of file class.ilRemoteObjectBase.php.

433 {
434 $this->create();
435
436 // won't work for personal workspace
437 $this->createReference();
438 $this->setPermissions($a_server->getImportId());
439
440 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
441 $matchable_content = ilECSUtils::getMatchableContent($this->getECSObjectType(),
442 $a_server->getServerId(), $a_ecs_content, $a_owner);
443
444 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
446 $matchable_content));
447
448 $this->updateFromECSContent($a_server, $a_ecs_content, $a_owner);
449 }
static getMatchingCategory($a_server_id, $a_matchable_content)
get matching category
getServerId()
Get current server id.
getImportId()
get import id
static getMatchableContent($a_resource_id, $a_server_id, $a_ecs_content, $a_owner)
Convert ECS content to rule matchable values.
putInTree($a_parent_ref)
maybe this method should be in tree object!?
setPermissions($a_parent_ref)
set permissions of object
createReference()
creates reference for object
create()
create
getECSObjectType()
Get ECS resource identifier, e.g.
updateFromECSContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
update remote object settings from ecs content

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

Referenced by handleUpdate().

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

◆ doCreate()

ilRemoteObjectBase::doCreate ( )

Create remote object.

Reimplemented from ilObject2.

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

326 {
327 global $ilDB;
328
329 $fields = array(
330 "obj_id" => array("integer", $this->getId()),
331 "local_information" => array("text", ""),
332 "remote_link" => array("text", ""),
333 "mid" => array("integer", 0),
334 "organization" => array("text", "")
335 );
336
337 $this->doCreateCustomFields($fields);
338
339 $ilDB->insert($this->getTableName(), $fields);
340 }
getTableName()
Get db table name.
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.

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

+ 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

Reimplemented in ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

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

347 {
348
349 }

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ doDelete()

ilRemoteObjectBase::doDelete ( )

Delete remote object.

Reimplemented from ilObject2.

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

385 {
386 global $ilDB;
387
388 //put here your module specific stuff
389 include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
391
392 $query = "DELETE FROM ".$this->getTableName().
393 " WHERE obj_id = ".$this->db->quote($this->getId() ,'integer')." ";
394 $ilDB->manipulate($query);
395 }
static _deleteByObjId($a_obj_id)
Delete by obj_id.

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

+ Here is the call graph for this function:

◆ doRead()

ilRemoteObjectBase::doRead ( )

read settings

Reimplemented from ilObject2.

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

401 {
402 $query = "SELECT * FROM ".$this->getTableName().
403 " WHERE obj_id = ".$this->db->quote($this->getId() ,'integer')." ";
404 $res = $this->db->query($query);
405 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
406 {
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 }
setRemoteLink($a_link)
set remote link
doReadCustomFields($a_row)
Read custom fields from db row.
setOrganization($a_organization)
set organization
setLocalInformation($a_info)
set local information

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

+ Here is the call graph for this function:

◆ doReadCustomFields()

ilRemoteObjectBase::doReadCustomFields (   $a_row)
protected

Read custom fields from db row.

Parameters
object$a_row

Reimplemented in ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

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

421 {
422
423 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ doUpdate()

ilRemoteObjectBase::doUpdate ( )

Update remote object.

Reimplemented from ilObject2.

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

355 {
356 global $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 }
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
getOrganization()
get organization
getLocalInformation()
get local information

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

+ 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

Reimplemented in ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

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

377 {
378
379 }

Referenced by doUpdate().

+ 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 832 of file class.ilRemoteObjectBase.php.

833 {
834 global $ilLog;
835
836 try
837 {
838 include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
839 $connector = new ilECSConnector($a_server);
840 $connector->addHeader('X-EcsQueryStrings', $a_sender_only ? 'sender=true' : 'all=true'); // #11301
841 $list = $connector->getResourceList($this->getECSObjectType());
842 if($list instanceof ilECSResult)
843 {
844 return $list->getResult()->getLinkIds();
845 }
846 }
847 catch(ilECSConnectorException $exc)
848 {
849 $ilLog->write(__METHOD__ . ': Error getting resource list. '.$exc->getMessage());
850 }
851 }

References $ilLog, and getECSObjectType().

+ Here is the call graph for this function:

◆ getECSObjectType()

ilRemoteObjectBase::getECSObjectType ( )
abstractprotected

Get ECS resource identifier, e.g.

"/campusconnect/courselinks"

Returns
string

Reimplemented in ilObjRemoteCategory, ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

Referenced by 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 245 of file class.ilRemoteObjectBase.php.

246 {
247 global $ilUser;
248
249
250 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
251 $server_id = ilECSImport::lookupServerId($this->getId());
253
254 include_once('./Services/WebServices/ECS/classes/class.ilECSUser.php');
255 $user = new ilECSUser($ilUser);
256 $ecs_user_data = $user->toGET();
257 $GLOBALS['ilLog']->write(__METHOD__.': Using ecs user data '.$ecs_user_data);
258
259 // check token mechanism enabled
260 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
261 $part = new ilECSParticipantSetting($server_id,$this->getMID());
262 if(!$part->isTokenEnabled())
263 {
264 return $this->getRemoteLink();
265 }
266
267 $auth_hash = $this->createAuthResource($this->getRemoteLink().$user->toREALM());
268 $ecs_url_hash = 'ecs_hash_url='.urlencode($server->getServerURI().'/sys/auths/'.$auth_hash);
269
270 if(strpos($this->getRemoteLink(), '?'))
271 {
272
273 $link = $this->getRemoteLink().'&ecs_hash='.$auth_hash.$ecs_user_data.'&'.$ecs_url_hash;
274 }
275 else
276 {
277 $link = $this->getRemoteLink().'?ecs_hash='.$auth_hash.$ecs_user_data.'&'.$ecs_url_hash;
278 }
279 $GLOBALS['ilLog']->write(__METHOD__.': ECS full link: '. $link);
280 return $link;
281 }
Stores relevant user data.
createAuthResource($a_plain_realm)
create authentication resource on ecs server
$server
global $ilUser
Definition: imgupload.php:15

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

+ 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 49 of file class.ilRemoteObjectBase.php.

50 {
51 switch($a_type)
52 {
54 include_once 'Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php';
55 return new ilObjRemoteCourse();
56
58 include_once 'Modules/RemoteCategory/classes/class.ilObjRemoteCategory.php';
59 return new ilObjRemoteCategory();
60
62 include_once 'Modules/RemoteFile/classes/class.ilObjRemoteFile.php';
63 return new ilObjRemoteFile();
64
66 include_once 'Modules/RemoteGlossary/classes/class.ilObjRemoteGlossary.php';
67 return new ilObjRemoteGlossary();
68
70 include_once 'Modules/RemoteGroup/classes/class.ilObjRemoteGroup.php';
71 return new ilObjRemoteGroup();
72
74 include_once 'Modules/RemoteLearningModule/classes/class.ilObjRemoteLearningModule.php';
75 return new ilObjRemoteLearningModule();
76
78 include_once 'Modules/RemoteWiki/classes/class.ilObjRemoteWiki.php';
79 return new ilObjRemoteWiki();
80
82 include_once 'Modules/RemoteTest/classes/class.ilObjRemoteTest.php';
83 return new ilObjRemoteTest();
84 }
85 }
Remote category app class.
Remote course app class.
Remote file app class.
Remote glossary app class.
Remote group app class.
Remote learning module app class.
Remote test app class.
Remote wiki app class.

References 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().

+ Here is the caller graph for this function:

◆ getLocalInformation()

ilRemoteObjectBase::getLocalInformation ( )

get local information

Returns
string

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

References $local_information.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getMID()

ilRemoteObjectBase::getMID ( )

get mid

Returns
int

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

183 {
184 return $this->mid;
185 }

References $mid.

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

+ Here is the caller graph for this function:

◆ getOrganization()

ilRemoteObjectBase::getOrganization ( )

get organization

Returns
string

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

References $organization.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getRealmPlain()

ilRemoteObjectBase::getRealmPlain ( )

Get realm plain.

Returns
type

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

References $realm_plain.

◆ getRemoteLink()

ilRemoteObjectBase::getRemoteLink ( )

get remote link

Returns
string

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

References $remote_link.

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

+ Here is the caller graph for this function:

◆ getTableName()

ilRemoteObjectBase::getTableName ( )
abstractprotected

Get db table name.

Returns
string

Reimplemented in ilObjRemoteCategory, ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

Referenced by doCreate(), 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 637 of file class.ilRemoteObjectBase.php.

638 {
639 return $this->handleUpdate($a_server, $a_econtent_id, $a_mids);
640 }
handleUpdate(ilECSSetting $a_server, $a_econtent_id, array $a_mids)
Handle update event.

References handleUpdate().

+ 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 796 of file class.ilRemoteObjectBase.php.

797 {
798 global $tree, $ilLog;
799
800
801 include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
802
803 // there is no information about the original mid anymore.
804 // Therefor delete any remote objects with given econtent id
805 $obj_ids = ilECSImport::_lookupObjIds($a_server->getServerId(),$a_econtent_id);
806 $ilLog->write(__METHOD__.': Received obj_ids '.print_r($obj_ids,true));
807
808 foreach($obj_ids as $obj_id)
809 {
810 $references = ilObject::_getAllReferences($obj_id);
811 foreach($references as $ref_id)
812 {
813 if($tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id,false))
814 {
815 $ilLog->write(__METHOD__.': Deleting obsolete remote course: '.$tmp_obj->getTitle());
816 $tmp_obj->delete();
817 $tree->deleteTree($tree->getNodeData($ref_id));
818 }
819 unset($tmp_obj);
820 }
821 }
822 return true;
823 }
_lookupObjIds($a_server_id, $a_econtent_id)
Lookup obj_id.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences($a_id)
get all reference ids of object

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

Referenced by handleUpdate().

+ 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 652 of file class.ilRemoteObjectBase.php.

653 {
654 global $ilLog;
655
656 // get content details
657 include_once('./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
658 $details = ilECSEContentDetails::getInstance($a_server->getServerId(),
659 $a_econtent_id, $this->getECSObjectType());
660 if(!$details instanceof ilECSEContentDetails)
661 {
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 {
674 $ilLog->write('Ignoring disabled participant. MID: '.$details->getOwner());
675 return true;
676 }
677
678 // new mids
679 include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
680 include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
681 foreach(array_intersect($a_mids,$details->getReceivers()) as $mid)
682 {
683 try
684 {
685 $connector = new ilECSConnector($a_server);
686 $res = $connector->getResource($this->getECSObjectType(), $a_econtent_id);
687 if($res->getHTTPCode() == ilECSConnector::HTTP_CODE_NOT_FOUND)
688 {
689 continue;
690 }
691 $json = $res->getResult();
692 $GLOBALS['ilLog']->write(__METHOD__.': Received json: '.print_r($json,true));
693 if(!is_object($json))
694 {
695 // try as array (workaround for invalid content)
696 $json = $json[0];
697 if(!is_object($json))
698 {
699 throw new ilECSConnectorException('invalid json');
700 }
701 }
702 }
703 catch(ilECSConnectorException $exc)
704 {
705 $ilLog->write(__METHOD__ . ': Error parsing result. '.$exc->getMessage());
706 $ilLog->logStack();
707 return false;
708 }
709
710 // Update existing
711
712 // Check receiver mid
713 if($obj_id = ilECSImport::_isImported($a_server->getServerId(),$a_econtent_id,$mid))
714 {
715 $ilLog->write(__METHOD__.': Handling update for existing object');
716 $remote = ilObjectFactory::getInstanceByObjId($obj_id,false);
717 if(!$remote instanceof ilRemoteObjectBase)
718 {
719 $ilLog->write(__METHOD__.': Cannot instantiate remote object. Got object type '.$remote->getType());
720 continue;
721 }
722 $remote->updateFromECSContent($a_server,$json,$details->getMySender());
723 }
724 else
725 {
726 $GLOBALS['ilLog']->write(__METHOD__.': my sender '. $details->getMySender().'vs mid'. $mid);
727
728 $ilLog->write(__METHOD__.': Handling create for non existing object');
729 $this->createFromECSEContent($a_server,$json,$details->getMySender());
730
731 // update import status
732 $ilLog->write(__METHOD__.': Updating import status');
733 include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
734 $import = new ilECSImport($a_server->getServerId(),$this->getId());
735 $import->setEContentId($a_econtent_id);
736 // Store receiver mid
737 $import->setMID($mid);
738 $import->save();
739
740 $ilLog->write(__METHOD__.': Sending notification');
741 $this->sendNewContentNotification($a_server->getServerId());
742 }
743 }
744
745 $ilLog->write(__METHOD__.': done');
746 return true;
747 }
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 _isImported($a_server_id, $a_econtent_id, $a_mid, $a_sub_id=0)
check if econtent is imported for a specific mid
static getInstanceByServerId($a_server_id)
Get instance by server id.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Remote object app base class.
createFromECSEContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
create remote object from ECSContent object
handleDelete(ilECSSetting $a_server, $a_econtent_id, $a_mid=0)
Handle delete event.
sendNewContentNotification($a_server_id)
send notifications about new EContent

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

Referenced by handleCreate().

+ 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 505 of file class.ilRemoteObjectBase.php.

506 {
507 global $ilLog;
508
509 $ilLog->write("importing metadata from json: ".print_r($a_json, true));
510
511 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
512 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
513 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
514
516 $values_records = ilAdvancedMDValues::getInstancesForObjectId($this->getId(), $this->getType());
517 foreach($values_records as $values_record)
518 {
519 // this correctly binds group and definitions
520 $values_record->read();
521 }
522
523 $do_save = false;
524
525 foreach($a_definition as $id => $type)
526 {
527 if(is_array($type))
528 {
529 $target = $type[1];
530 $type = $type[0];
531 }
532 else
533 {
534 $target = $id;
535 }
536
537 $timePlace = null;
538 if($field = $mappings->getMappingByECSName($a_mapping_mode, $id))
539 {
540 // find element in records
541 $adv_md_def = null;
542 foreach($values_records as $values_record)
543 {
544 $adv_md_defs = $values_record->getDefinitions();
545 if(isset($adv_md_defs[$field]))
546 {
547 $adv_md_def = $adv_md_defs[$field];
548 break;
549 }
550 }
551 if(!$adv_md_def)
552 {
553 continue;
554 }
555
556 $raw_value = $a_json->$target;
557
559 {
560 if(!is_object($timePlace))
561 {
562 include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
563 if(is_object($raw_value))
564 {
565 $timePlace = new ilECSTimePlace();
566 $timePlace->loadFromJSON($raw_value);
567 }
568 else
569 {
570 $timePlace = new ilECSTimePlace();
571 }
572 }
573 $raw_value = $timePlace;
574 }
575
576 if($adv_md_def->importFromECS($type, $raw_value, $id))
577 {
578 $do_save = true;
579 }
580 }
581 }
582
583 if($do_save)
584 {
585 foreach($values_records as $values_record)
586 {
587 $additional = array();
588 foreach($values_record->getADTGroup()->getElements() as $element_id => $element)
589 {
590 if(!$element->isNull())
591 {
592 $additional[$element_id] = array("disabled"=>array("integer", 1));
593 }
594 }
595 $values_record->write($additional);
596 }
597 }
598 }
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.
const TYPE_TIMEPLACE
getType()
get object type @access public
$additional
Definition: goto.php:89

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

Referenced by ilObjRemoteCourse\updateCustomFromECSContent().

+ 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 616 of file class.ilRemoteObjectBase.php.

617 {
618 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
619 include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
622 {
623 return false;
624 }
625 return true;
626 }
static _isRemote($a_server_id, $a_econtent_id)
is remote object
static _lookupEContentId($a_obj_id)
get econent_id

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

+ Here is the call graph for this function:

◆ sendNewContentNotification()

ilRemoteObjectBase::sendNewContentNotification (   $a_server_id)
protected

send notifications about new EContent

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

753 {
754 include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
755 $settings = ilECSSetting::getInstanceByServerId($a_server_id);
756 if(!count($rcps = $settings->getEContentRecipients()))
757 {
758 return;
759 }
760
761 include_once('./Services/Mail/classes/class.ilMail.php');
762 include_once('./Services/Language/classes/class.ilLanguageFactory.php');
763
765 $lang->loadLanguageModule('ecs');
766
767 $mail = new ilMail(self::MAIL_SENDER);
768 $message = $lang->txt('ecs_'.$this->getType().'_created_body_a')."\n\n";
769 $message .= $lang->txt('title').': '.$this->getTitle()."\n";
770 if(strlen($desc = $this->getDescription()))
771 {
772 $message .= $lang->txt('desc').': '.$desc."\n";
773 }
774
775 include_once('./Services/Link/classes/class.ilLink.php');
776 $href = ilLink::_getStaticLink($this->getRefId(),$this->getType(),true);
777 $message .= $lang->txt("perma_link").': '.$href."\n\n";
779
780 $mail->sendMail($settings->getEContentRecipientsAsString(),
781 '','',
782 $lang->txt('ecs_new_econtent_subject'),
783 $message,array(),array('normal'));
784 }
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
getRefId()
get reference id @access public
getDescription()
get object description
getTitle()
get object title @access public

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

Referenced by handleUpdate().

+ 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 172 of file class.ilRemoteObjectBase.php.

173 {
174 $this->local_information = $a_info;
175 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setMID()

ilRemoteObjectBase::setMID (   $a_mid)

set mid

Parameters
int$a_midmid

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

193 {
194 $this->mid = $a_mid;
195 }

Referenced by doRead(), and updateFromECSContent().

+ Here is the caller graph for this function:

◆ setOrganization()

ilRemoteObjectBase::setOrganization (   $a_organization)

set organization

Parameters
string$a_organization

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

143 {
144 $this->organization = $a_organization;
145 }

Referenced by doRead(), and updateFromECSContent().

+ 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 223 of file class.ilRemoteObjectBase.php.

224 {
225 $this->remote_link = $a_link;
226 }

Referenced by doRead(), and updateFromECSContent().

+ 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

Reimplemented in ilObjRemoteCourse, ilObjRemoteFile, ilObjRemoteGlossary, ilObjRemoteGroup, ilObjRemoteLearningModule, ilObjRemoteTest, and ilObjRemoteWiki.

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

607 {
608
609 }

Referenced by updateFromECSContent().

+ 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 458 of file class.ilRemoteObjectBase.php.

459 {
460 global $ilLog;
461
462 $ilLog->write('updateFromECSContent: '.print_r($a_ecs_content, true));
463
464 // Get organisation for owner (ObjectListGUI performance)
465 $organisation = null;
466 if($a_owner)
467 {
468 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
469 $organisation = ilECSUtils::lookupParticipantName($a_owner, $a_server->getServerId());
470 $ilLog->write('found organisation: '.$organisation);
471 }
472
473 $this->setMID($a_owner); // obsolete?
474 $this->setOrganization($organisation);
475 $this->setTitle($a_ecs_content->title);
476 $this->setDescription($a_ecs_content->abstract);
477 $this->setRemoteLink($a_ecs_content->url);
478
479 $ilLog->write('updateCustomFromECSContent');
480 $this->updateCustomFromECSContent($a_server, $a_ecs_content);
481
482 // we are updating late so custom values can be set
483
484 $ilLog->write('ilObject->update()');
485 $this->update();
486
487 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
488 $matchable_content = ilECSUtils::getMatchableContent($this->getECSObjectType(),
489 $a_server->getServerId(), $a_ecs_content, $a_owner);
490
491 // rule-based category mapping
492 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
494 $matchable_content);
495 }
static handleUpdate($a_obj_id, $a_server_id, $a_matchable_content)
Handle update of ecs content and create references.
static lookupParticipantName($a_owner, $a_server_id)
Lookup participant name.
setTitle($a_title)
set object title
update()
update object in db
setDescription($a_desc)
set object description
updateCustomFromECSContent(ilECSSetting $a_server, $ecs_content)
update remote object settings from ecs content

References $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().

+ 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: