ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilForumPostsTree.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
10 private $thr_fk = 0;
11 private $pos_fk = 0;
12 private $parent_pos = 0;
13 private $lft = 0;
14 private $rgt = 0;
15 private $depth = 0;
16
17 private $source_thread_id = 0;
18 private $target_thread_id = 0;
19
20 private $db;
21
22 public function setDepth($depth)
23 {
24 $this->depth = $depth;
25 }
26
27 public function getDepth()
28 {
29 return $this->depth;
30 }
31
32 public function setLft($lft)
33 {
34 $this->lft = $lft;
35 }
36
37 public function getLft()
38 {
39 return $this->lft;
40 }
41
42 public function setParentPos($parent_pos)
43 {
44 $this->parent_pos = $parent_pos;
45 }
46
47 public function getParentPos()
48 {
49 return $this->parent_pos;
50 }
51
52 public function setPosFk($pos_fk)
53 {
54 $this->pos_fk = $pos_fk;
55 }
56
57 public function getPosFk()
58 {
59 return $this->pos_fk;
60 }
61
62 public function setRgt($rgt)
63 {
64 $this->rgt = $rgt;
65 }
66
67 public function getRgt()
68 {
69 return $this->rgt;
70 }
71
72 public function setThrFk($thr_fk)
73 {
74 $this->thr_fk = $thr_fk;
75 }
76
77 public function getThrFk()
78 {
79 return $this->thr_fk;
80 }
81
83 {
84 $this->source_thread_id = $source_thread_id;
85 }
86
87 public function getSourceThreadId()
88 {
90 }
91
93 {
94 $this->target_thread_id = $target_thread_id;
95 }
96
97 public function getTargetThreadId()
98 {
100 }
101
102 public function __construct()
103 {
104 global $DIC;
105 $this->db = $DIC->database();
106 }
107
108 public function mergeParentPos()
109 {
110 $this->db->update(
111 'frm_posts_tree',
112 array(
113 'parent_pos' => array('integer', $this->getParentPos()),
114 'lft' => array('integer', $this->getLft()),
115 'rgt' => array('integer', $this->getRgt()),
116 'depth' => array('integer', $this->getDepth()),
117 'thr_fk' => array('integer', $this->getTargetThreadId())
118 ),
119 array(
120 'pos_fk' => array('integer', $this->getPosFk()),
121 'parent_pos' => array('integer', 0),
122 'thr_fk' => array('integer', $this->getSourceThreadId())
123 )
124 );
125 }
126 public function merge()
127 {
128 $this->db->update(
129 'frm_posts_tree',
130 array(
131 'lft' => array('integer', $this->getLft()),
132 'rgt' => array('integer', $this->getRgt()),
133 'depth' => array('integer', $this->getDepth()),
134 'thr_fk' => array('integer', $this->getTargetThreadId())
135 ),
136 array(
137 'pos_fk' => array('integer', $this->getPosFk()),
138 'parent_pos' => array('integer', $this->getParentPos()),
139 'thr_fk' => array('integer', $this->getSourceThreadId())
140 )
141 );
142 }
143
144 /***
145 * @param integer $root_node_id
146 * @param integer $rgt
147 */
148 public static function updateTargetRootRgt($root_node_id, $rgt)
149 {
150 global $DIC;
151 $ilDB = $DIC->database();
152
153 $ilDB->update(
154 'frm_posts_tree',
155 array(
156 'rgt' => array('integer', $rgt)),
157 array(
158 'parent_pos' => array('integer', 0),
159 'pos_fk' => array('integer', $root_node_id)
160 )
161 );
162 }
163}
An exception for terminatinating execution or to throw for unit testing.
setSourceThreadId($source_thread_id)
static updateTargetRootRgt($root_node_id, $rgt)
setTargetThreadId($target_thread_id)
global $DIC
Definition: saml.php:7
global $ilDB