ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilForumPost Class Reference
+ Collaboration diagram for ilForumPost:

Public Member Functions

 __construct (private int $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 ()
 
 getRCID ()
 
 setRCID (string $rcid)
 
 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)
 

Data Fields

const NO_RCID = '-'
 

Private Member Functions

 read ()
 

Private Attributes

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
 
readonly 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
 
string $rcid = self::NO_RCID
 

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 ( private int  $id = 0,
bool  $a_is_moderator = false,
bool  $preventImplicitRead = false 
)

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

References $DIC, and read().

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

Member Function Documentation

◆ activateParentPosts()

ilForumPost::activateParentPosts ( )

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

Referenced by activatePost(), and activatePostAndChildPosts().

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

◆ activatePost()

ilForumPost::activatePost ( )

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

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

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

◆ activatePostAndChildPosts()

ilForumPost::activatePostAndChildPosts ( )

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

References activateParentPosts().

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

◆ assignData()

ilForumPost::assignData ( array  $row)

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

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

597  : void
598  {
599  $this->setUserAlias((string) $row['pos_usr_alias']);
600  $this->setSubject((string) $row['pos_subject']);
601  $this->setCreateDate($row['pos_date']);
602  $this->setMessage((string) $row['pos_message']);
603  $this->setForumId((int) $row['pos_top_fk']);
604  $this->setThreadId((int) $row['pos_thr_fk']);
605  $this->setChangeDate($row['pos_update']);
606  $this->setUpdateUserId((int) $row['update_user']);
607  $this->setCensorship((bool) $row['pos_cens']);
608  $this->setCensoredDate($row['pos_cens_date'] ?? null);
609  $this->setCensorshipComment($row['pos_cens_com']);
610  $this->setNotification((bool) $row['notify']);
611  $this->setImportName($row['import_name']);
612  $this->setStatus((bool) $row['pos_status']);
613  $this->setTreeId((int) $row['fpt_pk']);
614  $this->setParentId((int) $row['parent_pos']);
615  $this->setLft((int) $row['lft']);
616  $this->setRgt((int) $row['rgt']);
617  $this->setDepth((int) $row['depth']);
618  $this->setIsRead(isset($row['post_read']) && (int) $row['post_read']);
619  $this->setDisplayUserId((int) $row['pos_display_user_id']);
620  $this->setPosAuthorId((int) $row['pos_author_id']);
621  $this->setIsAuthorModerator((bool) $row['is_author_moderator']);
622  $this->setRCID((string) ($row['rcid'] ?? self::NO_RCID));
623  }
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)
setRCID(string $rcid)
setDepth(int $a_depth)
setStatus(bool $a_status)
setForumId(int $a_forum_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 577 of file class.ilForumPost.php.

References $censored_date.

577  : ?string
578  {
579  return $this->censored_date;
580  }

◆ getCensorshipComment()

ilForumPost::getCensorshipComment ( )

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

References $censorship_comment.

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

452  : ?string
453  {
455  }
string $censorship_comment
+ Here is the caller graph for this function:

◆ getChangeDate()

ilForumPost::getChangeDate ( )

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

References $changedate.

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

422  : ?string
423  {
424  return $this->changedate;
425  }
+ Here is the caller graph for this function:

◆ getCreateDate()

ilForumPost::getCreateDate ( )

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

References $createdate.

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

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

◆ getDepth()

ilForumPost::getDepth ( )

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

References $depth.

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

542  : int
543  {
544  return $this->depth;
545  }
+ Here is the caller graph for this function:

◆ getDisplayUserId()

ilForumPost::getDisplayUserId ( )

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

References $display_user_id.

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

372  : int
373  {
374  return $this->display_user_id;
375  }
+ Here is the caller graph for this function:

◆ getForumId()

ilForumPost::getForumId ( )

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

References $forum_id.

Referenced by ilObjForumGUI\renderSplitButton().

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

◆ getId()

ilForumPost::getId ( )

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

References $id.

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

332  : int
333  {
334  return $this->id;
335  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ getImportName()

ilForumPost::getImportName ( )

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

References $import_name.

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

472  : ?string
473  {
474  return $this->import_name;
475  }
+ Here is the caller graph for this function:

◆ getIsRead()

ilForumPost::getIsRead ( )

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

References $post_read.

Referenced by isPostRead().

507  : bool
508  {
509  return $this->post_read;
510  }
+ Here is the caller graph for this function:

◆ getLft()

ilForumPost::getLft ( )

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

References $lft.

Referenced by ilForumTopic\getPostTree(), and ilForum\getSubPathIdsForNode().

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

◆ getMessage()

ilForumPost::getMessage ( )

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

References $message.

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

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

◆ getParentId()

ilForumPost::getParentId ( )

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

References $parent_id.

512  : int
513  {
514  return $this->parent_id;
515  }

◆ getPosAuthorId()

ilForumPost::getPosAuthorId ( )

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

References $pos_author_id.

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

562  : int
563  {
564  return $this->pos_author_id;
565  }
+ Here is the caller graph for this function:

◆ getPostActivationDate()

ilForumPost::getPostActivationDate ( )

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

References $post_activation_date.

582  : ?string
583  {
585  }
string $post_activation_date

◆ getRCID()

ilForumPost::getRCID ( )

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

References $rcid.

Referenced by ilFileDataForumRCImplementation\importFileToCollection().

357  : string
358  {
359  return $this->rcid;
360  }
+ Here is the caller graph for this function:

◆ getRgt()

ilForumPost::getRgt ( )

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

References $rgt.

Referenced by ilForumTopic\getPostTree(), and ilForum\getSubPathIdsForNode().

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

◆ getSubject()

ilForumPost::getSubject ( )

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

References $subject.

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

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

◆ getThread()

ilForumPost::getThread ( )

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

References $objThread.

552  : ?ilForumTopic
553  {
554  return $this->objThread;
555  }
ilForumTopic $objThread

◆ getThreadId()

ilForumPost::getThreadId ( )

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

References $thread_id.

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

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

◆ getTreeId()

ilForumPost::getTreeId ( )

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

References $tree_id.

Referenced by ilForum\getSubPathIdsForNode().

492  : int
493  {
494  return $this->tree_id;
495  }
+ Here is the caller graph for this function:

◆ getUpdateUserId()

ilForumPost::getUpdateUserId ( )

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

References $user_id_update.

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

432  : int
433  {
434  return $this->user_id_update;
435  }
+ Here is the caller graph for this function:

◆ getUserAlias()

ilForumPost::getUserAlias ( )

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

References $user_alias.

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

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

◆ hasReplies()

ilForumPost::hasReplies ( )

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

References $res.

Referenced by ilObjForumGUI\renderSplitButton().

303  : bool
304  {
305  if ($this->id && $this->rgt && $this->lft) {
306  $res = $this->db->queryF(
307  'SELECT * FROM frm_posts_tree WHERE lft > %s AND rgt < %s AND thr_fk = %s',
308  ['integer', 'integer', 'integer'],
309  [$this->lft, $this->rgt, $this->thread_id]
310  );
311 
312  return $res->numRows() > 0;
313  }
314 
315  return false;
316  }
$res
Definition: ltiservices.php:66
+ 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  }
notification()
description: > Example for rendring a notification glyph.
+ Here is the call graph for this function:

◆ isActivated()

ilForumPost::isActivated ( )

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

References $status.

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

482  : bool
483  {
484  return $this->status;
485  }
+ Here is the caller graph for this function:

◆ isAnyParentDeactivated()

ilForumPost::isAnyParentDeactivated ( )

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

References $res.

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

◆ isAuthorModerator()

ilForumPost::isAuthorModerator ( )

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

References $is_author_moderator.

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

567  : ?bool
568  {
570  }
+ Here is the caller graph for this function:

◆ isCensored()

ilForumPost::isCensored ( )

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

References $censored.

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

442  : bool
443  {
444  return $this->censored;
445  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilForumPost::isNotificationEnabled ( )

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

References $notification.

462  : bool
463  {
464  return $this->notification;
465  }

◆ isOwner()

ilForumPost::isOwner ( int  $a_user_id = 0)

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

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

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

◆ isPostRead()

ilForumPost::isPostRead ( )

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

References getIsRead().

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

283  : bool
284  {
285  return $this->getIsRead();
286  }
+ 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 288 of file class.ilForumPost.php.

References $res.

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

◆ lookupNotificationStatusByPostId()

static ilForumPost::lookupNotificationStatusByPostId ( int  $post_id)
static

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

References $DIC, and $res.

645  : bool
646  {
647  global $DIC;
648 
649  $res = $DIC->database()->queryF(
650  'SELECT notify FROM frm_posts WHERE pos_pk = %s',
651  ['integer'],
652  [$post_id]
653  );
654 
655  $row = $DIC->database()->fetchAssoc($res);
656  return (bool) $row['notify'];
657  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22

◆ lookupPostMessage()

static ilForumPost::lookupPostMessage ( int  $post_id)
static

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

References $DIC, $ilDB, and $res.

659  : string
660  {
661  global $DIC;
662  $ilDB = $DIC->database();
663 
664  $res = $ilDB->queryF(
665  'SELECT pos_message FROM frm_posts WHERE pos_pk = %s',
666  ['integer'],
667  [$post_id]
668  );
669 
670  if ($row = $ilDB->fetchObject($res)) {
671  return $row->pos_message ?: '';
672  }
673 
674  return '';
675  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22

◆ mergePosts()

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

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

References $DIC, and $ilDB.

Referenced by ilForum\mergeThreads().

628  : void
629  {
630  global $DIC;
631  $ilDB = $DIC->database();
632 
633  $conditions = ['pos_thr_fk = ' . $ilDB->quote($sourceThreadId, 'integer')];
634  if ($excludedPostIds !== []) {
635  $conditions[] = $ilDB->in('pos_pk', $excludedPostIds, true, 'integer');
636  }
637 
638  $ilDB->manipulateF(
639  'UPDATE frm_posts SET pos_thr_fk = %s WHERE ' . implode(' AND ', $conditions),
640  ['integer',],
641  [$targetThreadId,]
642  );
643  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ read()

ilForumPost::read ( )
private

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

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

Referenced by __construct(), and reload().

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

◆ reload()

ilForumPost::reload ( )

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

References read().

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

◆ setCensoredDate()

ilForumPost::setCensoredDate ( ?string  $censored_date)

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

References $censored_date.

Referenced by assignData().

592  : void
593  {
594  $this->censored_date = $censored_date;
595  }
+ Here is the caller graph for this function:

◆ setCensorship()

ilForumPost::setCensorship ( bool  $a_censorship)

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

Referenced by assignData().

437  : void
438  {
439  $this->censored = $a_censorship;
440  }
+ Here is the caller graph for this function:

◆ setCensorshipComment()

ilForumPost::setCensorshipComment ( ?string  $a_comment)

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

Referenced by assignData().

447  : void
448  {
449  $this->censorship_comment = $a_comment;
450  }
+ Here is the caller graph for this function:

◆ setChangeDate()

ilForumPost::setChangeDate ( ?string  $a_changedate)

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

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

417  : void
418  {
419  $this->changedate = $a_changedate;
420  }
+ Here is the caller graph for this function:

◆ setCreateDate()

ilForumPost::setCreateDate ( ?string  $a_createdate)

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

Referenced by assignData().

407  : void
408  {
409  $this->createdate = $a_createdate;
410  }
+ Here is the caller graph for this function:

◆ setDepth()

ilForumPost::setDepth ( int  $a_depth)

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

Referenced by assignData().

537  : void
538  {
539  $this->depth = $a_depth;
540  }
+ Here is the caller graph for this function:

◆ setDisplayUserId()

ilForumPost::setDisplayUserId ( int  $a_user_id)

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

Referenced by assignData().

367  : void
368  {
369  $this->display_user_id = $a_user_id;
370  }
+ Here is the caller graph for this function:

◆ setForumId()

ilForumPost::setForumId ( int  $a_forum_id)

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

Referenced by assignData().

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

◆ setId()

ilForumPost::setId ( int  $a_id)

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

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

◆ setImportName()

ilForumPost::setImportName ( ?string  $a_import_name)

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

Referenced by assignData().

467  : void
468  {
469  $this->import_name = $a_import_name;
470  }
+ Here is the caller graph for this function:

◆ setIsAuthorModerator()

ilForumPost::setIsAuthorModerator ( ?bool  $is_author_moderator)

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

References $is_author_moderator.

Referenced by assignData().

572  : void
573  {
574  $this->is_author_moderator = $is_author_moderator;
575  }
+ Here is the caller graph for this function:

◆ setIsRead()

ilForumPost::setIsRead ( bool  $a_is_read)

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

Referenced by assignData().

502  : void
503  {
504  $this->post_read = $a_is_read;
505  }
+ Here is the caller graph for this function:

◆ setLft()

ilForumPost::setLft ( int  $a_lft)

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

Referenced by assignData().

517  : void
518  {
519  $this->lft = $a_lft;
520  }
+ Here is the caller graph for this function:

◆ setMessage()

ilForumPost::setMessage ( string  $a_message)

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

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

397  : void
398  {
399  $this->message = $a_message;
400  }
+ Here is the caller graph for this function:

◆ setNotification()

ilForumPost::setNotification ( bool  $a_notification)

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

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

Referenced by assignData().

457  : void
458  {
459  $this->notification = $a_notification;
460  }
notification()
description: > Example for rendring a notification glyph.
+ 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 497 of file class.ilForumPost.php.

Referenced by assignData().

497  : void
498  {
499  $this->parent_id = $a_parent_id;
500  }
+ Here is the caller graph for this function:

◆ setPosAuthorId()

ilForumPost::setPosAuthorId ( int  $pos_author_id)

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

References $pos_author_id.

Referenced by assignData().

557  : void
558  {
559  $this->pos_author_id = $pos_author_id;
560  }
+ Here is the caller graph for this function:

◆ setPostActivationDate()

ilForumPost::setPostActivationDate ( ?string  $post_activation_date)

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

References $post_activation_date.

Referenced by activatePost().

587  : void
588  {
589  $this->post_activation_date = $post_activation_date;
590  }
string $post_activation_date
+ Here is the caller graph for this function:

◆ setRCID()

ilForumPost::setRCID ( string  $rcid)

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

References $rcid.

Referenced by assignData(), and ilFileDataForumRCImplementation\importFileToCollection().

362  : void
363  {
364  $this->rcid = $rcid;
365  }
+ Here is the caller graph for this function:

◆ setRgt()

ilForumPost::setRgt ( int  $a_rgt)

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

Referenced by assignData().

527  : void
528  {
529  $this->rgt = $a_rgt;
530  }
+ Here is the caller graph for this function:

◆ setStatus()

ilForumPost::setStatus ( bool  $a_status)

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

Referenced by activatePost(), and assignData().

477  : void
478  {
479  $this->status = $a_status;
480  }
+ Here is the caller graph for this function:

◆ setSubject()

ilForumPost::setSubject ( string  $a_subject)

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

Referenced by assignData().

387  : void
388  {
389  $this->subject = $a_subject;
390  }
+ Here is the caller graph for this function:

◆ setThread()

ilForumPost::setThread ( ilForumTopic  $thread)

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

547  : void
548  {
549  $this->objThread = $thread;
550  }

◆ setThreadId()

ilForumPost::setThreadId ( int  $a_thread_id)

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

Referenced by assignData().

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

◆ setTreeId()

ilForumPost::setTreeId ( int  $a_tree_id)

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

Referenced by assignData().

487  : void
488  {
489  $this->tree_id = $a_tree_id;
490  }
+ Here is the caller graph for this function:

◆ setUpdateUserId()

ilForumPost::setUpdateUserId ( int  $a_user_id_update)

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

Referenced by assignData().

427  : void
428  {
429  $this->user_id_update = $a_user_id_update;
430  }
+ Here is the caller graph for this function:

◆ setUserAlias()

ilForumPost::setUserAlias ( ?string  $a_user_alias)

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

Referenced by assignData().

377  : void
378  {
379  $this->user_alias = $a_user_alias;
380  }
+ 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().

Referenced by ilFileDataForumRCImplementation\importFileToCollection().

95  : bool
96  {
97  if ($this->id !== 0) {
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  'rcid' => ['text', ($this->rcid ?? self::NO_RCID)]
113  ],
114  [
115  'pos_pk' => ['integer', $this->id]
116  ]
117  );
118 
119  if ($this->objThread->getFirstVisiblePostId() === $this->id) {
120  $this->objThread->setSubject($this->subject);
121  $this->objThread->update();
122  $this->objThread->reload();
123  }
124 
125  return true;
126  }
127 
128  return false;
129  }
notification()
description: > Example for rendring a notification glyph.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller 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

readonly 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().

◆ $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().

◆ $rcid

string ilForumPost::$rcid = self::NO_RCID
private

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

Referenced by getRCID(), and setRCID().

◆ $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().

◆ NO_RCID

const ilForumPost::NO_RCID = '-'

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