4include_once(
"./Services/Object/classes/class.ilObjectFactory.php");
 
   38        $this->db = 
$DIC->database();
 
   39        $this->tree = 
$DIC->repositoryTree();
 
   53        $ilAppEventHandler = 
$DIC[
"ilAppEventHandler"];
 
   54        $rbacsystem = 
$DIC->rbac()->system();
 
   55        $rbacadmin = 
$DIC->rbac()->admin();
 
   56        $ilLog = 
$DIC[
"ilLog"];
 
   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"]) {
 
  117            $affected_ids = array();
 
  118            $affected_parents = array();
 
  119            foreach ($a_ids as $id) {
 
  120                if (
$tree->isDeleted($id)) {
 
  121                    $log->write(__METHOD__ . 
': Object with ref_id: ' . $id . 
' already deleted.');
 
  126                $subnodes = 
$tree->getSubtree(
$tree->getNodeData($id));
 
  128                foreach ($subnodes as $subnode) {
 
  129                    $rbacadmin->revokePermission($subnode[
"child"]);
 
  131                    $affected_ids[$subnode[
"child"]] = $subnode[
"child"];
 
  132                    $affected_parents[$subnode[
"child"]] = $subnode[
"parent"];
 
  137                include_once(
'./Services/WebServices/ECS/classes/class.ilECSObjectSettings.php');
 
  139                if (!
$tree->moveToTrash($id, 
true, $user->getId())) {
 
  140                    $log->write(__METHOD__ . 
': Object with ref_id: ' . $id . 
' already deleted.');
 
  145                $log->write(
"ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $id .
 
  148                $affected_ids[$id] = $id;
 
  152            foreach ($affected_ids as $aid) {
 
  153                $ilAppEventHandler->raise(
 
  158                           "old_parent_ref_id" => $affected_parents[$aid]
 
  179        $logger = 
$DIC->logger()->rep();
 
  181        $ilLog = 
$DIC[
"ilLog"];
 
  182        $ilAppEventHandler = 
$DIC[
"ilAppEventHandler"];
 
  187        $affected_ids = array();
 
  190        foreach ($a_ref_ids as $id) {
 
  192            if (!$a_from_recovery_folder) {
 
  194                $tree_id = end($trees);
 
  197                    $saved_tree = new \ilTree((
int) $tree_id);
 
  198                    $node_data = $saved_tree->getNodeData($id);
 
  199                    $subtree_nodes = $saved_tree->getSubTree($node_data);
 
  201                    throw new \ilRepositoryException(
'No valid tree id found for node id: ' . $id);
 
  204                $node_data = 
$tree->getNodeData($id);
 
  205                $subtree_nodes = 
$tree->getSubTree($node_data);
 
  212            $parent_data = 
$tree->getParentNodeData($node_data[
'ref_id']);
 
  214                $node_data[
'obj_id'],
 
  217                $parent_data[
'obj_id']
 
  222            if (!$a_from_recovery_folder) {
 
  223                $checked[] = -(int) $id;
 
  231            foreach ($subtree_nodes as $node) {
 
  237                $log->write(
"ilObjectGUI::removeFromSystemObject(), delete obj_id: " . $node_obj->getId() .
 
  238                    ", ref_id: " . $node_obj->getRefId() . 
", type: " . $node_obj->getType() . 
", " .
 
  239                    "title: " . $node_obj->getTitle());
 
  240                $affected_ids[$node[
"ref_id"]] = array(
 
  241                                                    "ref_id" => $node[
"ref_id"],
 
  242                                                    "obj_id" => $node_obj->getId(),
 
  243                                                    "type" => $node_obj->getType(),
 
  244                                                    "old_parent_ref_id" => $node[
"parent"]);
 
  250                if (!$a_from_recovery_folder || $node_obj->getType() != 
"fold") {
 
  256            if (!$a_from_recovery_folder) {
 
  257                $saved_tree->deleteTree($node_data);
 
  259                $tree->deleteTree($node_data);
 
  263            $log->write(
"ilObjectGUI::removeFromSystemObject(), deleted tree, tree_id: " . $node_data[
"tree"] .
 
  264                ", child: " . $node_data[
"child"]);
 
  268        foreach ($affected_ids as $aid) {
 
  269            $ilAppEventHandler->raise(
 
  272                array(
"obj_id" => $aid[
"obj_id"],
 
  273                "ref_id" => $aid[
"ref_id"],
 
  274                "type" => $aid[
"type"],
 
  275                "old_parent_ref_id" => $aid[
"old_parent_ref_id"])
 
  291        $ilLog = 
$DIC[
"ilLog"];
 
  297        $q = 
"SELECT tree FROM tree WHERE parent= " .
 
  298            $ilDB->quote($a_node_id, 
"integer") . 
" AND tree < 0";
 
  300        $r = 
$ilDB->query($q);
 
  302        while ($row = 
$ilDB->fetchObject($r)) {
 
  304            if (!in_array($row->tree, $a_checked)) {
 
  305                $deleted_tree = 
new ilTree($row->tree);
 
  306                $a_checked[] = $row->tree;
 
  308                $row->tree = $row->tree * (-1);
 
  309                $del_node_data = $deleted_tree->getNodeData($row->tree);
 
  310                $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
 
  314                if ($a_delete_objects) {
 
  315                    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(
 
  323                                                            "ref_id" => $node[
"ref_id"],
 
  324                                                            "obj_id" => $node_obj->getId(),
 
  325                                                            "type" => $node_obj->getType(),
 
  326                                                            "old_parent_ref_id" => $node[
"parent"]);
 
  332                $tree->deleteTree($del_node_data);
 
  335                $log->write(
"ilObjectGUI::removeDeletedNodes(), deleted tree, tree_id: " . $del_node_data[
"tree"] .
 
  336                    ", child: " . $del_node_data[
"child"]);
 
  356        $rbacsystem = 
$DIC->rbac()->system();
 
  357        $ilAppEventHandler = 
$DIC[
"ilAppEventHandler"];
 
  365        foreach ($a_ref_ids as $id) {
 
  368            if (!$rbacsystem->checkAccess(
'create', $a_cur_ref_id, $obj_data->getType())) {
 
  373        if (count($no_create)) {
 
  374            include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
 
  378        $affected_ids = array();
 
  380        foreach ($a_ref_ids as $id) {
 
  381            $affected_ids[$id] = $id;
 
  386                $tree_id = $tree_ids[0];
 
  388            } 
catch (Exception 
$e) {
 
  389                include_once(
"./Services/Repository/exceptions/class.ilRepositoryException.php");
 
  395            require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
 
  415        foreach ($affected_ids as $id) {
 
  417            $ilAppEventHandler->raise(
 
  428    private static function insertSavedNodes($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
 
  434        ilLoggerFactory::getLogger(
'rep')->debug(
'Restoring from trash: source_id: ' . $a_source_id . 
', dest_id: ' . $a_dest_id . 
', tree_id:' . $a_tree_id);
 
  438        $saved_tree = 
new ilTree($a_tree_id);
 
  439        $childs = $saved_tree->getChilds($a_source_id);
 
  443            $tree->insertNodeFromTrash($a_source_id, $a_dest_id, $a_tree_id, 
IL_LAST_NODE, 
true);
 
  444        } 
catch (Exception 
$e) {
 
  449        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  451        $ref_obj = 
$factory->getInstanceByRefId($a_source_id, 
false);
 
  453            $lroles = 
$GLOBALS[
'rbacreview']->getRolesOfRoleFolder($a_source_id, 
true);
 
  454            foreach ($lroles as $role_id) {
 
  455                include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  457                $role->setParent($a_source_id);
 
  461                $ref_obj->setPermissions($a_dest_id);
 
  464        foreach ($childs as $child) {
 
  481        $set = 
$ilDB->query(
"SELECT child" .
 
  483            " JOIN object_reference ref ON (tree.child = ref.ref_id)" .
 
  484            " JOIN object_data od ON (od.obj_id = ref.obj_id)" .
 
  485            " WHERE tree.tree < " . 
$ilDB->quote(0, 
"integer") .
 
  486            " AND od.type = " . 
$ilDB->quote($a_type, 
"text"));
 
  487        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  488            $res[] = $row[
"child"];
 
  498        $set = 
$ilDB->query(
"SELECT obj_id" .
 
  499            " FROM object_data " .
 
  500            " WHERE type = " . 
$ilDB->quote(
"typ", 
"text") .
 
  501            " AND title = " . 
$ilDB->quote($a_type, 
"text"));
 
  502        $row = 
$ilDB->fetchAssoc($set);
 
  503        return $row[
"obj_id"];
 
  515        if ($ref_ids_in_tree) {
 
  521            if ($ref_ids_in_trash) {
 
  531            $ilDB->manipulate(
"DELETE FROM object_data" .
 
  532                " WHERE obj_id = " . 
$ilDB->quote($type_id, 
"integer"));
 
  537            $ilDB->manipulate(
"DELETE FROM rbac_ta" .
 
  538                " WHERE typ_id = " . 
$ilDB->quote($type_id, 
"integer") 
 
  542            $set = 
$ilDB->query(
"SELECT ops_id" .
 
  543                " FROM rbac_operations " .
 
  544                " WHERE class = " . 
$ilDB->quote(
"create", 
"text") .
 
  545                " AND operation = " . 
$ilDB->quote(
"create_" . $a_type, 
"text"));
 
  546            $row = 
$ilDB->fetchAssoc($set);
 
  547            $create_ops_id = $row[
"ops_id"];
 
  548            if ($create_ops_id) {
 
  549                $ilDB->manipulate(
"DELETE FROM rbac_operations" .
 
  550                    " WHERE ops_id = " . 
$ilDB->quote($create_ops_id, 
"integer"));
 
  552                $ilDB->manipulate(
"DELETE FROM rbac_templates" .
 
  553                    " WHERE ops_id = " . 
$ilDB->quote($create_ops_id, 
"integer"));
 
  556                foreach (array(
"root", 
"cat", 
"crs", 
"grp", 
"fold") as $parent_type) {
 
  558                    if ($parent_type_id) {
 
  559                        $ilDB->manipulate(
"DELETE FROM rbac_ta" .
 
  560                            " WHERE typ_id = " . 
$ilDB->quote($parent_type_id, 
"integer") .
 
  561                            " AND ops_id = " . 
$ilDB->quote($create_ops_id, 
"integer"));
 
  568        include_once 
"Services/Repository/classes/class.ilObjRepositorySettings.php";
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
static _handleDelete(array $a_subbtree_nodes)
static getLogger($a_component_id)
Get component logger.
static deleteObjectType($a_type)
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
Repository Utilities (application layer, put GUI related stuff into ilRepUtilGUI)
static deleteObjects($a_cur_ref_id, $a_ids)
Delete objects.
static removeDeletedNodes( $a_node_id, $a_checked, $a_delete_objects, &$a_affected_ids)
Remove already deleted objects within the objects in trash.
static restoreObjects($a_cur_ref_id, $a_ref_ids)
Move objects from trash back to repository.
deleteObjectType($a_type)
static insertSavedNodes($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
Recursive method to insert all saved nodes of the clipboard.
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() ...
__construct()
Constructor.
static clear($a_var)
Unset a value.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static lookupTreesForNode(int $node_id)
foreach($_POST as $key=> $value) $res