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 ,
'integer').
" ";
81 switch(
$row->availability_type)
83 case self::ACTIVATION_UNLIMITED:
86 case self::ACTIVATION_OFFLINE:
89 case self::ACTIVATION_LIMITED:
90 return time() >
$row->r_start && time <
$row->r_end;
111 $query =
"SELECT organization FROM remote_course_settings ".
112 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ";
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 ,
'integer').
" ";
335 $query =
"SELECT * FROM remote_course_settings ".
336 "WHERE mid = ".$ilDB->quote($a_mid ,
'integer').
" ";
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)
392 $query =
"INSERT INTO remote_course_settings (obj_id,local_information,availability_type,r_start,r_end,remote_link,mid,organization) ".
394 $this->db->quote($this->
getId() ,
'integer').
", ".
395 $ilDB->quote(
'',
'text').
", ".
396 $ilDB->quote(0,
'integer').
", ".
397 $ilDB->quote(0,
'integer').
", ".
398 $ilDB->quote(0,
'integer').
", ".
399 $ilDB->quote(
'',
'text').
", ".
400 $ilDB->quote(0,
'integer').
", ".
401 $ilDB->quote(
'',
'text').
" ".
421 if (!parent::update())
426 $query =
"UPDATE remote_course_settings SET ".
427 "availability_type = ".(int) $this->db->quote($this->getAvailabilityType() ,
'integer').
", ".
428 "r_start = ".$this->db->quote($this->getStartingTime() ,
'integer').
", ".
429 "r_end = ".$this->db->quote($this->getEndingTime() ,
'integer').
", ".
430 "local_information = ".$this->db->quote($this->getLocalInformation() ,
'text').
", ".
431 "remote_link = ".$this->db->quote($this->getRemoteLink() ,
'text').
", ".
432 "mid = ".$this->db->quote($this->getMID() ,
'integer').
", ".
433 "organization = ".$this->db->quote($this->getOrganization() ,
'text').
" ".
434 "WHERE obj_id = ".$this->db->quote($this->getId() ,
'integer').
" ";
445 public function delete()
449 if(!parent::delete())
455 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
458 $query =
"DELETE FROM remote_course_settings WHERE obj_id = ".$this->db->quote($this->
getId() ,
'integer').
" ";
471 public function read($a_force_db =
false)
475 $query =
"SELECT * FROM remote_course_settings ".
476 "WHERE obj_id = ".$this->db->quote($this->
getId() ,
'integer').
" ";
501 global $ilAppEventHandler;
503 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
504 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
508 $remote_crs->setType(
'rcrs');
509 $remote_crs->setOwner(6);
510 $new_obj_id = $remote_crs->create();
511 $remote_crs->createReference();
513 $remote_crs->setPermissions($ecs_settings->getImportId());
515 $remote_crs->setECSImported($ecs_content->
getEContentId(),$a_mid,$new_obj_id);
516 $remote_crs->updateFromECSContent($ecs_content);
518 $ilAppEventHandler->raise(
'Modules/RemoteCourse',
'create',array(
'rcrs' => $remote_crs));
531 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
532 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
533 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
548 if($field = $mappings->getMappingByECSName(
'study_courses'))
551 $value->toggleDisabledStatus(
true);
557 if($field = $mappings->getMappingByECSName(
'lecturer'))
560 $value->toggleDisabledStatus(
true);
565 if($field = $mappings->getMappingByECSName(
'courseType'))
568 $value->toggleDisabledStatus(
true);
573 if($field = $mappings->getMappingByECSName(
'courseID'))
576 $value->toggleDisabledStatus(
true);
581 if($field = $mappings->getMappingByECSName(
'credits'))
584 $value->toggleDisabledStatus(
true);
589 if($field = $mappings->getMappingByECSName(
'semester_hours'))
592 $value->toggleDisabledStatus(
true);
597 if($field = $mappings->getMappingByECSName(
'term'))
600 $value->toggleDisabledStatus(
true);
601 $value->setValue($ecs_content->
getTerm());
606 if($field = $mappings->getMappingByECSName(
'begin'))
609 $value->toggleDisabledStatus(
true);
615 $value->setValue($ecs_content->
getTimePlace()->getUTBegin());
618 $value->setValue($ecs_content->
getTimePlace()->getBegin());
623 if($field = $mappings->getMappingByECSName(
'end'))
626 $value->toggleDisabledStatus(
true);
631 $value->setValue($ecs_content->
getTimePlace()->getUTEnd());
634 $value->setValue($ecs_content->
getTimePlace()->getEnd());
639 if($field = $mappings->getMappingByECSName(
'room'))
642 $value->toggleDisabledStatus(
true);
643 $value->setValue($ecs_content->
getTimePlace()->getRoom());
646 if($field = $mappings->getMappingByECSName(
'cycle'))
649 $value->toggleDisabledStatus(
true);
650 $value->setValue($ecs_content->
getTimePlace()->getCycle());
654 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
669 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
671 $import->setEContentId($a_econtent_id);
672 $import->setMID($a_mid);