43 $this->db = $DIC->database();
44 $this->logger = $DIC->logger()->tree();
46 $this->tree = $DIC->repositoryTree();
57 $tree = $DIC->repositoryTree();
59 $query =
'select tree,child,parent from tree ' .
62 $trashed_trash =
false;
64 if ((
int) $row->child != ((int) $row->tree * -1)) {
65 $trashed_trash =
true;
67 if (
$tree->isDeleted($row->parent)) {
68 $trashed_trash =
true;
71 return $trashed_trash;
81 $query =
'select parent from tree ' .
84 $this->logger->info(
$query);
89 $this->logger->warning(
'Invalid node given for restoring to original location: deleted node id: ' . $deleted_node);
90 throw new \ilRepositoryException(
'Invalid node given for restoring to original location');
99 $subtreequery = $this->tree->getTrashSubTreeQuery($ref_id, [
'child']);
101 $query =
'select distinct(type) obj_type from object_data obd ' .
102 'join object_reference obr on obd.obj_id = obr.obj_id ' .
103 'where ref_id in (' .
104 $subtreequery .
' ' .
107 $this->logger->dump(
$query);
112 $obj_types[] = $row->obj_type;
123 $res = $this->db->query($this->tree->getTrashSubTreeQuery($ref_id, [
'child']));
124 return (
int)
$res->numRows();
144 string $order_direction,
145 int $limit = self::QUERY_LIMIT,
148 $subtreequery = $this->tree->getTrashSubTreeQuery($ref_id, [
'child']);
150 $select =
'select ref_id, obd.obj_id, type, title, description, deleted, deleted_by ';
151 $select_count =
'select count(ref_id) max_entries ';
153 $from =
'from object_data obd ' .
154 'join object_reference obr on obd.obj_id = obr.obj_id ' .
155 'where ref_id in (' .
156 $subtreequery .
' ' .
161 $order =
'ORDER BY ' . $order_field .
' ' . $order_direction;
168 $this->logger->dump(
$query);
173 $res_max_entries = $this->db->query($query_count);
175 $max_entries = $max_entries_row->max_entries;
178 $this->db->setLimit($limit, $offset);
184 $item = new \ilTreeTrashItem();
185 $item->setObjId($row->obj_id);
186 $item->setRefId($row->ref_id);
187 $item->setTitle($row->title);
188 $item->setDescription($row->description);
189 $item->setType($row->type);
190 $item->setDeleted($row->deleted);
191 $item->setDeletedBy($row->deleted_by);
207 $query =
'with recursive trash (child,tree) as ' .
209 'union select tc.child,tc.tree from tree tc join tree tp on tp.child = tc.parent ) ' .
210 'select * from trash where tree < 1 ';
217 $trash_ids[] = $row->child;
220 $this->logger->warning(
$query .
' is not supported');
231 if (isset($filter[
'type'])) {
232 $query .=
'and ' . $this->db->like(
235 $filter[
'type'] .
'%' 238 if (isset($filter[
'title'])) {
239 $query .=
'and ' . $this->db->like(
242 '%' . $filter[
'title'] .
'%' 246 $filter[
'deleted'][
'from'] instanceof \
ilDate &&
247 $filter[
'deleted'][
'to'] instanceof \
ilDate) {
248 $query .= (
'and deleted between ' .
251 } elseif ($filter[
'deleted'][
'from'] instanceof \ilDate) {
253 } elseif ($filter[
'deleted'][
'to'] instanceof \ilDate) {
257 if (isset($filter[
'deleted_by']) && !empty($filter[
'deleted_by'])) {
getTrashNodeForContainer(int $ref_id, array $filter, int &$max_entries, string $order_field, string $order_direction, int $limit=self::QUERY_LIMIT, int $offset=0)
Get trashed nodes.
appendTrashNodeForContainerQueryFilter(array $filter)
getTrashedNodeTypesForContainer(int $ref_id)
getTrashedNodesForContainerUsingRecursion(int $ref_id)
Unfortunately not supported by mysql 5.
static _lookupId($a_user_str)
Lookup id by login.
Class ilDatabaseException.
__construct()
ilTreeTrash constructor.
foreach($_POST as $key=> $value) $res
findRepositoryLocationForDeletedNode(int $deleted_node)
getNumberOfTrashedNodesForTrashedContainer(int $ref_id)
isTrashedTrash(array $ref_ids)