ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjRemoteCourse.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once('Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php');
5
16{
17 const DB_TABLE_NAME = "remote_course_settings";
18
22
24 protected $end;
25 protected $start;
26
27 public function initType()
28 {
29 $this->type = "rcrs";
30 }
31
32 protected function getTableName()
33 {
35 }
36
37 protected function getECSObjectType()
38 {
39 return "/campusconnect/courselinks";
40 }
41
48 {
49 $this->availability_type = $a_type;
50 }
51
57 public function getAvailabilityType()
58 {
60 }
61
67 public function setStartingTime($a_time)
68 {
69 $this->start = $a_time;
70 }
71
77 public function getStartingTime()
78 {
79 return $this->start;
80 }
81
87 public function setEndingTime($a_time)
88 {
89 $this->end = $a_time;
90 }
91
97 public function getEndingTime()
98 {
99 return $this->end;
100 }
101
108 public static function _lookupOnline($a_obj_id)
109 {
110 global $ilDB;
111
112 $query = "SELECT * FROM " . self::DB_TABLE_NAME .
113 " WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
114 $res = $ilDB->query($query);
115 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
116 switch ($row->availability_type) {
118 return true;
119
121 return false;
122
124 return time() > $row->r_start && time < $row->r_end;
125
126 default:
127 return false;
128 }
129
130 return false;
131 }
132
133 protected function doCreateCustomFields(array &$a_fields)
134 {
135 $a_fields["availability_type"] = array("integer", 0);
136 $a_fields["r_start"] = array("integer", 0);
137 $a_fields["r_end"] = array("integer", 0);
138 }
139
140 protected function doUpdateCustomFields(array &$a_fields)
141 {
142 $a_fields["availability_type"] = array("integer", $this->getAvailabilityType());
143 $a_fields["r_start"] = array("integer",(int) $this->getStartingTime());
144 $a_fields["r_end"] = array("integer", (int) $this->getEndingTime());
145 }
146
147 protected function doReadCustomFields($a_row)
148 {
149 $this->setAvailabilityType($a_row->availability_type);
150 $this->setStartingTime($a_row->r_start);
151 $this->setEndingTime($a_row->r_end);
152 }
153
154 protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
155 {
156 // add custom values
157 $this->setAvailabilityType($a_ecs_content->status == 'online' ? self::ACTIVATION_UNLIMITED : self::ACTIVATION_OFFLINE);
158
159 // :TODO: ACTIVATION_LIMITED is currently not supported in ECS yet
160
161 // adv. metadata
162 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
163 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php');
166 $a_ecs_content,
167 $a_server,
168 $definition,
170 );
171
172 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
173 $import = new ilECSImport($a_server->getServerId(), $this->getId());
174 $import->setContentId($a_ecs_content->courseID);
175 $import->save();
176 }
177}
An exception for terminatinating execution or to throw for unit testing.
Storage of ECS imported objects.
getServerId()
Get current server id.
static getEContentDefinition($a_resource_id)
Get econtent / metadata definition.
Remote course app class.
setAvailabilityType($a_type)
Set Availability type.
setStartingTime($a_time)
set starting time
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
setEndingTime($a_time)
set ending time
getECSObjectType()
Get ECS resource identifier, e.g.
getEndingTime()
get ending time
static _lookupOnline($a_obj_id)
Lookup online.
doReadCustomFields($a_row)
Read custom fields from db row.
updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
update remote object settings from ecs content
getTableName()
Get db table name.
getAvailabilityType()
get availability type
getStartingTime()
get starting time
Remote object app base class.
importMetadataFromJson($a_json, ilECSSetting $a_server, array $a_definition, $a_mapping_mode)
Add advanced metadata to json (export)
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$a_type
Definition: workflow.php:92