31 $this->obj_id = $a_obj_id;
35 public static function treeExists($a_server_id, $a_mid, $a_tree_id)
39 $query =
'SELECT COUNT(*) num FROM ecs_cms_data '.
40 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
41 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
42 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer');
47 return $row->num > 0 ?
true :
false;
66 $query =
'SELECT ed.obj_id obj_id FROM ecs_cms_data ed '.
67 'LEFT JOIN ecs_cms_tree et ON ed.obj_id = et.child '.
68 'WHERE et.child IS NULL '.
69 'AND server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
70 'AND mid = '.$ilDB->quote($a_mid).
' '.
71 'AND tree_id = '.$ilDB->quote($a_tree_id);
86 $query =
'SELECT obj_id FROM ecs_cms_data '.
87 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
88 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
89 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' '.
90 'AND cms_id = '.$ilDB->quote(
$cms_id,
'text');
114 $GLOBALS[
'ilLog']->write(__METHOD__.
':ASDUASDUASDU '.$a_server_id.
' '.$a_mid.
' '.$cms_id);
116 $query =
'SELECT tree_id FROM ecs_cms_data '.
117 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
118 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
119 'AND cms_id = '.$ilDB->quote(
$cms_id,
'text').
' '.
125 return $row->tree_id;
134 public static function lookupTitle($a_server_id, $a_mid, $a_tree_id)
138 $query =
'SELECT * FROM ecs_cms_data '.
139 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
140 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
141 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer');
161 $query =
'SELECT term FROM ecs_cms_data '.
162 'JOIN ecs_cms_tree ON obj_id = child '.
163 'WHERE tree = '.$ilDB->quote($a_tree_id,
'integer').
' '.
164 'AND server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
165 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
166 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' '.
184 $query =
'SELECT status,deleted FROM ecs_cms_data '.
185 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
186 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
187 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' '.
188 'AND obj_id = '.$ilDB->quote(
$obj_id,
'integer');
209 $query =
'SELECT status FROM ecs_cms_data '.
210 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
211 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
212 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' '.
213 'AND cms_id = '.$ilDB->quote(
$cms_id,
'text');
228 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
229 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
233 $subIds =
self::lookupCmsIds(array_merge($cmsTree->getSubTreeIds($assignment),array($assignment)));
240 self::MAPPING_MAPPED);
259 $query =
'SELECT cms_id FROM ecs_cms_data '.
260 'WHERE '.$ilDB->in(
'obj_id',$a_obj_ids,
false,
'integer');
266 $cms_ids[] =
$row->cms_id;
282 $query =
'SELECT cms_id FROM ecs_cms_data '.
283 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
284 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
285 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer');
290 $cms_ids[] =
$row->cms_id;
309 $query =
'UPDATE ecs_cms_data '.
310 'SET status = '.$ilDB->quote(
$status,
'integer').
' '.
311 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
312 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
313 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' '.
314 'AND '. $ilDB->in(
'cms_id',$cms_ids,
false,
'text');
315 $ilDB->manipulate(
$query);
333 $query =
'UPDATE ecs_cms_data '.
334 'SET status = '.$ilDB->quote(
$status,
'integer').
' '.
335 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
336 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
337 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' ';
338 $ilDB->manipulate(
$query);
349 public static function writeAllDeleted($a_server_id, $a_mid, $a_tree_id, $a_deleted_flag)
353 $query =
'UPDATE ecs_cms_data '.
354 'SET deleted = '.$ilDB->quote($a_deleted_flag,
'integer').
' '.
355 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
356 'AND mid = '.$ilDB->quote($a_mid,
'integer').
' '.
357 'AND tree_id = '.$ilDB->quote($a_tree_id,
'integer').
' ';
358 $ilDB->manipulate(
$query);
366 $query =
'SELECT DISTINCT(tree_id) tid FROM ecs_cms_data '.
367 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer').
' '.
368 'AND mid = '.$ilDB->quote($a_mid,
'integer');
374 $tree_ids[] =
$row->tid;
376 return (array) $tree_ids;
382 $this->title = $a_title;
392 $this->term = $a_term;
402 $this->obj_id = $a_id;
412 $this->cms_id = $a_id;
422 $this->server_id = $a_id;
432 $this->tree_id = $a_id;
452 $this->status = $a_status;
462 $this->deleted = $a_is_deleted;
475 $this->obj_id = $ilDB->nextId(
'ecs_cms_data');
477 $query =
'INSERT INTO ecs_cms_data (obj_id,server_id,mid,tree_id,cms_id,title,term,status,deleted) '.
479 $ilDB->quote($this->obj_id,
'integer').
', '.
480 $ilDB->quote($this->server_id,
'integer') .
', ' .
481 $ilDB->quote($this->mid,
'integer').
', '.
482 $ilDB->quote($this->tree_id,
'integer').
', '.
483 $ilDB->quote($this->cms_id,
'text').
', '.
484 $ilDB->quote($this->title,
'text').
', '.
485 $ilDB->quote($this->term,
'text').
', '.
486 $ilDB->quote($this->status,
'integer').
', '.
487 $ilDB->quote($this->deleted,
'integer').
' '.
489 $ilDB->manipulate(
$query);
497 $query =
"UPDATE ecs_cms_data SET ".
498 'title = '.$ilDB->quote($this->title,
'text').
', '.
499 'term = '.$ilDB->quote($this->term,
'text').
', '.
500 'status = '.$ilDB->quote($this->status,
'text').
', '.
501 'deleted = '.$ilDB->quote($this->
isDeleted(),
'integer').
' '.
502 'WHERE obj_id = '.$ilDB->quote($this->obj_id,
'integer');
503 $ilDB->manipulate(
$query);
506 public function delete()
510 $query =
"DELETE FROM ecs_cms_data ".
511 'WHERE obj_id = '.$ilDB->quote($this->obj_id,
'integer');
512 $ilDB->manipulate(
$query);
519 $query =
"DELETE FROM ecs_cms_data ".
520 'WHERE server_id = '.$ilDB->quote($this->server_id,
'integer').
' '.
521 'AND mid = '.$ilDB->quote($this->mid,
'integer').
' '.
522 'AND tree_id = '.$ilDB->quote($this->tree_id,
'integer').
' ';
523 $ilDB->manipulate(
$query);
530 $query =
"DELETE FROM ecs_cms_data ".
531 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
532 $ilDB->manipulate(
$query);
539 $query =
'SELECT * FROM ecs_cms_data '.
540 'WHERE obj_id = '.$ilDB->quote($this->obj_id,
'integer');
544 $this->title =
$row->title;
545 $this->term =
$row->term;
546 $this->server_id =
$row->server_id;
547 $this->mid =
$row->mid;
548 $this->tree_id =
$row->tree_id;
549 $this->cms_id =
$row->cms_id;
550 $this->status =
$row->status;
551 $this->deleted =
$row->deleted;