4 include_once(
"./classes/class.ilObjectFactory.php");
24 global $ilAppEventHandler, $rbacsystem, $rbacadmin,
$log, $ilUser, $tree,
$lng,
27 include_once
'./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);
73 session_unregister(
"saved_post");
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.ilECSContentWriter.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');
218 global $ilUser, $tree;
219 $parent_data = $tree->getParentNodeData($node_data[
'ref_id']);
221 $parent_data[
'obj_id']);
226 if (!$a_from_recovery_folder)
228 $checked[] = -(int) $id;
238 foreach ($subtree_nodes as $node)
246 $log->write(
"ilObjectGUI::removeFromSystemObject(), delete obj_id: ".$node_obj->getId().
247 ", ref_id: ".$node_obj->getRefId().
", type: ".$node_obj->getType().
", ".
248 "title: ".$node_obj->getTitle());
249 $affected_ids[$node[
"ref_id"]] = array(
"ref_id" => $node[
"ref_id"],
250 "obj_id" => $node_obj->getId(),
"type" => $node_obj->getType());
256 if (!$a_from_recovery_folder || $node_obj->getType() !=
"fold")
263 if (!$a_from_recovery_folder)
265 $saved_tree->deleteTree($node_data);
269 $tree->deleteTree($node_data);
273 $log->write(
"ilObjectGUI::removeFromSystemObject(), deleted tree, tree_id: ".$node_data[
"tree"].
274 ", child: ".$node_data[
"child"]);
279 foreach ($affected_ids as $aid)
281 $ilAppEventHandler->raise(
"Services/Object",
"delete",
282 array(
"obj_id" => $aid[
"obj_id"],
283 "ref_id" => $aid[
"ref_id"],
284 "type" => $aid[
"type"]));
296 $q =
"SELECT tree FROM tree WHERE parent= ".
297 $ilDB->quote($a_node_id,
"integer").
" AND tree < 0";
299 $r = $ilDB->query(
$q);
301 while(
$row = $ilDB->fetchObject($r))
304 if (!in_array(
$row->tree,$a_checked))
307 $a_checked[] =
$row->tree;
310 $del_node_data = $deleted_tree->getNodeData(
$row->tree);
311 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
315 if ($a_delete_objects)
317 foreach ($del_subtree_nodes as $node)
322 $log->write(
"ilObjectGUI::removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
323 ", ref_id: ".$node_obj->getRefId().
", type: ".$node_obj->getType().
", ".
324 "title: ".$node_obj->getTitle());
325 $a_affected_ids[$node[
"ref_id"]] = array(
"ref_id" => $node[
"ref_id"],
326 "obj_id" => $node_obj->getId(),
"type" => $node_obj->getType());
333 $tree->deleteTree($del_node_data);
336 $log->write(
"ilObjectGUI::removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data[
"tree"].
337 ", child: ".$del_node_data[
"child"]);
349 global $rbacsystem,
$log, $ilAppEventHandler,
$lng;
353 foreach ($a_ref_ids as $id)
357 if (!$rbacsystem->checkAccess(
'create', $a_cur_ref_id, $obj_data->getType()))
363 if (count($no_create))
365 include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
369 $affected_ids = array();
371 foreach ($a_ref_ids as $id)
373 $affected_ids[$id] = $id;
379 $saved_tree =
new ilTree(-(
int)$id);
380 $saved_tree->deleteTree($saved_tree->getNodeData($id));
383 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
386 global $ilUser, $tree;
388 $node_data = $saved_tree->getNodeData($id);
389 $saved_tree->deleteTree($node_data);
392 $node_data = $tree->getNodeData($id);
393 $parent_data = $tree->getParentNodeData($node_data[
'ref_id']);
395 $parent_data[
'obj_id']);
403 foreach ($affected_ids as $id)
406 $ilAppEventHandler->raise(
"Services/Object",
"undelete",
416 global $rbacadmin, $rbacreview,
$log, $tree;
418 $tree->insertNode($a_source_id,$a_dest_id,
IL_LAST_NODE,
true);
419 $a_affected_ids[$a_source_id] = $a_source_id;
422 $log->write(
"ilRepUtil::insertSavedNodes(), restored ref_id $a_source_id from trash");
425 $parentRoles = $rbacreview->getParentRoleIds($a_dest_id);
428 foreach ($parentRoles as $parRol)
430 $ops = $rbacreview->getOperationsOfRole($parRol[
"obj_id"], $obj->getType(), $parRol[
"parent"]);
431 $rbacadmin->grantPermission($parRol[
"obj_id"],$ops,$a_source_id);
434 $saved_tree =
new ilTree($a_tree_id);
435 $childs = $saved_tree->getChilds($a_source_id);
437 foreach ($childs as $child)