4 include_once(
"./Services/Object/classes/class.ilObjectFactory.php");
24 global $ilAppEventHandler, $rbacsystem, $rbacadmin,
$log,
$ilUser, $tree,
$lng,
27 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
28 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
31 $a_ids = array_unique((array) $a_ids);
34 foreach ($a_ids as $id)
36 if ($tree->isDeleted($id))
38 $log->write(__METHOD__.
': Object with ref_id: '.$id.
' already deleted.');
43 $node_data = $tree->getNodeData($id);
44 $subtree_nodes = $tree->getSubTree($node_data);
46 $all_node_data[] = $node_data;
47 $all_subtree_nodes[] = $subtree_nodes;
50 foreach ($subtree_nodes as $node)
52 if($node[
'type'] ==
'rolf')
56 if (!$rbacsystem->checkAccess(
'delete',$node[
"child"]))
58 $not_deletable[] = $node[
"child"];
59 $perform_delete =
false;
63 $buyable[] = $node[
'child'];
64 $perform_delete =
false;
70 if (count($not_deletable))
72 $not_deletable = implode(
',',$not_deletable);
75 $lng->txt(
"msg_no_perm_delete").
" ".$not_deletable.
"<br/>".$lng->txt(
"msg_cancel"));
80 foreach($buyable as $id)
84 $titles[] = $tmp_object->getTitle();
86 $title_str = implode(
',',$titles);
89 $lng->txt(
'msg_obj_not_deletable_sold').
' '.$title_str);
93 if (!$all_node_data[0][
"type"])
99 if ($rbacsystem->checkAccess(
'delete', $a_cur_ref_id))
101 foreach($a_ids as $id)
107 $log->write(
"ilObjectGUI::confirmedDeleteObject(), deleted obj_id ".$obj->getId().
108 ", type: ".$obj->getType().
", title: ".$obj->getTitle());
114 $lng->txt(
"no_perm_delete").
"<br/>".$lng->txt(
"msg_cancel"));
120 $affected_ids = array();
121 foreach ($a_ids as $id)
123 if($tree->isDeleted($id))
125 $log->write(__METHOD__.
': Object with ref_id: '.$id.
' already deleted.');
130 $subnodes = $tree->getSubtree($tree->getNodeData($id));
132 foreach ($subnodes as $subnode)
134 $rbacadmin->revokePermission($subnode[
"child"]);
138 $affected_ids[$subnode[
"child"]] = $subnode[
"child"];
147 include_once(
'./Services/WebServices/ECS/classes/class.ilECSObjectSettings.php');
150 if(!$tree->saveSubTree($id,
true))
152 $log->write(__METHOD__.
': Object with ref_id: '.$id.
' already deleted.');
157 $log->write(
"ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$id.
163 $affected_ids[$id] = $id;
170 foreach ($affected_ids as $aid)
172 $ilAppEventHandler->raise(
"Services/Object",
"toTrash",
180 if (!$ilSetting->get(
'enable_trash'))
193 global $rbacsystem,
$log, $ilAppEventHandler, $tree;
195 $affected_ids = array();
198 foreach ($a_ref_ids as $id)
201 if (!$a_from_recovery_folder)
203 $saved_tree =
new ilTree(-(
int)$id);
204 $node_data = $saved_tree->getNodeData($id);
205 $subtree_nodes = $saved_tree->getSubTree($node_data);
209 $node_data = $tree->getNodeData($id);
210 $subtree_nodes = $tree->getSubTree($node_data);
214 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
217 $parent_data = $tree->getParentNodeData($node_data[
'ref_id']);
219 $parent_data[
'obj_id']);
223 if (!$a_from_recovery_folder)
225 $checked[] = -(int) $id;
235 foreach ($subtree_nodes as $node)
243 $log->write(
"ilObjectGUI::removeFromSystemObject(), delete obj_id: ".$node_obj->getId().
244 ", ref_id: ".$node_obj->getRefId().
", type: ".$node_obj->getType().
", ".
245 "title: ".$node_obj->getTitle());
246 $affected_ids[$node[
"ref_id"]] = array(
"ref_id" => $node[
"ref_id"],
247 "obj_id" => $node_obj->getId(),
"type" => $node_obj->getType());
253 if (!$a_from_recovery_folder || $node_obj->getType() !=
"fold")
260 if (!$a_from_recovery_folder)
262 $saved_tree->deleteTree($node_data);
266 $tree->deleteTree($node_data);
270 $log->write(
"ilObjectGUI::removeFromSystemObject(), deleted tree, tree_id: ".$node_data[
"tree"].
271 ", child: ".$node_data[
"child"]);
276 foreach ($affected_ids as $aid)
278 $ilAppEventHandler->raise(
"Services/Object",
"delete",
279 array(
"obj_id" => $aid[
"obj_id"],
280 "ref_id" => $aid[
"ref_id"],
281 "type" => $aid[
"type"]));
291 global
$log, $ilDB, $tree;
293 $q =
"SELECT tree FROM tree WHERE parent= ".
294 $ilDB->quote($a_node_id,
"integer").
" AND tree < 0";
296 $r = $ilDB->query($q);
298 while(
$row = $ilDB->fetchObject($r))
301 if (!in_array(
$row->tree,$a_checked))
304 $a_checked[] =
$row->tree;
307 $del_node_data = $deleted_tree->getNodeData(
$row->tree);
308 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
312 if ($a_delete_objects)
314 foreach ($del_subtree_nodes as $node)
319 $log->write(
"ilObjectGUI::removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
320 ", ref_id: ".$node_obj->getRefId().
", type: ".$node_obj->getType().
", ".
321 "title: ".$node_obj->getTitle());
322 $a_affected_ids[$node[
"ref_id"]] = array(
"ref_id" => $node[
"ref_id"],
323 "obj_id" => $node_obj->getId(),
"type" => $node_obj->getType());
330 $tree->deleteTree($del_node_data);
333 $log->write(
"ilObjectGUI::removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data[
"tree"].
334 ", child: ".$del_node_data[
"child"]);
346 global $rbacsystem,
$log, $ilAppEventHandler,
$lng;
350 foreach ($a_ref_ids as $id)
354 if (!$rbacsystem->checkAccess(
'create', $a_cur_ref_id, $obj_data->getType()))
360 if (count($no_create))
362 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
366 $affected_ids = array();
368 foreach ($a_ref_ids as $id)
370 $affected_ids[$id] = $id;
376 $saved_tree =
new ilTree(-(
int)$id);
377 $saved_tree->deleteTree($saved_tree->getNodeData($id));
380 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
383 $node_data = $saved_tree->getNodeData($id);
384 $saved_tree->deleteTree($node_data);
387 $node_data = $tree->getNodeData($id);
388 $parent_data = $tree->getParentNodeData($node_data[
'ref_id']);
390 $parent_data[
'obj_id']);
397 foreach ($affected_ids as $id)
400 $ilAppEventHandler->raise(
"Services/Object",
"undelete",
410 global $rbacadmin, $rbacreview,
$log, $tree;
412 $tree->insertNode($a_source_id,$a_dest_id,
IL_LAST_NODE,
true);
413 $a_affected_ids[$a_source_id] = $a_source_id;
416 $log->write(
"ilRepUtil::insertSavedNodes(), restored ref_id $a_source_id from trash");
419 $parentRoles = $rbacreview->getParentRoleIds($a_dest_id);
422 foreach ($parentRoles as $parRol)
424 $ops = $rbacreview->getOperationsOfRole($parRol[
"obj_id"], $obj->getType(), $parRol[
"parent"]);
425 $rbacadmin->grantPermission($parRol[
"obj_id"],$ops,$a_source_id);
428 $saved_tree =
new ilTree($a_tree_id);
429 $childs = $saved_tree->getChilds($a_source_id);
431 foreach ($childs as $child)