ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumPost Class Reference
+ Collaboration diagram for ilForumPost:

Public Member Functions

 __construct (int $a_id=0, bool $a_is_moderator=false, bool $preventImplicitRead=false)
 
 insert ()
 
 update ()
 
 isAnyParentDeactivated ()
 
 reload ()
 
 activatePost ()
 
 activatePostAndChildPosts ()
 
 activateParentPosts ()
 
 isPostRead ()
 
 isRead (int $a_user_id=0)
 
 hasReplies ()
 
 isOwner (int $a_user_id=0)
 
 setId (int $a_id)
 
 getId ()
 
 setForumId (int $a_forum_id)
 
 getForumId ()
 
 setThreadId (int $a_thread_id)
 
 getThreadId ()
 
 setDisplayUserId (int $a_user_id)
 
 getDisplayUserId ()
 
 setUserAlias (?string $a_user_alias)
 
 getUserAlias ()
 
 setSubject (string $a_subject)
 
 getSubject ()
 
 setMessage (string $a_message)
 
 getMessage ()
 
 setCreateDate (?string $a_createdate)
 
 getCreateDate ()
 
 setChangeDate (?string $a_changedate)
 
 getChangeDate ()
 
 setUpdateUserId (int $a_user_id_update)
 
 getUpdateUserId ()
 
 setCensorship (bool $a_censorship)
 
 isCensored ()
 
 setCensorshipComment (?string $a_comment)
 
 getCensorshipComment ()
 
 setNotification (bool $a_notification)
 
 isNotificationEnabled ()
 
 setImportName (?string $a_import_name)
 
 getImportName ()
 
 setStatus (bool $a_status)
 
 isActivated ()
 
 setTreeId (int $a_tree_id)
 
 getTreeId ()
 
 setParentId (int $a_parent_id)
 
 setIsRead (bool $a_is_read)
 
 getIsRead ()
 
 getParentId ()
 
 setLft (int $a_lft)
 
 getLft ()
 
 setRgt (int $a_rgt)
 
 getRgt ()
 
 setDepth (int $a_depth)
 
 getDepth ()
 
 setThread (ilForumTopic $thread)
 
 getThread ()
 
 setPosAuthorId (int $pos_author_id)
 
 getPosAuthorId ()
 
 isAuthorModerator ()
 
 setIsAuthorModerator (?bool $is_author_moderator)
 
 getCensoredDate ()
 
 getPostActivationDate ()
 
 setPostActivationDate (?string $post_activation_date)
 
 setCensoredDate (?string $censored_date)
 
 assignData (array $row)
 

Static Public Member Functions

static mergePosts (int $sourceThreadId, int $targetThreadId, array $excludedPostIds=[])
 
static lookupNotificationStatusByPostId (int $post_id)
 
static lookupPostMessage (int $post_id)
 

Private Member Functions

 read ()
 

Private Attributes

int $id
 
int $forum_id = 0
 
int $thread_id = 0
 
int $display_user_id = 0
 
string $user_alias = null
 
string $subject = ''
 
string $message = ''
 
string $createdate = null
 
string $changedate = null
 
int $user_id_update = 0
 
bool $censored = false
 
string $censorship_comment = null
 
string $censored_date = null
 
bool $notification = false
 
string $import_name = null
 
bool $status = true
 
int $tree_id = 0
 
int $parent_id = 0
 
int $lft = 0
 
int $rgt = 0
 
int $depth = 0
 
ilForumTopic $objThread = null
 
ilDBInterface $db
 
bool $is_moderator = false
 
bool $is_author_moderator = false
 
bool $post_read = false
 
int $pos_author_id = 0
 
string $post_activation_date = null
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 25 of file class.ilForumPost.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumPost::__construct ( int  $a_id = 0,
bool  $a_is_moderator = false,
bool  $preventImplicitRead = false 
)

Definition at line 56 of file class.ilForumPost.php.

References $DIC, and read().

57  {
58  global $DIC;
59 
60  $this->db = $DIC->database();
61  $this->id = $a_id;
62 
63  if (!$preventImplicitRead) {
64  $this->read();
65  }
66  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ activateParentPosts()

ilForumPost::activateParentPosts ( )

Definition at line 252 of file class.ilForumPost.php.

References $query.

Referenced by activatePost(), and activatePostAndChildPosts().

252  : bool
253  {
254  if ($this->id) {
255  $query = "SELECT pos_pk FROM frm_posts "
256  . "INNER JOIN frm_posts_tree ON pos_fk = pos_pk "
257  . "WHERE lft < %s AND rgt > %s AND thr_fk = %s";
258  $result = $this->db->queryF(
259  $query,
260  ['integer', 'integer', 'integer'],
261  [$this->lft, $this->rgt, $this->thread_id]
262  );
263 
264  $now = date('Y-m-d H:i:s');
265  while ($row = $this->db->fetchAssoc($result)) {
266  $this->db->update(
267  'frm_posts',
268  [
269  'pos_status' => ['integer', 1],
270  'pos_activation_date' => ['timestamp', $now]
271  ],
272  ['pos_pk' => ['integer', $row['pos_pk']]]
273  );
274  }
275 
276  return true;
277  }
278 
279  return false;
280  }
$query
+ Here is the caller graph for this function:

◆ activatePost()

ilForumPost::activatePost ( )

Definition at line 199 of file class.ilForumPost.php.

References activateParentPosts(), setPostActivationDate(), and setStatus().

199  : void
200  {
201  if ($this->id) {
202  $now = date('Y-m-d H:i:s');
203  $this->db->update(
204  'frm_posts',
205  [
206  'pos_status' => ['integer', 1],
207  'pos_activation_date' => ['timestamp', $now]
208  ],
209  ['pos_pk' => ['integer', $this->id]]
210  );
211 
212  $this->activateParentPosts();
213  $this->setPostActivationDate($now);
214  $this->setStatus(true);
215  }
216  }
setStatus(bool $a_status)
setPostActivationDate(?string $post_activation_date)
+ Here is the call graph for this function:

◆ activatePostAndChildPosts()

ilForumPost::activatePostAndChildPosts ( )

Definition at line 218 of file class.ilForumPost.php.

References $query, and activateParentPosts().

218  : bool
219  {
220  if ($this->id) {
221  $query = "SELECT pos_pk FROM frm_posts_tree treea "
222  . "INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk "
223  . "AND treeb.lft BETWEEN treea.lft AND treea.rgt "
224  . "INNER JOIN frm_posts ON pos_pk = treeb.pos_fk "
225  . "WHERE treea.pos_fk = %s";
226  $result = $this->db->queryF(
227  $query,
228  ['integer'],
229  [$this->id]
230  );
231 
232  $now = date('Y-m-d H:i:s');
233  while ($row = $this->db->fetchAssoc($result)) {
234  $this->db->update(
235  'frm_posts',
236  [
237  'pos_status' => ['integer', 1],
238  'pos_activation_date' => ['timestamp', $now]
239  ],
240  ['pos_pk' => ['integer', $row['pos_pk']]]
241  );
242  }
243 
244  $this->activateParentPosts();
245 
246  return true;
247  }
248 
249  return false;
250  }
$query
+ Here is the call graph for this function:

◆ assignData()

ilForumPost::assignData ( array  $row)

Definition at line 586 of file class.ilForumPost.php.

References setCensoredDate(), setCensorship(), setCensorshipComment(), setChangeDate(), setCreateDate(), setDepth(), setDisplayUserId(), setForumId(), setImportName(), setIsAuthorModerator(), setIsRead(), setLft(), setMessage(), setNotification(), setParentId(), setPosAuthorId(), setRgt(), setStatus(), setSubject(), setThreadId(), setTreeId(), setUpdateUserId(), and setUserAlias().

586  : void
587  {
588  $this->setUserAlias((string) $row['pos_usr_alias']);
589  $this->setSubject((string) $row['pos_subject']);
590  $this->setCreateDate($row['pos_date']);
591  $this->setMessage((string) $row['pos_message']);
592  $this->setForumId((int) $row['pos_top_fk']);
593  $this->setThreadId((int) $row['pos_thr_fk']);
594  $this->setChangeDate($row['pos_update']);
595  $this->setUpdateUserId((int) $row['update_user']);
596  $this->setCensorship((bool) $row['pos_cens']);
597  $this->setCensoredDate($row['pos_cens_date'] ?? null);
598  $this->setCensorshipComment($row['pos_cens_com']);
599  $this->setNotification((bool) $row['notify']);
600  $this->setImportName($row['import_name']);
601  $this->setStatus((bool) $row['pos_status']);
602  $this->setTreeId((int) $row['fpt_pk']);
603  $this->setParentId((int) $row['parent_pos']);
604  $this->setLft((int) $row['lft']);
605  $this->setRgt((int) $row['rgt']);
606  $this->setDepth((int) $row['depth']);
607  $this->setIsRead(isset($row['post_read']) && (int) $row['post_read']);
608  $this->setDisplayUserId((int) $row['pos_display_user_id']);
609  $this->setPosAuthorId((int) $row['pos_author_id']);
610  $this->setIsAuthorModerator((bool) $row['is_author_moderator']);
611  }
setRgt(int $a_rgt)
setTreeId(int $a_tree_id)
setIsAuthorModerator(?bool $is_author_moderator)
setLft(int $a_lft)
setCensoredDate(?string $censored_date)
setMessage(string $a_message)
setImportName(?string $a_import_name)
setCensorshipComment(?string $a_comment)
setIsRead(bool $a_is_read)
setDepth(int $a_depth)
setStatus(bool $a_status)
setForumId(int $a_forum_id)
setPosAuthorId(int $pos_author_id)
setParentId(int $a_parent_id)
setCensorship(bool $a_censorship)
setChangeDate(?string $a_changedate)
setDisplayUserId(int $a_user_id)
setSubject(string $a_subject)
setNotification(bool $a_notification)
setUpdateUserId(int $a_user_id_update)
setUserAlias(?string $a_user_alias)
setThreadId(int $a_thread_id)
setCreateDate(?string $a_createdate)
+ Here is the call graph for this function:

◆ getCensoredDate()

ilForumPost::getCensoredDate ( )

Definition at line 566 of file class.ilForumPost.php.

References $censored_date.

566  : ?string
567  {
568  return $this->censored_date;
569  }

◆ getCensorshipComment()

ilForumPost::getCensorshipComment ( )

Definition at line 441 of file class.ilForumPost.php.

References $censorship_comment.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

441  : ?string
442  {
444  }
string $censorship_comment
+ Here is the caller graph for this function:

◆ getChangeDate()

ilForumPost::getChangeDate ( )

Definition at line 411 of file class.ilForumPost.php.

References $changedate.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

411  : ?string
412  {
413  return $this->changedate;
414  }
+ Here is the caller graph for this function:

◆ getCreateDate()

ilForumPost::getCreateDate ( )

Definition at line 401 of file class.ilForumPost.php.

References $createdate.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

401  : ?string
402  {
403  return $this->createdate;
404  }
+ Here is the caller graph for this function:

◆ getDepth()

ilForumPost::getDepth ( )

Definition at line 531 of file class.ilForumPost.php.

References $depth.

Referenced by ilObjForumGUI\renderDraftContent(), and ilObjForumGUI\renderPostContent().

531  : int
532  {
533  return $this->depth;
534  }
+ Here is the caller graph for this function:

◆ getDisplayUserId()

ilForumPost::getDisplayUserId ( )

Definition at line 361 of file class.ilForumPost.php.

References $display_user_id.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

361  : int
362  {
363  return $this->display_user_id;
364  }
+ Here is the caller graph for this function:

◆ getForumId()

ilForumPost::getForumId ( )

Definition at line 341 of file class.ilForumPost.php.

References $forum_id.

Referenced by ilObjForumGUI\renderSplitButton().

341  : int
342  {
343  return $this->forum_id;
344  }
+ Here is the caller graph for this function:

◆ getId()

ilForumPost::getId ( )

Definition at line 331 of file class.ilForumPost.php.

References $id.

Referenced by ilObjForumGUI\ensureValidPageForCurrentPosting(), ilObjForumGUI\renderDraftContent(), ilObjForumGUI\renderPostContent(), ilObjForumGUI\renderSplitButton(), and ilObjForumGUI\viewThreadObject().

331  : int
332  {
333  return $this->id;
334  }
+ Here is the caller graph for this function:

◆ getImportName()

ilForumPost::getImportName ( )

Definition at line 461 of file class.ilForumPost.php.

References $import_name.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

461  : ?string
462  {
463  return $this->import_name;
464  }
+ Here is the caller graph for this function:

◆ getIsRead()

ilForumPost::getIsRead ( )

Definition at line 496 of file class.ilForumPost.php.

References $post_read.

Referenced by isPostRead().

496  : bool
497  {
498  return $this->post_read;
499  }
+ Here is the caller graph for this function:

◆ getLft()

ilForumPost::getLft ( )

Definition at line 511 of file class.ilForumPost.php.

References $lft.

Referenced by ilForumTopic\getPostTree().

511  : int
512  {
513  return $this->lft;
514  }
+ Here is the caller graph for this function:

◆ getMessage()

ilForumPost::getMessage ( )

Definition at line 391 of file class.ilForumPost.php.

References $message.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

391  : string
392  {
393  return $this->message;
394  }
+ Here is the caller graph for this function:

◆ getParentId()

ilForumPost::getParentId ( )

Definition at line 501 of file class.ilForumPost.php.

References $parent_id.

501  : int
502  {
503  return $this->parent_id;
504  }

◆ getPosAuthorId()

ilForumPost::getPosAuthorId ( )

Definition at line 551 of file class.ilForumPost.php.

References $pos_author_id.

Referenced by ilObjForumGUI\doHistoryCheck(), ilForumNotificationDataProvider\getThreadNotificationRecipients(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

551  : int
552  {
553  return $this->pos_author_id;
554  }
+ Here is the caller graph for this function:

◆ getPostActivationDate()

ilForumPost::getPostActivationDate ( )

Definition at line 571 of file class.ilForumPost.php.

References $post_activation_date.

571  : ?string
572  {
574  }
string $post_activation_date

◆ getRgt()

ilForumPost::getRgt ( )

Definition at line 521 of file class.ilForumPost.php.

References $rgt.

Referenced by ilForumTopic\getPostTree().

521  : int
522  {
523  return $this->rgt;
524  }
+ Here is the caller graph for this function:

◆ getSubject()

ilForumPost::getSubject ( )

Definition at line 381 of file class.ilForumPost.php.

References $subject.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

381  : string
382  {
383  return $this->subject;
384  }
+ Here is the caller graph for this function:

◆ getThread()

ilForumPost::getThread ( )

Definition at line 541 of file class.ilForumPost.php.

References $objThread.

541  : ?ilForumTopic
542  {
543  return $this->objThread;
544  }
ilForumTopic $objThread

◆ getThreadId()

ilForumPost::getThreadId ( )

Definition at line 351 of file class.ilForumPost.php.

References $thread_id.

Referenced by ilForumTopic\getPostTree(), ilObjForumGUI\renderDraftContent(), ilObjForumGUI\renderPostContent(), and ilObjForumGUI\renderSplitButton().

351  : int
352  {
353  return $this->thread_id;
354  }
+ Here is the caller graph for this function:

◆ getTreeId()

ilForumPost::getTreeId ( )

Definition at line 481 of file class.ilForumPost.php.

References $tree_id.

481  : int
482  {
483  return $this->tree_id;
484  }

◆ getUpdateUserId()

ilForumPost::getUpdateUserId ( )

Definition at line 421 of file class.ilForumPost.php.

References $user_id_update.

Referenced by ilObjForumGUI\renderDraftContent(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

421  : int
422  {
423  return $this->user_id_update;
424  }
+ Here is the caller graph for this function:

◆ getUserAlias()

ilForumPost::getUserAlias ( )

Definition at line 371 of file class.ilForumPost.php.

References $user_alias.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

371  : ?string
372  {
373  return $this->user_alias;
374  }
+ Here is the caller graph for this function:

◆ hasReplies()

ilForumPost::hasReplies ( )

Definition at line 302 of file class.ilForumPost.php.

References $res.

Referenced by ilObjForumGUI\renderSplitButton().

302  : bool
303  {
304  if ($this->id && $this->rgt && $this->lft) {
305  $res = $this->db->queryF(
306  'SELECT * FROM frm_posts_tree WHERE lft > %s AND rgt < %s AND thr_fk = %s',
307  ['integer', 'integer', 'integer'],
308  [$this->lft, $this->rgt, $this->thread_id]
309  );
310 
311  return $res->numRows() > 0;
312  }
313 
314  return false;
315  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ insert()

ilForumPost::insert ( )

Definition at line 68 of file class.ilForumPost.php.

References ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

68  : void
69  {
70  if ($this->forum_id && $this->thread_id) {
71  $this->id = $this->db->nextId('frm_posts');
72 
73  $this->db->insert('frm_posts', [
74  'pos_pk' => ['integer', $this->id],
75  'pos_top_fk' => ['integer', $this->forum_id],
76  'pos_thr_fk' => ['integer', $this->thread_id],
77  'pos_display_user_id' => ['integer', $this->display_user_id],
78  'pos_usr_alias' => ['text', $this->user_alias],
79  'pos_subject' => ['text', $this->subject],
80  'pos_message' => ['clob', $this->message],
81  'pos_date' => ['timestamp', $this->createdate],
82  'pos_update' => ['timestamp', $this->createdate],
83  'update_user' => ['integer', $this->user_id_update],
84  'pos_cens' => ['integer', (int) $this->censored],
85  'notify' => ['integer', (int) $this->notification],
86  'import_name' => ['text', $this->import_name],
87  'pos_status' => ['integer', (int) $this->status],
88  'pos_author_id' => ['integer', $this->pos_author_id],
89  'is_author_moderator' => ['integer', $this->is_author_moderator],
90  'pos_activation_date' => ['timestamp', $this->createdate]
91  ]);
92  }
93  }
+ Here is the call graph for this function:

◆ isActivated()

ilForumPost::isActivated ( )

Definition at line 471 of file class.ilForumPost.php.

References $status.

Referenced by ilObjForumGUI\renderPostContent(), ilForumExportGUI\renderPostHtml(), and ilObjForumGUI\renderSplitButton().

471  : bool
472  {
473  return $this->status;
474  }
+ Here is the caller graph for this function:

◆ isAnyParentDeactivated()

ilForumPost::isAnyParentDeactivated ( )

Definition at line 174 of file class.ilForumPost.php.

References $res.

174  : bool
175  {
176  if ($this->id) {
177  $res = $this->db->queryF(
178  '
179  SELECT * FROM frm_posts_tree
180  INNER JOIN frm_posts ON pos_pk = pos_fk
181  WHERE pos_status = %s
182  AND lft < %s AND rgt > %s
183  AND thr_fk = %s',
184  ['integer', 'integer', 'integer', 'integer'],
185  [0, $this->lft, $this->rgt, $this->thread_id]
186  );
187 
188  return $res->numRows() > 0;
189  }
190 
191  return false;
192  }
$res
Definition: ltiservices.php:69

◆ isAuthorModerator()

ilForumPost::isAuthorModerator ( )

Definition at line 556 of file class.ilForumPost.php.

References $is_author_moderator.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

556  : ?bool
557  {
559  }
+ Here is the caller graph for this function:

◆ isCensored()

ilForumPost::isCensored ( )

Definition at line 431 of file class.ilForumPost.php.

References $censored.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderDraftContent(), ilObjForumGUI\renderPostContent(), ilForumExportGUI\renderPostHtml(), and ilObjForumGUI\renderSplitButton().

431  : bool
432  {
433  return $this->censored;
434  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilForumPost::isNotificationEnabled ( )

Definition at line 451 of file class.ilForumPost.php.

References $notification.

451  : bool
452  {
453  return $this->notification;
454  }

◆ isOwner()

ilForumPost::isOwner ( int  $a_user_id = 0)

Definition at line 317 of file class.ilForumPost.php.

Referenced by ilObjForumGUI\doHistoryCheck(), ilObjForumGUI\renderPostContent(), ilForumExportGUI\renderPostHtml(), and ilObjForumGUI\renderSplitButton().

317  : bool
318  {
319  if ($this->pos_author_id && $a_user_id) {
320  return $this->pos_author_id === $a_user_id;
321  }
322 
323  return false;
324  }
+ Here is the caller graph for this function:

◆ isPostRead()

ilForumPost::isPostRead ( )

Definition at line 282 of file class.ilForumPost.php.

References getIsRead().

Referenced by ilObjForumGUI\renderPostContent(), and ilObjForumGUI\renderSplitButton().

282  : bool
283  {
284  return $this->getIsRead();
285  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRead()

ilForumPost::isRead ( int  $a_user_id = 0)

Definition at line 287 of file class.ilForumPost.php.

References $res.

287  : bool
288  {
289  if ($a_user_id && $this->id) {
290  $res = $this->db->queryF(
291  'SELECT * FROM frm_user_read WHERE usr_id = %s AND post_id = %s',
292  ['integer', 'integer'],
293  [$a_user_id, $this->id]
294  );
295 
296  return $res->numRows() > 0;
297  }
298 
299  return false;
300  }
$res
Definition: ltiservices.php:69

◆ lookupNotificationStatusByPostId()

static ilForumPost::lookupNotificationStatusByPostId ( int  $post_id)
static

Definition at line 635 of file class.ilForumPost.php.

References $DIC, and $res.

635  : bool
636  {
637  global $DIC;
638 
639  $res = $DIC->database()->queryF(
640  'SELECT notify FROM frm_posts WHERE pos_pk = %s',
641  ['integer'],
642  [$post_id]
643  );
644 
645  $row = $DIC->database()->fetchAssoc($res);
646  return (bool) $row['notify'];
647  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28

◆ lookupPostMessage()

static ilForumPost::lookupPostMessage ( int  $post_id)
static

Definition at line 649 of file class.ilForumPost.php.

References $DIC, $ilDB, and $res.

649  : string
650  {
651  global $DIC;
652  $ilDB = $DIC->database();
653 
654  $res = $ilDB->queryF(
655  'SELECT pos_message FROM frm_posts WHERE pos_pk = %s',
656  ['integer'],
657  [$post_id]
658  );
659 
660  if ($row = $ilDB->fetchObject($res)) {
661  return $row->pos_message ?: '';
662  }
663 
664  return '';
665  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28

◆ mergePosts()

static ilForumPost::mergePosts ( int  $sourceThreadId,
int  $targetThreadId,
array  $excludedPostIds = [] 
)
static
Parameters
int$sourceThreadId
int$targetThreadId
int[]$excludedPostIds

Definition at line 618 of file class.ilForumPost.php.

References $DIC, and $ilDB.

Referenced by ilForum\mergeThreads().

618  : void
619  {
620  global $DIC;
621  $ilDB = $DIC->database();
622 
623  $conditions = ['pos_thr_fk = ' . $ilDB->quote($sourceThreadId, 'integer')];
624  if ($excludedPostIds !== []) {
625  $conditions[] = $ilDB->in('pos_pk', $excludedPostIds, true, 'integer');
626  }
627 
628  $ilDB->manipulateF(
629  'UPDATE frm_posts SET pos_thr_fk = %s WHERE ' . implode(' AND ', $conditions),
630  ['integer',],
631  [$targetThreadId,]
632  );
633  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ read()

ilForumPost::read ( )
private

Definition at line 130 of file class.ilForumPost.php.

References $res, ILIAS\Repository\int(), and ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

Referenced by __construct(), and reload().

130  : void
131  {
132  if ($this->id) {
133  $res = $this->db->queryF(
134  '
135  SELECT * FROM frm_posts
136  INNER JOIN frm_posts_tree ON pos_fk = pos_pk
137  WHERE pos_pk = %s',
138  ['integer'],
139  [$this->id]
140  );
141  $row = $this->db->fetchObject($res);
142 
143  if (is_object($row)) {
144  $this->id = (int) $row->pos_pk;
145  $this->forum_id = (int) $row->pos_top_fk;
146  $this->thread_id = (int) $row->pos_thr_fk;
147  $this->display_user_id = (int) $row->pos_display_user_id;
148  $this->user_alias = $row->pos_usr_alias;
149  $this->subject = (string) $row->pos_subject;
150  $this->message = (string) $row->pos_message;
151  $this->createdate = $row->pos_date;
152  $this->changedate = $row->pos_update;
153  $this->user_id_update = (int) $row->update_user;
154  $this->censored = (bool) $row->pos_cens;
155  $this->censored_date = $row->pos_cens_date;
156  $this->censorship_comment = $row->pos_cens_com;
157  $this->notification = (bool) $row->notify;
158  $this->import_name = $row->import_name;
159  $this->status = (bool) $row->pos_status;
160  $this->tree_id = (int) $row->fpt_pk;
161  $this->parent_id = (int) $row->parent_pos;
162  $this->lft = (int) $row->lft;
163  $this->rgt = (int) $row->rgt;
164  $this->depth = (int) $row->depth;
165  $this->pos_author_id = (int) $row->pos_author_id;
166  $this->is_author_moderator = (bool) $row->is_author_moderator;
167  $this->post_activation_date = $row->pos_activation_date;
168 
169  $this->objThread = new ilForumTopic($this->thread_id, $this->is_moderator);
170  }
171  }
172  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reload()

ilForumPost::reload ( )

Definition at line 194 of file class.ilForumPost.php.

References read().

194  : void
195  {
196  $this->read();
197  }
+ Here is the call graph for this function:

◆ setCensoredDate()

ilForumPost::setCensoredDate ( ?string  $censored_date)

Definition at line 581 of file class.ilForumPost.php.

References $censored_date.

Referenced by assignData().

581  : void
582  {
583  $this->censored_date = $censored_date;
584  }
+ Here is the caller graph for this function:

◆ setCensorship()

ilForumPost::setCensorship ( bool  $a_censorship)

Definition at line 426 of file class.ilForumPost.php.

Referenced by assignData().

426  : void
427  {
428  $this->censored = $a_censorship;
429  }
+ Here is the caller graph for this function:

◆ setCensorshipComment()

ilForumPost::setCensorshipComment ( ?string  $a_comment)

Definition at line 436 of file class.ilForumPost.php.

Referenced by assignData().

436  : void
437  {
438  $this->censorship_comment = $a_comment;
439  }
+ Here is the caller graph for this function:

◆ setChangeDate()

ilForumPost::setChangeDate ( ?string  $a_changedate)

Definition at line 406 of file class.ilForumPost.php.

Referenced by assignData(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

406  : void
407  {
408  $this->changedate = $a_changedate;
409  }
+ Here is the caller graph for this function:

◆ setCreateDate()

ilForumPost::setCreateDate ( ?string  $a_createdate)

Definition at line 396 of file class.ilForumPost.php.

Referenced by assignData().

396  : void
397  {
398  $this->createdate = $a_createdate;
399  }
+ Here is the caller graph for this function:

◆ setDepth()

ilForumPost::setDepth ( int  $a_depth)

Definition at line 526 of file class.ilForumPost.php.

Referenced by assignData().

526  : void
527  {
528  $this->depth = $a_depth;
529  }
+ Here is the caller graph for this function:

◆ setDisplayUserId()

ilForumPost::setDisplayUserId ( int  $a_user_id)

Definition at line 356 of file class.ilForumPost.php.

Referenced by assignData().

356  : void
357  {
358  $this->display_user_id = $a_user_id;
359  }
+ Here is the caller graph for this function:

◆ setForumId()

ilForumPost::setForumId ( int  $a_forum_id)

Definition at line 336 of file class.ilForumPost.php.

Referenced by assignData().

336  : void
337  {
338  $this->forum_id = $a_forum_id;
339  }
+ Here is the caller graph for this function:

◆ setId()

ilForumPost::setId ( int  $a_id)

Definition at line 326 of file class.ilForumPost.php.

326  : void
327  {
328  $this->id = $a_id;
329  }

◆ setImportName()

ilForumPost::setImportName ( ?string  $a_import_name)

Definition at line 456 of file class.ilForumPost.php.

Referenced by assignData().

456  : void
457  {
458  $this->import_name = $a_import_name;
459  }
+ Here is the caller graph for this function:

◆ setIsAuthorModerator()

ilForumPost::setIsAuthorModerator ( ?bool  $is_author_moderator)

Definition at line 561 of file class.ilForumPost.php.

References $is_author_moderator.

Referenced by assignData().

561  : void
562  {
563  $this->is_author_moderator = $is_author_moderator;
564  }
+ Here is the caller graph for this function:

◆ setIsRead()

ilForumPost::setIsRead ( bool  $a_is_read)

Definition at line 491 of file class.ilForumPost.php.

Referenced by assignData().

491  : void
492  {
493  $this->post_read = $a_is_read;
494  }
+ Here is the caller graph for this function:

◆ setLft()

ilForumPost::setLft ( int  $a_lft)

Definition at line 506 of file class.ilForumPost.php.

Referenced by assignData().

506  : void
507  {
508  $this->lft = $a_lft;
509  }
+ Here is the caller graph for this function:

◆ setMessage()

ilForumPost::setMessage ( string  $a_message)

Definition at line 386 of file class.ilForumPost.php.

Referenced by assignData(), ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

386  : void
387  {
388  $this->message = $a_message;
389  }
+ Here is the caller graph for this function:

◆ setNotification()

ilForumPost::setNotification ( bool  $a_notification)

Definition at line 446 of file class.ilForumPost.php.

References ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

Referenced by assignData().

446  : void
447  {
448  $this->notification = $a_notification;
449  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParentId()

ilForumPost::setParentId ( int  $a_parent_id)

Definition at line 486 of file class.ilForumPost.php.

Referenced by assignData().

486  : void
487  {
488  $this->parent_id = $a_parent_id;
489  }
+ Here is the caller graph for this function:

◆ setPosAuthorId()

ilForumPost::setPosAuthorId ( int  $pos_author_id)

Definition at line 546 of file class.ilForumPost.php.

References $pos_author_id.

Referenced by assignData().

546  : void
547  {
548  $this->pos_author_id = $pos_author_id;
549  }
+ Here is the caller graph for this function:

◆ setPostActivationDate()

ilForumPost::setPostActivationDate ( ?string  $post_activation_date)

Definition at line 576 of file class.ilForumPost.php.

References $post_activation_date.

Referenced by activatePost().

576  : void
577  {
578  $this->post_activation_date = $post_activation_date;
579  }
string $post_activation_date
+ Here is the caller graph for this function:

◆ setRgt()

ilForumPost::setRgt ( int  $a_rgt)

Definition at line 516 of file class.ilForumPost.php.

Referenced by assignData().

516  : void
517  {
518  $this->rgt = $a_rgt;
519  }
+ Here is the caller graph for this function:

◆ setStatus()

ilForumPost::setStatus ( bool  $a_status)

Definition at line 466 of file class.ilForumPost.php.

Referenced by activatePost(), and assignData().

466  : void
467  {
468  $this->status = $a_status;
469  }
+ Here is the caller graph for this function:

◆ setSubject()

ilForumPost::setSubject ( string  $a_subject)

Definition at line 376 of file class.ilForumPost.php.

Referenced by assignData().

376  : void
377  {
378  $this->subject = $a_subject;
379  }
+ Here is the caller graph for this function:

◆ setThread()

ilForumPost::setThread ( ilForumTopic  $thread)

Definition at line 536 of file class.ilForumPost.php.

536  : void
537  {
538  $this->objThread = $thread;
539  }

◆ setThreadId()

ilForumPost::setThreadId ( int  $a_thread_id)

Definition at line 346 of file class.ilForumPost.php.

Referenced by assignData().

346  : void
347  {
348  $this->thread_id = $a_thread_id;
349  }
+ Here is the caller graph for this function:

◆ setTreeId()

ilForumPost::setTreeId ( int  $a_tree_id)

Definition at line 476 of file class.ilForumPost.php.

Referenced by assignData().

476  : void
477  {
478  $this->tree_id = $a_tree_id;
479  }
+ Here is the caller graph for this function:

◆ setUpdateUserId()

ilForumPost::setUpdateUserId ( int  $a_user_id_update)

Definition at line 416 of file class.ilForumPost.php.

Referenced by assignData().

416  : void
417  {
418  $this->user_id_update = $a_user_id_update;
419  }
+ Here is the caller graph for this function:

◆ setUserAlias()

ilForumPost::setUserAlias ( ?string  $a_user_alias)

Definition at line 366 of file class.ilForumPost.php.

Referenced by assignData().

366  : void
367  {
368  $this->user_alias = $a_user_alias;
369  }
+ Here is the caller graph for this function:

◆ update()

ilForumPost::update ( )

Definition at line 95 of file class.ilForumPost.php.

References $id, and ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

95  : bool
96  {
97  if ($this->id) {
98  $this->db->update(
99  'frm_posts',
100  [
101  'pos_top_fk' => ['integer', $this->forum_id],
102  'pos_thr_fk' => ['integer', $this->thread_id],
103  'pos_subject' => ['text', $this->subject],
104  'pos_message' => ['clob', $this->message],
105  'pos_update' => ['timestamp', $this->changedate],
106  'update_user' => ['integer', $this->user_id_update],
107  'pos_cens' => ['integer', (int) $this->censored],
108  'pos_cens_date' => ['timestamp', $this->censored_date],
109  'pos_cens_com' => ['text', $this->censorship_comment],
110  'notify' => ['integer', (int) $this->notification],
111  'pos_status' => ['integer', (int) $this->status]
112  ],
113  [
114  'pos_pk' => ['integer', $this->id]
115  ]
116  );
117 
118  if ($this->objThread->getFirstVisiblePostId() === $this->id) {
119  $this->objThread->setSubject($this->subject);
120  $this->objThread->update();
121  $this->objThread->reload();
122  }
123 
124  return true;
125  }
126 
127  return false;
128  }
+ Here is the call graph for this function:

Field Documentation

◆ $censored

bool ilForumPost::$censored = false
private

Definition at line 37 of file class.ilForumPost.php.

Referenced by isCensored().

◆ $censored_date

string ilForumPost::$censored_date = null
private

Definition at line 39 of file class.ilForumPost.php.

Referenced by getCensoredDate(), and setCensoredDate().

◆ $censorship_comment

string ilForumPost::$censorship_comment = null
private

Definition at line 38 of file class.ilForumPost.php.

Referenced by getCensorshipComment().

◆ $changedate

string ilForumPost::$changedate = null
private

Definition at line 35 of file class.ilForumPost.php.

Referenced by getChangeDate().

◆ $createdate

string ilForumPost::$createdate = null
private

Definition at line 34 of file class.ilForumPost.php.

Referenced by getCreateDate().

◆ $db

ilDBInterface ilForumPost::$db
private

Definition at line 49 of file class.ilForumPost.php.

◆ $depth

int ilForumPost::$depth = 0
private

Definition at line 47 of file class.ilForumPost.php.

Referenced by getDepth().

◆ $display_user_id

int ilForumPost::$display_user_id = 0
private

Definition at line 30 of file class.ilForumPost.php.

Referenced by getDisplayUserId().

◆ $forum_id

int ilForumPost::$forum_id = 0
private

Definition at line 28 of file class.ilForumPost.php.

Referenced by getForumId().

◆ $id

int ilForumPost::$id
private

Definition at line 27 of file class.ilForumPost.php.

Referenced by getId(), and update().

◆ $import_name

string ilForumPost::$import_name = null
private

Definition at line 41 of file class.ilForumPost.php.

Referenced by getImportName().

◆ $is_author_moderator

bool ilForumPost::$is_author_moderator = false
private

Definition at line 51 of file class.ilForumPost.php.

Referenced by isAuthorModerator(), and setIsAuthorModerator().

◆ $is_moderator

bool ilForumPost::$is_moderator = false
private

Definition at line 50 of file class.ilForumPost.php.

◆ $lft

int ilForumPost::$lft = 0
private

Definition at line 45 of file class.ilForumPost.php.

Referenced by getLft().

◆ $message

string ilForumPost::$message = ''
private

Definition at line 33 of file class.ilForumPost.php.

Referenced by getMessage().

◆ $notification

bool ilForumPost::$notification = false
private

Definition at line 40 of file class.ilForumPost.php.

Referenced by isNotificationEnabled().

◆ $objThread

ilForumTopic ilForumPost::$objThread = null
private

Definition at line 48 of file class.ilForumPost.php.

Referenced by getThread().

◆ $parent_id

int ilForumPost::$parent_id = 0
private

Definition at line 44 of file class.ilForumPost.php.

Referenced by getParentId().

◆ $pos_author_id

int ilForumPost::$pos_author_id = 0
private

Definition at line 53 of file class.ilForumPost.php.

Referenced by getPosAuthorId(), and setPosAuthorId().

◆ $post_activation_date

string ilForumPost::$post_activation_date = null
private

Definition at line 54 of file class.ilForumPost.php.

Referenced by getPostActivationDate(), and setPostActivationDate().

◆ $post_read

bool ilForumPost::$post_read = false
private

Definition at line 52 of file class.ilForumPost.php.

Referenced by getIsRead().

◆ $rgt

int ilForumPost::$rgt = 0
private

Definition at line 46 of file class.ilForumPost.php.

Referenced by getRgt().

◆ $status

bool ilForumPost::$status = true
private

Definition at line 42 of file class.ilForumPost.php.

Referenced by isActivated().

◆ $subject

string ilForumPost::$subject = ''
private

Definition at line 32 of file class.ilForumPost.php.

Referenced by getSubject().

◆ $thread_id

int ilForumPost::$thread_id = 0
private

Definition at line 29 of file class.ilForumPost.php.

Referenced by getThreadId().

◆ $tree_id

int ilForumPost::$tree_id = 0
private

Definition at line 43 of file class.ilForumPost.php.

Referenced by getTreeId().

◆ $user_alias

string ilForumPost::$user_alias = null
private

Definition at line 31 of file class.ilForumPost.php.

Referenced by getUserAlias().

◆ $user_id_update

int ilForumPost::$user_id_update = 0
private

Definition at line 36 of file class.ilForumPost.php.

Referenced by getUpdateUserId().


The documentation for this class was generated from the following file: