4 include_once
"Services/Object/classes/class.ilObject2.php";
35 public function __construct($a_id = 0, $a_call_by_reference =
true)
41 parent::__construct($a_id, $a_call_by_reference);
55 include_once
'Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php';
59 include_once
'Modules/RemoteCategory/classes/class.ilObjRemoteCategory.php';
63 include_once
'Modules/RemoteFile/classes/class.ilObjRemoteFile.php';
67 include_once
'Modules/RemoteGlossary/classes/class.ilObjRemoteGlossary.php';
71 include_once
'Modules/RemoteGroup/classes/class.ilObjRemoteGroup.php';
75 include_once
'Modules/RemoteLearningModule/classes/class.ilObjRemoteLearningModule.php';
79 include_once
'Modules/RemoteWiki/classes/class.ilObjRemoteWiki.php';
83 include_once
'Modules/RemoteTest/classes/class.ilObjRemoteTest.php';
91 return parent::beforeCreate();
118 $ilDB = $DIC[
'ilDB'];
120 $query =
"SELECT organization FROM " . static::DB_TABLE_NAME .
121 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
124 return $row->organization;
145 $this->organization = $a_organization;
175 $this->local_information = $a_info;
208 $ilDB = $DIC[
'ilDB'];
210 $query =
"SELECT mid FROM " . static::DB_TABLE_NAME .
211 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
226 $this->remote_link = $a_link;
253 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
257 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUser.php');
259 $ecs_user_data =
$user->toGET();
260 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Using ecs user data ' . $ecs_user_data);
263 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
265 if (!$part->isTokenEnabled()) {
270 $ecs_url_hash =
'ecs_hash_url=' . urlencode(
$server->getServerURI() .
'/sys/auths/' .
$auth_hash);
277 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': ECS full link: ' . $link);
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';
304 $auth->setPid($import_info->getMID());
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());
314 $ilLog->write(__METHOD__ .
': Caught error from ECS Auth resource: ' . $exc->getMessage());
326 $ilDB = $DIC[
'ilDB'];
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",
"")
356 $ilDB = $DIC[
'ilDB'];
361 "mid" => array(
"integer", $this->
getMID()),
367 $where = array(
"obj_id" => array(
"integer", $this->
getId()));
387 $ilDB = $DIC[
'ilDB'];
390 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
394 " WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
404 " WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
439 include_once
'./Services/WebServices/ECS/classes/class.ilECSUtils.php';
447 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
469 $ilLog->write(
'updateFromECSContent: ' . print_r($a_ecs_content,
true));
472 $organisation = null;
474 include_once
'./Services/WebServices/ECS/classes/class.ilECSUtils.php';
476 $ilLog->write(
'found organisation: ' . $organisation);
481 $this->
setTitle($a_ecs_content->title);
485 $ilLog->write(
'updateCustomFromECSContent');
490 $ilLog->write(
'ilObject->update()');
493 include_once
'./Services/WebServices/ECS/classes/class.ilECSUtils.php';
502 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
524 $ilLog->write(
"importing metadata from json: " . print_r($a_json,
true));
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');
532 foreach ($values_records as $values_record) {
534 $values_record->read();
539 foreach ($a_definition as
$id =>
$type) {
540 if (is_array(
$type)) {
548 if ($field = $mappings->getMappingByECSName($a_mapping_mode,
$id)) {
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];
562 $raw_value = $a_json->$target;
565 if (!is_object($timePlace)) {
566 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
567 if (is_object($raw_value)) {
569 $timePlace->loadFromJSON($raw_value);
574 $raw_value = $timePlace;
577 if ($adv_md_def->importFromECS(
$type, $raw_value,
$id)) {
584 foreach ($values_records as $values_record) {
586 foreach ($values_record->getADTGroup()->getElements() as $element_id => $element) {
587 if (!$element->isNull()) {
588 $additional[$element_id] = array(
"disabled" => array(
"integer", 1));
613 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
614 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
635 return $this->
handleUpdate($a_server, $a_econtent_id, $a_mids);
655 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php');
663 $ilLog->write(__METHOD__ .
': Handling delete of deprecated remote object. DONE');
667 $ilLog->write(__METHOD__ .
': Receivers are ' . print_r($details->getReceivers(),
true));
668 $ilLog->write(__METHOD__ .
': Senders are ' . print_r($details->getSenders(),
true));
671 include_once(
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
673 $ilLog->write(
'Ignoring disabled participant. MID: ' . $details->getOwner());
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) {
687 $json =
$res->getResult();
688 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Received json: ' . print_r($json,
true));
689 if (!is_object($json)) {
692 if (!is_object($json)) {
697 $ilLog->write(__METHOD__ .
': Error parsing result. ' . $exc->getMessage());
706 $ilLog->write(__METHOD__ .
': Handling update for existing object');
709 $ilLog->write(__METHOD__ .
': Cannot instantiate remote object. Got object type ' . $remote->getType());
712 $remote->updateFromECSContent($a_server, $json, $details->getMySender());
714 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': my sender ' . $details->getMySender() .
'vs mid' .
$mid);
716 $ilLog->write(__METHOD__ .
': Handling create for non existing object');
720 $ilLog->write(__METHOD__ .
': Updating import status');
721 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
725 $import->setMID($mid);
728 $ilLog->write(__METHOD__ .
': Sending notification');
733 $ilLog->write(__METHOD__ .
': done');
742 include_once(
'Services/WebServices/ECS/classes/class.ilECSSetting.php');
744 if (!count($rcps = $settings->getEContentRecipients())) {
748 include_once(
'./Services/Mail/classes/class.ilMail.php');
749 include_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
752 $lang->loadLanguageModule(
'ecs');
754 $mail =
new ilMail(self::MAIL_SENDER);
761 include_once(
'./Services/Link/classes/class.ilLink.php');
763 $message .=
$lang->txt(
"perma_link") .
': ' . $href .
"\n\n";
767 $settings->getEContentRecipientsAsString(),
770 $lang->txt(
'ecs_new_econtent_subject'),
791 $tree = $DIC[
'tree'];
795 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
800 $ilLog->write(__METHOD__ .
': Received obj_ids ' . print_r($obj_ids,
true));
802 foreach ($obj_ids as $obj_id) {
804 foreach ($references as
$ref_id) {
806 $ilLog->write(__METHOD__ .
': Deleting obsolete remote course: ' . $tmp_obj->getTitle());
808 $tree->deleteTree(
$tree->getNodeData($ref_id));
830 include_once
'./Services/WebServices/ECS/classes/class.ilECSConnector.php';
832 $connector->addHeader(
'X-EcsQueryStrings', $a_sender_only ?
'sender=true' :
'all=true');
835 return $list->getResult()->getLinkIds();
838 $ilLog->write(__METHOD__ .
': Error getting resource list. ' . $exc->getMessage());
const TYPE_REMOTE_CATEGORY
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
doDelete()
Delete remote object.
sendNewContentNotification($a_server_id)
send notifications about new EContent
static getInstanceByServerId($a_server_id)
Get singleton instance.
static lookupParticipantName($a_owner, $a_server_id)
Lookup participant name.
if(isset($_REQUEST['delete'])) $list
getTableName()
Get db table name.
getOrganization()
get organization
static _lookupEContentId($a_obj_id)
get econent_id
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.
getRemoteLink()
get remote link
static _isRemote($a_server_id, $a_econtent_id)
is remote object
Representation of ECS EContent Time Place.
Remote glossary app class.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
getServerId()
Get current server id.
handleCreate(ilECSSetting $a_server, $a_econtent_id, array $a_mids)
Handle creation.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
static _lookupMID($a_obj_id)
lookup owner mid
handleDelete(ilECSSetting $a_server, $a_econtent_id, $a_mid=0)
Handle delete event.
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
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
Remote learning module app class.
getImportId()
get import id
setPermissions($a_parent_ref)
getECSObjectType()
Get ECS resource identifier, e.g.
doReadCustomFields($a_row)
Read custom fields from db row.
getRealmPlain()
Get realm plain.
static _deleteByObjId($a_obj_id)
Delete by obj_id.
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.
static _getAllReferences($a_id)
get all reference ids of object
importMetadataFromJson($a_json, ilECSSetting $a_server, array $a_definition, $a_mapping_mode)
Add advanced metadata to json (export)
static getInstanceByServerId($a_server_id)
Get instance by server id.
isLocalObject()
Is remote object from same installation?
static getMatchableContent($a_resource_id, $a_server_id, $a_ecs_content, $a_owner)
Convert ECS content to rule matchable values.
static _getLanguage($a_lang_key='')
Get langauge object.
catch(Exception $e) $message
setOrganization($a_organization)
set organization
foreach($_POST as $key=> $value) $res
setLocalInformation($a_info)
set local information
static getMatchingCategory($a_server_id, $a_matchable_content)
get matching category
getFullRemoteLink()
get full remote link Including ecs generated hash and auth mode
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
static lookupServerId($a_obj_id)
Lookup server id of imported content <type> $ilDB.
Remote object app base class.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
const TYPE_REMOTE_LEARNING_MODULE
static _lookupOrganization($a_obj_id)
lookup organization
createAuthResource($a_plain_realm)
create authentication resource on ecs server
const TYPE_REMOTE_GLOSSARY
handleUpdate(ilECSSetting $a_server, $a_econtent_id, array $a_mids)
Handle update event.
static _lookupObjIds($a_server_id, $a_econtent_id)
Lookup obj_id.
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
Get auto generated info string.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
setEContentId($a_id)
set econtent id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
doUpdate()
Update remote object.
createFromECSEContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
create remote object from ECSContent object
Remote category app class.
static getInstance($a_server_id, $a_econtent_id, $a_resource_type)
Get data from server.
const HTTP_CODE_NOT_FOUND
getAllResourceIds(ilECSSetting $a_server, $a_sender_only=false)
Get all available resources.
Stores relevant user data.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
doCreate()
Create remote object.
updateFromECSContent(ilECSSetting $a_server, $a_ecs_content, $a_owner)
update remote object settings from ecs content
getLocalInformation()
get local information