30 $this->obj_id = $a_obj_id;
34 public static function treeExists($a_server_id, $a_mid, $a_tree_id)
40 $query =
'SELECT COUNT(*) num FROM ecs_cms_data ' .
41 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
42 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
43 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer');
47 return $row->num > 0 ? true :
false;
68 $query =
'SELECT ed.obj_id obj_id FROM ecs_cms_data ed ' .
69 'LEFT JOIN ecs_cms_tree et ON ed.obj_id = et.child ' .
70 'WHERE et.child IS NULL ' .
71 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
72 'AND mid = ' .
$ilDB->quote($a_mid) .
' ' .
73 'AND tree_id = ' .
$ilDB->quote($a_tree_id);
89 $query =
'SELECT obj_id FROM ecs_cms_data ' .
90 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
91 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
92 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
116 $ilDB = $DIC[
'ilDB'];
118 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
':ASDUASDUASDU ' . $a_server_id .
' ' . $a_mid .
' ' .
$cms_id);
120 $query =
'SELECT tree_id FROM ecs_cms_data ' .
121 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
122 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
123 'AND cms_id = ' .
$ilDB->quote($cms_id,
'text') .
' ' .
128 return $row->tree_id;
137 public static function lookupTitle($a_server_id, $a_mid, $a_tree_id)
141 $ilDB = $DIC[
'ilDB'];
143 $query =
'SELECT * FROM ecs_cms_data ' .
144 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
145 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
146 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer');
165 $ilDB = $DIC[
'ilDB'];
167 $query =
'SELECT term FROM ecs_cms_data ' .
168 'JOIN ecs_cms_tree ON obj_id = child ' .
169 'WHERE tree = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
170 'AND server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
171 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
172 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
189 $ilDB = $DIC[
'ilDB'];
191 $query =
'SELECT status,deleted FROM ecs_cms_data ' .
192 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
193 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
194 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
199 return self::MAPPING_DELETED;
203 return self::MAPPING_UNMAPPED;
214 $ilDB = $DIC[
'ilDB'];
216 $query =
'SELECT status FROM ecs_cms_data ' .
217 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
218 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
219 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
225 return self::MAPPING_UNMAPPED;
231 self::writeAllStatus($a_server_id, $a_mid, $a_tree_id, self::MAPPING_UNMAPPED);
234 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
235 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
238 $subIds = self::lookupCmsIds(array_merge($cmsTree->getSubTreeIds($assignment), array($assignment)));
256 $cms_ids = self::lookupCmsIds(array($a_obj_id));
265 $ilDB = $DIC[
'ilDB'];
267 $query =
'SELECT cms_id FROM ecs_cms_data ' .
268 'WHERE ' .
$ilDB->in(
'obj_id', $a_obj_ids,
false,
'integer');
273 $cms_ids[] =
$row->cms_id;
289 $ilDB = $DIC[
'ilDB'];
291 $query =
'SELECT cms_id FROM ecs_cms_data ' .
292 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
293 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
294 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer');
298 $cms_ids[] =
$row->cms_id;
317 $ilDB = $DIC[
'ilDB'];
319 $query =
'UPDATE ecs_cms_data ' .
320 'SET status = ' .
$ilDB->quote(
$status,
'integer') .
' ' .
321 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
322 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
323 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ' .
324 'AND ' .
$ilDB->in(
'cms_id', $cms_ids,
false,
'text');
343 $ilDB = $DIC[
'ilDB'];
345 $query =
'UPDATE ecs_cms_data ' .
346 'SET status = ' .
$ilDB->quote(
$status,
'integer') .
' ' .
347 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
348 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
349 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ';
361 public static function writeAllDeleted($a_server_id, $a_mid, $a_tree_id, $a_deleted_flag)
365 $ilDB = $DIC[
'ilDB'];
367 $query =
'UPDATE ecs_cms_data ' .
368 'SET deleted = ' .
$ilDB->quote($a_deleted_flag,
'integer') .
' ' .
369 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
370 'AND mid = ' .
$ilDB->quote($a_mid,
'integer') .
' ' .
371 'AND tree_id = ' .
$ilDB->quote($a_tree_id,
'integer') .
' ';
380 $ilDB = $DIC[
'ilDB'];
382 $query =
'SELECT DISTINCT(tree_id) tid FROM ecs_cms_data ' .
383 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer') .
' ' .
384 'AND mid = ' .
$ilDB->quote($a_mid,
'integer');
389 $tree_ids[] =
$row->tid;
391 return (array) $tree_ids;
397 $this->title = $a_title;
407 $this->term = $a_term;
417 $this->obj_id = $a_id;
427 $this->cms_id = $a_id;
437 $this->server_id = $a_id;
447 $this->tree_id = $a_id;
467 $this->status = $a_status;
477 $this->deleted = $a_is_deleted;
490 $ilDB = $DIC[
'ilDB'];
492 $this->obj_id =
$ilDB->nextId(
'ecs_cms_data');
494 $query =
'INSERT INTO ecs_cms_data (obj_id,server_id,mid,tree_id,cms_id,title,term,status,deleted) ' .
496 $ilDB->quote($this->obj_id,
'integer') .
', ' .
497 $ilDB->quote($this->server_id,
'integer') .
', ' .
498 $ilDB->quote($this->mid,
'integer') .
', ' .
499 $ilDB->quote($this->tree_id,
'integer') .
', ' .
500 $ilDB->quote($this->cms_id,
'text') .
', ' .
501 $ilDB->quote($this->title,
'text') .
', ' .
502 $ilDB->quote($this->term,
'text') .
', ' .
503 $ilDB->quote($this->status,
'integer') .
', ' .
504 $ilDB->quote($this->deleted,
'integer') .
' ' .
514 $ilDB = $DIC[
'ilDB'];
516 $query =
"UPDATE ecs_cms_data SET " .
517 'title = ' .
$ilDB->quote($this->title,
'text') .
', ' .
518 'term = ' .
$ilDB->quote($this->term,
'text') .
', ' .
519 'status = ' .
$ilDB->quote($this->status,
'text') .
', ' .
520 'deleted = ' .
$ilDB->quote($this->
isDeleted(),
'integer') .
' ' .
521 'WHERE obj_id = ' .
$ilDB->quote($this->obj_id,
'integer');
525 public function delete()
529 $ilDB = $DIC[
'ilDB'];
531 $query =
"DELETE FROM ecs_cms_data " .
532 'WHERE obj_id = ' .
$ilDB->quote($this->obj_id,
'integer');
540 $ilDB = $DIC[
'ilDB'];
542 $query =
"DELETE FROM ecs_cms_data " .
543 'WHERE server_id = ' .
$ilDB->quote($this->server_id,
'integer') .
' ' .
544 'AND mid = ' .
$ilDB->quote($this->mid,
'integer') .
' ' .
545 'AND tree_id = ' .
$ilDB->quote($this->tree_id,
'integer') .
' ';
553 $ilDB = $DIC[
'ilDB'];
555 $query =
"DELETE FROM ecs_cms_data " .
556 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer');
564 $ilDB = $DIC[
'ilDB'];
566 $query =
'SELECT * FROM ecs_cms_data ' .
567 'WHERE obj_id = ' .
$ilDB->quote($this->obj_id,
'integer');
570 $this->title =
$row->title;
571 $this->term =
$row->term;
572 $this->server_id =
$row->server_id;
573 $this->mid =
$row->mid;
574 $this->tree_id =
$row->tree_id;
575 $this->cms_id =
$row->cms_id;
576 $this->status =
$row->status;
577 $this->deleted =
$row->deleted;
static lookupCmsIdsOfTree($a_server_id, $a_mid, $a_tree_id)
$ilDB $ilDB
const MAPPING_PENDING_DISCONNECTABLE
static writeAllDeleted($a_server_id, $a_mid, $a_tree_id, $a_deleted_flag)
Write deleted status.
static updateStatus($a_server_id, $a_mid, $a_tree_id)
setDeleted($a_is_deleted)
static treeExists($a_server_id, $a_mid, $a_tree_id)
static lookupObjId($a_server_id, $a_mid, $a_tree_id, $cms_id)
static lookupStatusByCmsId($a_server_id, $a_mid, $a_tree_id, $cms_id)
Lookup status.
static lookupTitle($a_server_id, $a_mid, $a_tree_id)
Lookup title by obj id.
static lookupStatusByObjId($a_server_id, $a_mid, $a_tree_id, $obj_id)
Lookup status.
static lookupFirstTreeOfNode($a_server_id, $a_mid, $cms_id)
Lookup first obj_id of cms node $ilDB $ilDB.
foreach($_POST as $key=> $value) $res
static lookupTopTerm($a_server_id, $a_mid, $a_tree_id)
Lookup term (highest term in cms tree) <type> $ilDB.
static writeAllStatus($a_server_id, $a_mid, $a_tree_id, $status)
Update status $ilDB.
static lookupCmsIds($a_obj_ids)
static lookupCmsId($a_obj_id)
Lookup cms id.
static findDeletedNodes($a_server_id, $a_mid, $a_tree_id)
Find deleted nodes Uses a left join since this is more robust.
static writeStatus($a_server_id, $a_mid, $a_tree_id, $cms_ids, $status)
Update status $ilDB.
static lookupAssignmentIds($a_server_id, $a_mid, $a_tree_id)
Lookup assignments $ilDB.
static lookupTreeIds($a_server_id, $a_mid)
const MAPPING_PENDING_NOT_DISCONNECTABLE
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static deleteByServerId($a_server_id)