ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilForumPostsTree.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 private readonly ilDBInterface $db;
28 private int $pos_fk = 0;
29 private int $parent_pos = 0;
30 private int $lft = 0;
31 private int $rgt = 0;
32 private int $depth = 0;
33 private int $source_thread_id = 0;
34 private int $target_thread_id = 0;
35
36 public function __construct()
37 {
38 global $DIC;
39 $this->db = $DIC->database();
40 }
41
42 public function setDepth(int $depth): void
43 {
44 $this->depth = $depth;
45 }
46
47 public function getDepth(): int
48 {
49 return $this->depth;
50 }
51
52 public function setLft(int $lft): void
53 {
54 $this->lft = $lft;
55 }
56
57 public function getLft(): int
58 {
59 return $this->lft;
60 }
61
62 public function setParentPos(int $parent_pos): void
63 {
64 $this->parent_pos = $parent_pos;
65 }
66
67 public function getParentPos(): int
68 {
69 return $this->parent_pos;
70 }
71
72 public function setPosFk(int $pos_fk): void
73 {
74 $this->pos_fk = $pos_fk;
75 }
76
77 public function getPosFk(): int
78 {
79 return $this->pos_fk;
80 }
81
82 public function setRgt(int $rgt): void
83 {
84 $this->rgt = $rgt;
85 }
86
87 public function getRgt(): int
88 {
89 return $this->rgt;
90 }
91
92 public function setSourceThreadId(int $source_thread_id): void
93 {
94 $this->source_thread_id = $source_thread_id;
95 }
96
97 public function getSourceThreadId(): int
98 {
100 }
101
102 public function setTargetThreadId(int $target_thread_id): void
103 {
104 $this->target_thread_id = $target_thread_id;
105 }
106
107 public function getTargetThreadId(): int
108 {
110 }
111
112 public function merge(): void
113 {
114 $this->db->update(
115 'frm_posts_tree',
116 [
117 'lft' => ['integer', $this->getLft()],
118 'rgt' => ['integer', $this->getRgt()],
119 'depth' => ['integer', $this->getDepth()],
120 'thr_fk' => ['integer', $this->getTargetThreadId()],
121 'parent_pos' => ['integer', $this->getParentPos()],
122 ],
123 [
124 'pos_fk' => ['integer', $this->getPosFk()],
125 'thr_fk' => ['integer', $this->getSourceThreadId()]
126 ]
127 );
128 }
129
130 public static function updateTargetRootRgt(int $root_node_id, int $rgt): void
131 {
132 global $DIC;
133
134 $ilDB = $DIC->database();
135
136 $ilDB->update(
137 'frm_posts_tree',
138 [
139 'rgt' => ['integer', $rgt]
140 ],
141 [
142 'parent_pos' => ['integer', 0],
143 'pos_fk' => ['integer', $root_node_id]
144 ]
145 );
146 }
147}
readonly ilDBInterface $db
static updateTargetRootRgt(int $root_node_id, int $rgt)
setSourceThreadId(int $source_thread_id)
setTargetThreadId(int $target_thread_id)
setParentPos(int $parent_pos)
Interface ilDBInterface.
global $DIC
Definition: shib_login.php:26