ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilForumPostsDeleted.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 protected $deleted_id = 0;
17 protected $deleted_date = null;
21 protected $deleted_by = '';
22
26 protected $forum_title = '';
30 protected $thread_title = '';
31
35 protected $post_title = '';
39 protected $post_message = '';
40
44 protected $post_date = '';
45
49 protected $obj_id = 0;
53 protected $ref_id = 0;
57 protected $thread_id = 0;
58
62 protected $forum_id = 0;
63
67 protected $pos_display_user_id = 0;
71 protected $pos_usr_alias = '';
72
76 protected $thread_deleted = false;
77
78 private $user;
79 private $db;
80
85 {
86 global $DIC;
87 $this->user = $DIC->user();
88 $this->db = $DIC->database();
89
90 if (is_object($provider)) {
91 $this->setDeletedBy($provider->getDeletedBy());
92
93 $this->setDeletedDate(date('Y-m-d H:i:s'));
94 $this->setForumTitle($provider->getForumTitle());
95 $this->setThreadTitle($provider->getThreadTitle());
96 $this->setPostTitle($provider->getPostTitle());
97
98 if ($provider->getPostCensored() == 1) {
99 $this->setPostMessage($provider->getCensorshipComment());
100 } else {
101 $this->setPostMessage($provider->getPostMessage());
102 }
103
104 $this->setPostDate($provider->getPostDate());
105 $this->setObjId($provider->getObjId());
106 $this->setRefId($provider->getRefId());
107 $this->setThreadId($provider->getThreadId());
108 $this->setForumId($provider->getForumId());
109 $this->setPosDisplayUserId($provider->getPosDisplayUserId());
110 $this->setPosUserAlias($provider->getPosUserAlias());
111 }
112 }
113
117 public function insert()
118 {
119 $next_id = $this->db->nextId('frm_posts_deleted');
120
121 $this->db->insert('frm_posts_deleted', array(
122 'deleted_id' => array('integer', $next_id),
123 'deleted_date' => array('timestamp', $this->getDeletedDate()),
124 'deleted_by' => array('text', $this->getDeletedBy()),
125 'forum_title' => array('text', $this->getForumTitle()),
126 'thread_title' => array('text', $this->getThreadTitle()),
127 'post_title' => array('text', $this->getPostTitle()),
128 'post_message' => array('text', $this->getPostMessage()),
129
130 'post_date' => array('timestamp', $this->getPostDate()),
131 'obj_id' => array('integer', $this->getObjId()),
132 'ref_id' => array('integer', $this->getRefId()),
133 'thread_id' => array('integer', $this->getThreadId()),
134 'forum_id' => array('integer', $this->getForumId()),
135 'pos_display_user_id' => array('integer', $this->getPosDisplayUserId()),
136 'pos_usr_alias' => array('text', $this->getPosUserAlias()),
137 'is_thread_deleted' => array('integer', $this->isThreadDeleted())
138 ));
139 }
140
144 public function deleteNotifiedEntries()
145 {
146 $this->db->manipulateF('DELETE FROM frm_posts_deleted WHERE deleted_id > %s', array('integer'), array(0));
147 }
148
149
150 //----------------// SETTER & GETTER //----------------//
154 public function getDeletedId()
155 {
156 return $this->deleted_id;
157 }
158
162 public function setDeletedId($deleted_id)
163 {
164 $this->deleted_id = $deleted_id;
165 }
166
170 public function getDeletedDate()
171 {
172 return $this->deleted_date;
173 }
174
179 {
180 $this->deleted_date = $deleted_date;
181 }
182
186 public function getDeletedBy()
187 {
188 return $this->deleted_by;
189 }
190
194 public function setDeletedBy($deleted_by)
195 {
196 $this->deleted_by = $deleted_by;
197 }
198
202 public function getForumTitle()
203 {
204 return $this->forum_title;
205 }
206
211 {
212 $this->forum_title = $forum_title;
213 }
214
218 public function getThreadTitle()
219 {
220 return $this->thread_title;
221 }
222
227 {
228 $this->thread_title = $thread_title;
229 }
230
234 public function getPostTitle()
235 {
236 return $this->post_title;
237 }
238
242 public function setPostTitle($post_title)
243 {
244 $this->post_title = $post_title;
245 }
246
250 public function getPostMessage()
251 {
252 return $this->post_message;
253 }
254
259 {
260 $this->post_message = $post_message;
261 }
262
266 public function getPostDate()
267 {
268 return $this->post_date;
269 }
270
274 public function setPostDate($post_date)
275 {
276 $this->post_date = $post_date;
277 }
278
282 public function getObjId()
283 {
284 return $this->obj_id;
285 }
286
290 public function setObjId($obj_id)
291 {
292 $this->obj_id = $obj_id;
293 }
294
298 public function getRefId()
299 {
300 return $this->ref_id;
301 }
302
306 public function setRefId($ref_id)
307 {
308 $this->ref_id = $ref_id;
309 }
310
314 public function getThreadId()
315 {
316 return $this->thread_id;
317 }
318
322 public function setThreadId($thread_id)
323 {
324 $this->thread_id = $thread_id;
325 }
326
330 public function getForumId()
331 {
332 return $this->forum_id;
333 }
334
338 public function setForumId($forum_id)
339 {
340 $this->forum_id = $forum_id;
341 }
342
346 public function getPosDisplayUserId()
347 {
349 }
350
355 {
356 $this->pos_display_user_id = $pos_display_user_id;
357 }
358
362 public function getPosUserAlias()
363 {
365 }
366
371 {
372 $this->pos_usr_alias = $pos_usr_alias;
373 }
374
378 public function isThreadDeleted()
379 {
381 }
382
387 {
388 $this->thread_deleted = $thread_deleted;
389 }
390}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Class ilForumPostsDeleted.
__construct(ilObjForumNotificationDataProvider $provider=null)
setPosDisplayUserId($pos_display_user_id)
global $DIC
Definition: saml.php:7