ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TreeStandardAdapter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
27 public function __construct(
28 protected InternalRepoService $repo,
29 protected \ilTree $tree,
30 protected int $user_id
31 ) {
32 }
33 public function isDeleted(int $node_id): bool
34 {
35 return $this->tree->isDeleted($node_id);
36 }
37 public function useCache(bool $use): void
38 {
39 $this->tree->useCache($use);
40 }
41 public function getNodeData(int $id): array
42 {
43 return $this->tree->getNodeData($id);
44 }
45 public function getSubTree(array $node): array
46 {
47 return $this->tree->getSubTree($node);
48 }
49
50 public function moveToTrash(int $ref_id): bool
51 {
52 return $this->tree->moveToTrash($ref_id, true, $this->user_id);
53 }
54
58 public function getDeletedTreeNodeIds(array $ids): array
59 {
60 $deleted_ids = [];
61 foreach ($ids as $id) {
62 if ($this->tree->isDeleted($id)) {
63 $deleted_ids[] = $id;
64 }
65 }
66 return $deleted_ids;
67 }
68
69 public function getTree(int $tree_id): TreeInterface
70 {
71 return new self(new \ilTree($tree_id), $this->user_id);
72 }
73
74 public function getTrashTree(int $ref_id): TreeInterface
75 {
77 $tree_id = end($trees);
78
79 if ($tree_id) {
80 if ($tree_id >= 0) {
81 throw new NotInTrashException('Trying to delete node from trash, but node is not in trash: ' . $ref_id);
82 }
83 return new self(new \ilTree($tree_id), $this->user_id);
84 }
85 throw new NotInTrashException('Trying to delete node from trash, but no valid tree id found for node id: ' . $ref_id);
86 }
87
88 public function deleteTree(array $node_data): void
89 {
90 $this->tree->deleteTree($node_data);
91 }
92
97 public function getTrashedSubtrees(int $ref_id): array
98 {
99 $tree_repo = $this->repo->tree();
100 return $tree_repo->getTrashedSubtrees($ref_id);
101 }
102}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(protected InternalRepoService $repo, protected \ilTree $tree, protected int $user_id)
getTrashedSubtrees(int $ref_id)
Get (negative) tree ids of trashed children.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static lookupTreesForNode(int $node_id)
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...