4 include_once(
"./Services/Object/classes/class.ilObjectFactory.php");
38 $this->db = $DIC->database();
39 $this->tree = $DIC->repositoryTree();
54 $ilAppEventHandler = $DIC[
"ilAppEventHandler"];
55 $rbacsystem = $DIC->rbac()->system();
56 $rbacadmin = $DIC->rbac()->admin();
58 $tree = $DIC->repositoryTree();
59 $lng = $DIC->language();
64 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
67 $a_ids = array_unique((
array) $a_ids);
71 foreach ($a_ids as
$id) {
72 if (
$tree->isDeleted($id)) {
73 $log->write(__METHOD__ .
': Object with ref_id: ' . $id .
' already deleted.');
78 $node_data =
$tree->getNodeData($id);
79 $subtree_nodes =
$tree->getSubTree($node_data);
81 $all_node_data[] = $node_data;
82 $all_subtree_nodes[] = $subtree_nodes;
85 foreach ($subtree_nodes as $node) {
86 if ($node[
'type'] ==
'rolf') {
89 if (!$rbacsystem->checkAccess(
'delete', $node[
"child"])) {
90 $not_deletable[] = $node[
"child"];
91 $perform_delete =
false;
97 if (is_array($not_deletable) && count($not_deletable) > 0) {
98 $not_deletable_titles =
array();
99 foreach ($not_deletable as
$key => $ref_id) {
106 $lng->txt(
"msg_no_perm_delete") .
" " . implode(
', ', $not_deletable_titles) .
"<br/>" .
$lng->txt(
"msg_cancel")
111 if (!$all_node_data[0][
"type"]) {
116 if ($rbacsystem->checkAccess(
'delete', $a_cur_ref_id)) {
117 foreach ($a_ids as $id) {
122 $log->write(
"ilObjectGUI::confirmedDeleteObject(), deleted obj_id " . $obj->getId() .
123 ", type: " . $obj->getType() .
", title: " . $obj->getTitle());
127 $lng->txt(
"no_perm_delete") .
"<br/>" .
$lng->txt(
"msg_cancel")
132 $affected_ids =
array();
133 $affected_parents =
array();
134 foreach ($a_ids as $id) {
135 if (
$tree->isDeleted($id)) {
136 $log->write(__METHOD__ .
': Object with ref_id: ' . $id .
' already deleted.');
141 $subnodes =
$tree->getSubtree(
$tree->getNodeData($id));
143 foreach ($subnodes as $subnode) {
144 $rbacadmin->revokePermission($subnode[
"child"]);
148 $affected_ids[$subnode[
"child"]] = $subnode[
"child"];
149 $affected_parents[$subnode[
"child"]] = $subnode[
"parent"];
158 include_once(
'./Services/WebServices/ECS/classes/class.ilECSObjectSettings.php');
161 if (!
$tree->saveSubTree($id,
true)) {
162 $log->write(__METHOD__ .
': Object with ref_id: ' . $id .
' already deleted.');
167 $log->write(
"ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $id .
180 foreach ($affected_ids as $aid) {
181 $ilAppEventHandler->raise(
186 "old_parent_ref_id" => $affected_parents[$aid]
207 $ilAppEventHandler = $DIC[
"ilAppEventHandler"];
208 $tree = $DIC->repositoryTree();
212 $affected_ids =
array();
215 foreach ($a_ref_ids as
$id) {
217 if (!$a_from_recovery_folder) {
218 $saved_tree =
new ilTree(-(
int) $id);
219 $node_data = $saved_tree->getNodeData($id);
220 $subtree_nodes = $saved_tree->getSubTree($node_data);
222 $node_data =
$tree->getNodeData($id);
223 $subtree_nodes =
$tree->getSubTree($node_data);
227 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
232 $tree = $DIC->repositoryTree();
233 $parent_data =
$tree->getParentNodeData($node_data[
'ref_id']);
235 $node_data[
'obj_id'],
238 $parent_data[
'obj_id']
243 if (!$a_from_recovery_folder) {
244 $checked[] = -(int) $id;
252 foreach ($subtree_nodes as $node) {
258 $log->write(
"ilObjectGUI::removeFromSystemObject(), delete obj_id: " . $node_obj->getId() .
259 ", ref_id: " . $node_obj->getRefId() .
", type: " . $node_obj->getType() .
", " .
260 "title: " . $node_obj->getTitle());
261 $affected_ids[$node[
"ref_id"]] =
array(
262 "ref_id" => $node[
"ref_id"],
263 "obj_id" => $node_obj->getId(),
264 "type" => $node_obj->getType(),
265 "old_parent_ref_id" => $node[
"parent"]);
271 if (!$a_from_recovery_folder || $node_obj->getType() !=
"fold") {
277 if (!$a_from_recovery_folder) {
278 $saved_tree->deleteTree($node_data);
280 $tree->deleteTree($node_data);
284 $log->write(
"ilObjectGUI::removeFromSystemObject(), deleted tree, tree_id: " . $node_data[
"tree"] .
285 ", child: " . $node_data[
"child"]);
289 foreach ($affected_ids as $aid) {
290 $ilAppEventHandler->raise(
293 array(
"obj_id" => $aid[
"obj_id"],
294 "ref_id" => $aid[
"ref_id"],
295 "type" => $aid[
"type"],
296 "old_parent_ref_id" => $aid[
"old_parent_ref_id"])
313 $ilDB = $DIC->database();
314 $tree = $DIC->repositoryTree();
318 $q =
"SELECT tree FROM tree WHERE parent= " .
319 $ilDB->quote($a_node_id,
"integer") .
" AND tree < 0";
325 if (!in_array(
$row->tree, $a_checked)) {
327 $a_checked[] =
$row->tree;
330 $del_node_data = $deleted_tree->getNodeData(
$row->tree);
331 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
335 if ($a_delete_objects) {
336 foreach ($del_subtree_nodes as $node) {
340 $log->write(
"ilObjectGUI::removeDeletedNodes(), delete obj_id: " . $node_obj->getId() .
341 ", ref_id: " . $node_obj->getRefId() .
", type: " . $node_obj->getType() .
", " .
342 "title: " . $node_obj->getTitle());
343 $a_affected_ids[$node[
"ref_id"]] =
array(
344 "ref_id" => $node[
"ref_id"],
345 "obj_id" => $node_obj->getId(),
346 "type" => $node_obj->getType(),
347 "old_parent_ref_id" => $node[
"parent"]);
353 $tree->deleteTree($del_node_data);
356 $log->write(
"ilObjectGUI::removeDeletedNodes(), deleted tree, tree_id: " . $del_node_data[
"tree"] .
357 ", child: " . $del_node_data[
"child"]);
371 $rbacsystem = $DIC->rbac()->system();
372 $ilAppEventHandler = $DIC[
"ilAppEventHandler"];
373 $lng = $DIC->language();
374 $tree = $DIC->repositoryTree();
380 foreach ($a_ref_ids as
$id) {
383 if (!$rbacsystem->checkAccess(
'create', $a_cur_ref_id, $obj_data->getType())) {
388 if (count($no_create)) {
389 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
393 $affected_ids =
array();
395 foreach ($a_ref_ids as $id) {
402 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
408 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
428 foreach ($affected_ids as $id) {
430 $ilAppEventHandler->raise(
441 private static function insertSavedNodes($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
445 $tree = $DIC->repositoryTree();
447 ilLoggerFactory::getLogger(
'rep')->debug(
'Restoring from trash: source_id: ' . $a_source_id .
', dest_id: ' . $a_dest_id .
', tree_id:' . $a_tree_id);
451 $saved_tree =
new ilTree($a_tree_id);
452 $childs = $saved_tree->getChilds($a_source_id);
456 $tree->insertNodeFromTrash($a_source_id, $a_dest_id, $a_tree_id,
IL_LAST_NODE,
true);
462 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
464 $ref_obj =
$factory->getInstanceByRefId($a_source_id,
false);
466 $lroles =
$GLOBALS[
'rbacreview']->getRolesOfRoleFolder($a_source_id,
true);
467 foreach ($lroles as $role_id) {
468 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
470 $role->setParent($a_source_id);
474 $ref_obj->setPermissions($a_dest_id);
477 foreach ($childs as $child) {
494 $set =
$ilDB->query(
"SELECT child" .
496 " JOIN object_reference ref ON (tree.child = ref.ref_id)" .
497 " JOIN object_data od ON (od.obj_id = ref.obj_id)" .
498 " WHERE tree.tree < " .
$ilDB->quote(0,
"integer") .
511 $set =
$ilDB->query(
"SELECT obj_id" .
512 " FROM object_data " .
513 " WHERE type = " .
$ilDB->quote(
"typ",
"text") .
516 return $row[
"obj_id"];
527 $ref_ids_in_tree =
$tree->getSubTree(
$tree->getNodeData(ROOT_FOLDER_ID),
false,
$a_type);
528 if ($ref_ids_in_tree) {
534 if ($ref_ids_in_trash) {
535 self::removeObjectsFromSystem($ref_ids_in_trash);
544 $ilDB->manipulate(
"DELETE FROM object_data" .
545 " WHERE obj_id = " .
$ilDB->quote($type_id,
"integer"));
550 $ilDB->manipulate(
"DELETE FROM rbac_ta" .
551 " WHERE typ_id = " .
$ilDB->quote($type_id,
"integer")
555 $set =
$ilDB->query(
"SELECT ops_id" .
556 " FROM rbac_operations " .
557 " WHERE class = " .
$ilDB->quote(
"create",
"text") .
558 " AND operation = " .
$ilDB->quote(
"create_" .
$a_type,
"text"));
560 $create_ops_id =
$row[
"ops_id"];
561 if ($create_ops_id) {
562 $ilDB->manipulate(
"DELETE FROM rbac_operations" .
563 " WHERE ops_id = " .
$ilDB->quote($create_ops_id,
"integer"));
565 $ilDB->manipulate(
"DELETE FROM rbac_templates" .
566 " WHERE ops_id = " .
$ilDB->quote($create_ops_id,
"integer"));
569 foreach (
array(
"root",
"cat",
"crs",
"grp",
"fold") as $parent_type) {
571 if ($parent_type_id) {
572 $ilDB->manipulate(
"DELETE FROM rbac_ta" .
573 " WHERE typ_id = " .
$ilDB->quote($parent_type_id,
"integer") .
574 " AND ops_id = " .
$ilDB->quote($create_ops_id,
"integer"));
581 include_once
"Services/Repository/classes/class.ilObjRepositorySettings.php";
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
Repository Utilities (application layer, put GUI related stuff into ilRepUtilGUI) ...
static removeDeletedNodes( $a_node_id, $a_checked, $a_delete_objects, &$a_affected_ids)
Remove already deleted objects within the objects in trash.
static _handleDelete(array $a_subbtree_nodes)
handle delete Objects that are moved to the trash call ECS-Remove
__construct()
Constructor.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupTitle($a_id)
lookup object title
static restoreObjects($a_cur_ref_id, $a_ref_ids)
Move objects from trash back to repository.
deleteObjectType($a_type)
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static insertSavedNodes($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
Recursive method to insert all saved nodes of the clipboard.
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
static deleteObjectType($a_type)
static clear($a_var)
Unset a value.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
static deleteObjects($a_cur_ref_id, $a_ids)
Delete objects.
static removeObjectsFromSystem($a_ref_ids, $a_from_recovery_folder=false)
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...