ILIAS  release_7 Revision v7.30-3-g800a261c036
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
84 public function __construct(ilObjForumNotificationDataProvider $provider = null)
85 {
86 global $DIC;
87 $this->user = $DIC->user();
88 $this->db = $DIC->database();
89
90 if (is_object($provider)) {
91 if ($provider->objPost->getUserAlias() && $provider->objPost->getDisplayUserId() == 0
92 && $provider->objPost->getPosAuthorId() == $DIC->user()->getId()) {
93 $this->setDeletedBy($provider->objPost->getUserAlias());
94 } else {
95 $this->setDeletedBy($this->user->getLogin());
96 }
97
98 $this->setDeletedDate(date('Y-m-d H:i:s'));
99 $this->setForumTitle($provider->getForumTitle());
100 $this->setThreadTitle($provider->getThreadTitle());
101 $this->setPostTitle($provider->getPostTitle());
102
103 if ($provider->getPostCensored() == 1) {
104 $this->setPostMessage($provider->getCensorshipComment());
105 } else {
106 $this->setPostMessage($provider->getPostMessage());
107 }
108
109 $this->setPostDate($provider->getPostDate());
110 $this->setObjId($provider->getObjId());
111 $this->setRefId($provider->getRefId());
112 $this->setThreadId($provider->getThreadId());
113 $this->setForumId($provider->getForumId());
114 $this->setPosDisplayUserId($provider->getPosDisplayUserId());
115 $this->setPosUserAlias($provider->getPosUserAlias());
116 }
117 }
118
122 public function insert()
123 {
124 $next_id = $this->db->nextId('frm_posts_deleted');
125
126 $this->db->insert('frm_posts_deleted', array(
127 'deleted_id' => array('integer', $next_id),
128 'deleted_date' => array('timestamp', $this->getDeletedDate()),
129 'deleted_by' => array('text', $this->getDeletedBy()),
130 'forum_title' => array('text', $this->getForumTitle()),
131 'thread_title' => array('text', $this->getThreadTitle()),
132 'post_title' => array('text', $this->getPostTitle()),
133 'post_message' => array('text', $this->getPostMessage()),
134
135 'post_date' => array('timestamp', $this->getPostDate()),
136 'obj_id' => array('integer', $this->getObjId()),
137 'ref_id' => array('integer', $this->getRefId()),
138 'thread_id' => array('integer', $this->getThreadId()),
139 'forum_id' => array('integer', $this->getForumId()),
140 'pos_display_user_id' => array('integer', $this->getPosDisplayUserId()),
141 'pos_usr_alias' => array('text', $this->getPosUserAlias()),
142 'is_thread_deleted' => array('integer', $this->isThreadDeleted())
143 ));
144 }
145
149 public function deleteNotifiedEntries()
150 {
151 $this->db->manipulateF('DELETE FROM frm_posts_deleted WHERE deleted_id > %s', array('integer'), array(0));
152 }
153
154
155 //----------------// SETTER & GETTER //----------------//
159 public function getDeletedId()
160 {
161 return $this->deleted_id;
162 }
163
167 public function setDeletedId($deleted_id)
168 {
169 $this->deleted_id = $deleted_id;
170 }
171
175 public function getDeletedDate()
176 {
177 return $this->deleted_date;
178 }
179
184 {
185 $this->deleted_date = $deleted_date;
186 }
187
191 public function getDeletedBy()
192 {
193 return $this->deleted_by;
194 }
195
199 public function setDeletedBy($deleted_by)
200 {
201 $this->deleted_by = $deleted_by;
202 }
203
207 public function getForumTitle()
208 {
209 return $this->forum_title;
210 }
211
216 {
217 $this->forum_title = $forum_title;
218 }
219
223 public function getThreadTitle()
224 {
225 return $this->thread_title;
226 }
227
232 {
233 $this->thread_title = $thread_title;
234 }
235
239 public function getPostTitle()
240 {
241 return $this->post_title;
242 }
243
247 public function setPostTitle($post_title)
248 {
249 $this->post_title = $post_title;
250 }
251
255 public function getPostMessage()
256 {
257 return $this->post_message;
258 }
259
264 {
265 $this->post_message = $post_message;
266 }
267
271 public function getPostDate()
272 {
273 return $this->post_date;
274 }
275
279 public function setPostDate($post_date)
280 {
281 $this->post_date = $post_date;
282 }
283
287 public function getObjId()
288 {
289 return $this->obj_id;
290 }
291
295 public function setObjId($obj_id)
296 {
297 $this->obj_id = $obj_id;
298 }
299
303 public function getRefId()
304 {
305 return $this->ref_id;
306 }
307
311 public function setRefId($ref_id)
312 {
313 $this->ref_id = $ref_id;
314 }
315
319 public function getThreadId()
320 {
321 return $this->thread_id;
322 }
323
327 public function setThreadId($thread_id)
328 {
329 $this->thread_id = $thread_id;
330 }
331
335 public function getForumId()
336 {
337 return $this->forum_id;
338 }
339
343 public function setForumId($forum_id)
344 {
345 $this->forum_id = $forum_id;
346 }
347
351 public function getPosDisplayUserId()
352 {
354 }
355
360 {
361 $this->pos_display_user_id = $pos_display_user_id;
362 }
363
367 public function getPosUserAlias()
368 {
370 }
371
376 {
377 $this->pos_usr_alias = $pos_usr_alias;
378 }
379
383 public function isThreadDeleted()
384 {
386 }
387
392 {
393 $this->thread_deleted = $thread_deleted;
394 }
395}
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: goto.php:24