56 public function __construct($a_id = 0,$a_call_by_reference =
true)
61 $this->
ilObject($a_id,$a_call_by_reference);
77 $query =
"SELECT * FROM remote_course_settings ".
78 "WHERE obj_id = ".$ilDB->quote($a_obj_id).
" ";
79 $res = $ilDB->query($query);
81 switch($row->availability_type)
83 case self::ACTIVATION_UNLIMITED:
86 case self::ACTIVATION_OFFLINE:
89 case self::ACTIVATION_LIMITED:
90 return time() > $row->start && time < $row->end;
111 $query =
"SELECT organization FROM remote_course_settings ".
112 "WHERE obj_id = ".$ilDB->quote($a_obj_id).
" ";
113 $res = $ilDB->query($query);
116 return $row->organization;
130 $this->organization = $a_organization;
164 $this->local_information = $a_info;
176 $this->availability_type = $a_type;
199 $this->start = $a_time;
223 $this->end = $a_time;
247 $this->remote_link = $a_link;
273 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUser.php');
275 $ecs_user_data =
$user->toGET();
276 return $this->
getRemoteLink().
'&ecs_hash='.$this->auth_hash.$ecs_user_data;
313 $query =
"SELECT mid FROM remote_course_settings WHERE ".
314 "obj_id = ".$ilDB->quote($a_obj_id).
" ";
315 $res = $ilDB->query($query);
335 $query =
"SELECT * FROM remote_course_settings ".
336 "WHERE mid = ".$ilDB->quote($a_mid).
" ";
338 $res = $ilDB->query($query);
341 $obj_ids[] = $row->obj_id;
343 return $obj_ids ? $obj_ids : array();
356 include_once(
'Services/WebServices/ECS/classes/class.ilECSAuth.php');
357 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
358 include_once(
'Services/WebServices/ECS/classes/class.ilECSImport.php');
364 $auth =
new ilECSAuth($import->getEContentId(),$import->getMID());
365 #$auth->setSOV(time());
366 #$auth->setEOV(time() + 7200);
367 $auth->setAbbreviation(
'K');
368 $connector->addAuth(@json_encode(
$auth));
370 $this->auth_hash =
$auth->getHash();
375 $ilLog->write(__METHOD__.
': Caught error from ECS Auth resource: '.$exc->getMessage());
386 public function create($a_upload =
false)
390 $query =
"INSERT INTO remote_course_settings SET obj_id = ".$this->db->quote($this->
getId()).
" ";
391 $res = $this->db->query($query);
409 if (!parent::update())
414 $query =
"UPDATE remote_course_settings SET ".
415 "availability_type = ".(int) $this->db->quote($this->getAvailabilityType()).
", ".
416 "start = ".$this->db->quote($this->getStartingTime()).
", ".
417 "end = ".$this->db->quote($this->getEndingTime()).
", ".
418 "local_information = ".$this->db->quote($this->getLocalInformation()).
", ".
419 "remote_link = ".$this->db->quote($this->getRemoteLink()).
", ".
420 "mid = ".$this->db->quote($this->getMID()).
", ".
421 "organization = ".$this->db->quote($this->getOrganization()).
" ".
422 "WHERE obj_id = ".$this->db->quote($this->getId()).
" ";
424 $this->db->query($query);
434 public function delete()
436 if(!parent::delete())
442 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
445 $query =
"DELETE FROM remote_course_settings WHERE obj_id = ".$this->db->quote($this->
getId()).
" ";
446 $this->db->query($query);
459 public function read($a_force_db =
false)
463 $query =
"SELECT * FROM remote_course_settings ".
464 "WHERE obj_id = ".$this->db->quote($this->
getId()).
" ";
465 $res = $this->db->query($query);
489 global $ilAppEventHandler;
491 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
495 $remote_crs->setType(
'rcrs');
496 $remote_crs->setOwner(6);
497 $new_obj_id = $remote_crs->create();
498 $remote_crs->createReference();
499 $remote_crs->putInTree($ecs_settings->getImportId());
500 $remote_crs->setPermissions($ecs_settings->getImportId());
502 $remote_crs->setECSImported($ecs_content->
getEContentId(),$a_mid,$new_obj_id);
503 $remote_crs->updateFromECSContent($ecs_content);
505 $ilAppEventHandler->raise(
'Modules/RemoteCourse',
'create',array(
'rcrs' => $remote_crs));
518 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
519 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
520 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
535 if($field = $mappings->getMappingByECSName(
'study_courses'))
538 $value->toggleDisabledStatus(
true);
544 if($field = $mappings->getMappingByECSName(
'lecturer'))
547 $value->toggleDisabledStatus(
true);
552 if($field = $mappings->getMappingByECSName(
'courseType'))
555 $value->toggleDisabledStatus(
true);
560 if($field = $mappings->getMappingByECSName(
'courseID'))
563 $value->toggleDisabledStatus(
true);
568 if($field = $mappings->getMappingByECSName(
'credits'))
571 $value->toggleDisabledStatus(
true);
576 if($field = $mappings->getMappingByECSName(
'semester_hours'))
579 $value->toggleDisabledStatus(
true);
584 if($field = $mappings->getMappingByECSName(
'term'))
587 $value->toggleDisabledStatus(
true);
588 $value->setValue($ecs_content->
getTerm());
593 if($field = $mappings->getMappingByECSName(
'begin'))
596 $value->toggleDisabledStatus(
true);
602 $value->setValue($ecs_content->
getTimePlace()->getUTBegin());
605 $value->setValue($ecs_content->
getTimePlace()->getBegin());
610 if($field = $mappings->getMappingByECSName(
'end'))
613 $value->toggleDisabledStatus(
true);
618 $value->setValue($ecs_content->
getTimePlace()->getUTEnd());
621 $value->setValue($ecs_content->
getTimePlace()->getEnd());
626 if($field = $mappings->getMappingByECSName(
'room'))
629 $value->toggleDisabledStatus(
true);
630 $value->setValue($ecs_content->
getTimePlace()->getRoom());
633 if($field = $mappings->getMappingByECSName(
'cycle'))
636 $value->toggleDisabledStatus(
true);
637 $value->setValue($ecs_content->
getTimePlace()->getCycle());
651 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
653 $import->setEContentId($a_econtent_id);
654 $import->setMID($a_mid);