40 $this->server_id = $a_server_id;
41 $this->obj_id = $a_obj_id;
61 $query =
'SELECT * from ecs_import ' .
62 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
63 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
64 'AND econtent_id = ' .
$ilDB->quote($a_econtent_id,
'text');
67 return $row->content_id;
85 $query =
"SELECT obj_id FROM ecs_import " .
86 "WHERE content_id = " .
$ilDB->quote($a_content_id,
'integer') .
" " .
87 "AND mid = " .
$ilDB->quote($a_mid,
'integer') .
" " .
88 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ';
90 if (!is_null($a_sub_id)) {
91 $query .=
'AND sub_id = ' .
$ilDB->quote($a_sub_id,
'text');
93 $query .=
'AND sub_id IS NULL';
109 $query =
"SELECT obj_id FROM ecs_import " .
110 "WHERE content_id = " .
$ilDB->quote($a_content_id,
'integer');
116 $obj_ids[] = $row->obj_id;
136 $query =
'SELECT * from ecs_import ' .
137 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
138 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
139 'AND content_id = ' .
$ilDB->quote($a_content_id,
'text');
142 return $row->econtent_id;
160 include_once
'./Services/WebServices/ECS/classes/class.ilECSUtils.php';
162 $query =
"SELECT * FROM ecs_import ei JOIN object_data obd ON ei.obj_id = obd.obj_id " .
163 'WHERE server_id = ' .
$ilDB->quote($a_server_id) .
' ' .
167 $all[$row->econtent_id] = $row->obj_id;
170 return $all ? $all : array();
187 $query =
"SELECT * FROM ecs_import " .
188 "WHERE mid = " .
$ilDB->quote($a_mid,
'integer') .
" " .
189 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer');
193 $obj_ids[] = $row->obj_id;
195 return $obj_ids ? $obj_ids : array();
212 $query =
"SELECT * FROM ecs_import WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
215 return $row->econtent_id;
232 $query =
'SELECT * FROM ecs_import WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer');
235 return $row->server_id;
253 $query =
"SELECT obj_id FROM ecs_import WHERE econtent_id = " .
$ilDB->quote($a_econtent_id,
'text') .
" " .
254 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer');
257 $obj_ids[] = $row->obj_id;
259 return $obj_ids ? $obj_ids : array();
270 public static function _lookupObjId($a_server_id, $a_econtent_id, $a_mid, $a_sub_id =
null)
276 $query =
"SELECT obj_id FROM ecs_import " .
277 "WHERE econtent_id = " .
$ilDB->quote($a_econtent_id,
'text') .
" " .
278 "AND mid = " .
$ilDB->quote($a_mid,
'integer') .
" " .
279 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ';
281 if (!is_null($a_sub_id)) {
282 $query .=
'AND sub_id = ' .
$ilDB->quote($a_sub_id,
'text');
284 $query .=
'AND sub_id IS NULL';
306 $query =
"SELECT * FROM ecs_emport WHERE obj_id = " .
$ilDB->quote($a_obj_id) .
" " .
307 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer');
329 $query =
"SELECT mid FROM ecs_import WHERE econtent_id = " .
$ilDB->quote($a_econtent_id,
'text') .
" " .
330 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer');
335 return $mids ? $mids : array();
352 $query =
"DELETE FROM ecs_import " .
353 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
369 $query =
'DELETE FROM ecs_import ' .
370 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer');
387 $query =
'DELETE FROM ecs_import ' .
388 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
389 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
390 'AND ' .
$ilDB->in(
'econtent_id', (array) $a_econtent_ids,
false,
'text');
406 public static function _isImported($a_server_id, $a_econtent_id, $a_mid, $a_sub_id =
null)
413 $this->server_id = $a_server_id;
430 $this->imported = $a_status;
435 $this->sub_id = $a_id;
440 return strlen($this->sub_id) ? $this->sub_id :
null;
449 $this->content_id = $a_content_id;
493 $this->econtent_id = $a_id;
518 $query =
"DELETE FROM ecs_import " .
519 "WHERE obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" " .
523 $query =
"INSERT INTO ecs_import (obj_id,mid,econtent_id,sub_id,server_id,content_id) " .
525 $this->db->quote($this->obj_id,
'integer') .
", " .
526 $this->db->quote($this->mid,
'integer') .
", " .
527 $this->db->quote($this->econtent_id,
'text') .
", " .
528 $this->db->quote($this->
getSubId(),
'text') .
', ' .
529 $this->db->quote($this->
getServerId(),
'integer') .
', ' .
548 $query =
"SELECT * FROM ecs_import WHERE " .
549 "obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" " .
553 $this->econtent_id = $row->econtent_id;
554 $this->mid = $row->mid;
555 $this->sub_id = $row->sub_id;
556 $this->content_id = $row->content_id;
566 $query =
'UPDATE ecs_import SET server_id = ' .
$ilDB->quote(0,
'integer') .
567 ' WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer');
575 $this->ecs_id = $a_id;
An exception for terminatinating execution or to throw for unit testing.
Storage of ECS imported objects.
setContentId($a_content_id)
Set content id.
getContentId()
get content id
static deleteByServer($a_server_id)
Delete by server id @global ilDB $ilDB.
setEContentId($a_id)
set econtent id
setServerId($a_server_id)
static _lookupEContentId($a_obj_id)
get econent_id
static _deleteByObjId($a_obj_id)
Delete by obj_id.
static getAllImportedRemoteObjects($a_server_id)
get all imported links
read()
Read @access private.
static _lookupMID($a_server_id, $a_obj_id)
Lookup mid.
__construct($a_server_id, $a_obj_id)
Constructor.
static lookupEContentIdByContentId($a_server_id, $a_mid, $a_content_id)
Lookup econtent id The econtent id is the unique id from ecs.
static lookupObjIdsByContentId($a_content_id)
static _lookupObjIdsByMID($a_server_id, $a_mid)
lookup obj ids by mid
getEContentId()
get econtent id
static _lookupObjIds($a_server_id, $a_econtent_id)
Lookup obj_id.
static deleteRessources($a_server_id, $a_mid, $a_econtent_ids)
Delete ressources @global $ilDB.
static lookupContentId($a_server_id, $a_mid, $a_econtent_id)
Lookup content id The content is the - not necessarily unique - id provided by the econtent type.
static resetServerId($a_server_id)
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 @global <type> $ilDB.
static _lookupObjId($a_server_id, $a_econtent_id, $a_mid, $a_sub_id=null)
loogup obj_id by econtent and mid and server_id
setImported($a_status)
Set imported.
static _lookupMIDs($a_server_id, $a_econtent_id)
Lookup mids by.
static lookupObjIdByContentId($a_server_id, $a_mid, $a_content_id, $a_sub_id=null)
Lookup obj_id by content id.
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
foreach($_POST as $key=> $value) $res