30 $this->obj_id = $a_obj_id;
34 public static function treeExists($a_server_id, $a_mid, $a_tree_id)
38 $query =
'SELECT COUNT(*) num FROM ecs_cms_data ' .
39 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
40 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
41 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer');
45 return $row->num > 0 ? true :
false;
64 $query =
'SELECT ed.obj_id obj_id FROM ecs_cms_data ed ' .
65 'LEFT JOIN ecs_cms_tree et ON ed.obj_id = et.child ' .
66 'WHERE et.child IS NULL ' .
67 'AND server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
68 'AND mid = ' . $ilDB->quote($a_mid) .
' ' .
69 'AND tree_id = ' . $ilDB->quote($a_tree_id);
83 $query =
'SELECT obj_id FROM ecs_cms_data ' .
84 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
85 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
86 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
87 'AND cms_id = ' . $ilDB->quote(
$cms_id,
'text');
110 $GLOBALS[
'ilLog']->write(__METHOD__ .
':ASDUASDUASDU ' . $a_server_id .
' ' . $a_mid .
' ' .
$cms_id);
112 $query =
'SELECT tree_id FROM ecs_cms_data ' .
113 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
114 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
115 'AND cms_id = ' . $ilDB->quote($cms_id,
'text') .
' ' .
120 return $row->tree_id;
129 public static function lookupTitle($a_server_id, $a_mid, $a_tree_id)
133 $query =
'SELECT * FROM ecs_cms_data ' .
134 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
135 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
136 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer');
155 $query =
'SELECT term FROM ecs_cms_data ' .
156 'JOIN ecs_cms_tree ON obj_id = child ' .
157 'WHERE tree = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
158 'AND server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
159 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
160 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
177 $query =
'SELECT status,deleted FROM ecs_cms_data ' .
178 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
179 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
180 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
181 'AND obj_id = ' . $ilDB->quote(
$obj_id,
'integer');
185 return self::MAPPING_DELETED;
189 return self::MAPPING_UNMAPPED;
200 $query =
'SELECT status FROM ecs_cms_data ' .
201 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
202 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
203 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
204 'AND cms_id = ' . $ilDB->quote(
$cms_id,
'text');
209 return self::MAPPING_UNMAPPED;
215 self::writeAllStatus($a_server_id, $a_mid, $a_tree_id, self::MAPPING_UNMAPPED);
218 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
219 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
222 $subIds = self::lookupCmsIds(array_merge($cmsTree->getSubTreeIds($assignment),
array($assignment)));
240 $cms_ids = self::lookupCmsIds(
array($a_obj_id));
249 $query =
'SELECT cms_id FROM ecs_cms_data ' .
250 'WHERE ' . $ilDB->in(
'obj_id', $a_obj_ids,
false,
'integer');
255 $cms_ids[] =
$row->cms_id;
271 $query =
'SELECT cms_id FROM ecs_cms_data ' .
272 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
273 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
274 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer');
278 $cms_ids[] =
$row->cms_id;
297 $query =
'UPDATE ecs_cms_data ' .
298 'SET status = ' . $ilDB->quote(
$status,
'integer') .
' ' .
299 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
300 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
301 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ' .
302 'AND ' . $ilDB->in(
'cms_id', $cms_ids,
false,
'text');
303 $ilDB->manipulate(
$query);
321 $query =
'UPDATE ecs_cms_data ' .
322 'SET status = ' . $ilDB->quote(
$status,
'integer') .
' ' .
323 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
324 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
325 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ';
326 $ilDB->manipulate(
$query);
337 public static function writeAllDeleted($a_server_id, $a_mid, $a_tree_id, $a_deleted_flag)
341 $query =
'UPDATE ecs_cms_data ' .
342 'SET deleted = ' . $ilDB->quote($a_deleted_flag,
'integer') .
' ' .
343 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
344 'AND mid = ' . $ilDB->quote($a_mid,
'integer') .
' ' .
345 'AND tree_id = ' . $ilDB->quote($a_tree_id,
'integer') .
' ';
346 $ilDB->manipulate(
$query);
354 $query =
'SELECT DISTINCT(tree_id) tid FROM ecs_cms_data ' .
355 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer') .
' ' .
356 'AND mid = ' . $ilDB->quote($a_mid,
'integer');
361 $tree_ids[] =
$row->tid;
363 return (
array) $tree_ids;
369 $this->title = $a_title;
379 $this->term = $a_term;
389 $this->obj_id = $a_id;
399 $this->cms_id = $a_id;
409 $this->server_id = $a_id;
419 $this->tree_id = $a_id;
439 $this->status = $a_status;
449 $this->deleted = $a_is_deleted;
462 $this->obj_id = $ilDB->nextId(
'ecs_cms_data');
464 $query =
'INSERT INTO ecs_cms_data (obj_id,server_id,mid,tree_id,cms_id,title,term,status,deleted) ' .
466 $ilDB->quote($this->obj_id,
'integer') .
', ' .
467 $ilDB->quote($this->server_id,
'integer') .
', ' .
468 $ilDB->quote($this->mid,
'integer') .
', ' .
469 $ilDB->quote($this->tree_id,
'integer') .
', ' .
470 $ilDB->quote($this->cms_id,
'text') .
', ' .
471 $ilDB->quote($this->title,
'text') .
', ' .
472 $ilDB->quote($this->term,
'text') .
', ' .
473 $ilDB->quote($this->status,
'integer') .
', ' .
474 $ilDB->quote($this->deleted,
'integer') .
' ' .
476 $ilDB->manipulate(
$query);
484 $query =
"UPDATE ecs_cms_data SET " .
485 'title = ' . $ilDB->quote($this->title,
'text') .
', ' .
486 'term = ' . $ilDB->quote($this->term,
'text') .
', ' .
487 'status = ' . $ilDB->quote($this->status,
'text') .
', ' .
488 'deleted = ' . $ilDB->quote($this->
isDeleted(),
'integer') .
' ' .
489 'WHERE obj_id = ' . $ilDB->quote($this->obj_id,
'integer');
490 $ilDB->manipulate(
$query);
493 public function delete()
497 $query =
"DELETE FROM ecs_cms_data " .
498 'WHERE obj_id = ' . $ilDB->quote($this->obj_id,
'integer');
499 $ilDB->manipulate(
$query);
506 $query =
"DELETE FROM ecs_cms_data " .
507 'WHERE server_id = ' . $ilDB->quote($this->server_id,
'integer') .
' ' .
508 'AND mid = ' . $ilDB->quote($this->mid,
'integer') .
' ' .
509 'AND tree_id = ' . $ilDB->quote($this->tree_id,
'integer') .
' ';
510 $ilDB->manipulate(
$query);
517 $query =
"DELETE FROM ecs_cms_data " .
518 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer');
519 $ilDB->manipulate(
$query);
526 $query =
'SELECT * FROM ecs_cms_data ' .
527 'WHERE obj_id = ' . $ilDB->quote($this->obj_id,
'integer');
530 $this->title =
$row->title;
531 $this->term =
$row->term;
532 $this->server_id =
$row->server_id;
533 $this->mid =
$row->mid;
534 $this->tree_id =
$row->tree_id;
535 $this->cms_id =
$row->cms_id;
536 $this->status =
$row->status;
537 $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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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)
Create styles array
The data for the language used.
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
static deleteByServerId($a_server_id)