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';
359 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
368 $this->auth_hash = $connector->addAuth(@json_encode(
$auth),$this->
getMID());
373 $ilLog->write(__METHOD__.
': Caught error from ECS Auth resource: '.$exc->getMessage());
384 public function create($a_upload =
false)
390 $query =
"INSERT INTO remote_course_settings (obj_id,local_information,availability_type,r_start,r_end,remote_link,mid,organization) ".
392 $this->db->quote($this->
getId() ,
'integer').
", ".
393 $ilDB->quote(
'',
'text').
", ".
394 $ilDB->quote(0,
'integer').
", ".
395 $ilDB->quote(0,
'integer').
", ".
396 $ilDB->quote(0,
'integer').
", ".
397 $ilDB->quote(
'',
'text').
", ".
398 $ilDB->quote(0,
'integer').
", ".
399 $ilDB->quote(
'',
'text').
" ".
419 if (!parent::update())
424 $query =
"UPDATE remote_course_settings SET ".
425 "availability_type = ".(int) $this->db->quote($this->getAvailabilityType() ,
'integer').
", ".
426 "r_start = ".$this->db->quote($this->getStartingTime() ,
'integer').
", ".
427 "r_end = ".$this->db->quote($this->getEndingTime() ,
'integer').
", ".
428 "local_information = ".$this->db->quote($this->getLocalInformation() ,
'text').
", ".
429 "remote_link = ".$this->db->quote($this->getRemoteLink() ,
'text').
", ".
430 "mid = ".$this->db->quote($this->getMID() ,
'integer').
", ".
431 "organization = ".$this->db->quote($this->getOrganization() ,
'text').
" ".
432 "WHERE obj_id = ".$this->db->quote($this->getId() ,
'integer').
" ";
443 public function delete()
447 if(!parent::delete())
453 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
456 $query =
"DELETE FROM remote_course_settings WHERE obj_id = ".$this->db->quote($this->
getId() ,
'integer').
" ";
469 public function read($a_force_db =
false)
473 $query =
"SELECT * FROM remote_course_settings ".
474 "WHERE obj_id = ".$this->db->quote($this->
getId() ,
'integer').
" ";
499 global $ilAppEventHandler;
501 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
502 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
506 $remote_crs->setType(
'rcrs');
507 $remote_crs->setOwner(0);
508 $new_obj_id = $remote_crs->create();
509 $remote_crs->createReference();
511 $remote_crs->setPermissions($ecs_settings->getImportId());
513 $remote_crs->setECSImported($a_server_id,$ecs_content->
getEContentId(),$a_mid,$new_obj_id);
514 $remote_crs->updateFromECSContent($a_server_id,$ecs_content);
516 $ilAppEventHandler->raise(
517 'Modules/RemoteCourse',
520 'rcrs' => $remote_crs,
521 'server_id' => $a_server_id
536 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
537 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
538 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
555 $value->toggleDisabledStatus(
true);
564 $value->toggleDisabledStatus(
true);
572 $value->toggleDisabledStatus(
true);
580 $value->toggleDisabledStatus(
true);
588 $value->toggleDisabledStatus(
true);
596 $value->toggleDisabledStatus(
true);
604 $value->toggleDisabledStatus(
true);
605 $value->setValue($ecs_content->
getTerm());
613 $value->toggleDisabledStatus(
true);
619 $value->setValue($ecs_content->
getTimePlace()->getUTBegin());
622 $value->setValue($ecs_content->
getTimePlace()->getBegin());
630 $value->toggleDisabledStatus(
true);
635 $value->setValue($ecs_content->
getTimePlace()->getUTEnd());
638 $value->setValue($ecs_content->
getTimePlace()->getEnd());
646 $value->toggleDisabledStatus(
true);
647 $value->setValue($ecs_content->
getTimePlace()->getRoom());
653 $value->toggleDisabledStatus(
true);
654 $value->setValue($ecs_content->
getTimePlace()->getCycle());
658 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
673 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
675 $import->setEContentId($a_econtent_id);
676 $import->setMID($a_mid);