ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilForumPost Class Reference
+ Collaboration diagram for ilForumPost:

Public Member Functions

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

Static Public Member Functions

static mergePosts ($source_thread_id, $target_thread_id)
 

Protected Member Functions

 buildUserRelatedData ($row)
 

Private Member Functions

 read ()
 
 getUserData ()
 

Private Attributes

 $id = 0
 
 $forum_id = 0
 
 $thread_id = 0
 
 $display_user_id = 0
 
 $user_alias = ''
 
 $subject = ''
 
 $message = ''
 
 $createdate = '0000-00-00 00:00:00'
 
 $changedate = '0000-00-00 00:00:00'
 
 $user_id_update = 0
 
 $censored = 0
 
 $censorship_comment = ''
 
 $notification = 0
 
 $import_name = ''
 
 $status = 1
 
 $tree_id = 0
 
 $parent_id = 0
 
 $lft = 0
 
 $rgt = 0
 
 $depth = 0
 
 $fullname = ''
 
 $loginname = ''
 
 $objThread = null
 
 $db = null
 
 $is_moderator = false
 
 $is_author_moderator = null
 
 $post_read = false
 
 $pos_author_id = 0
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $ilDB, and read().

79  {
80  global $ilDB;
81 
82  $this->db = $ilDB;
83  $this->id = $a_id;
84 
85  if( !$preventImplicitRead )
86  {
87  $this->read();
88  }
89  }
global $ilDB
+ Here is the call graph for this function:

◆ __destruct()

ilForumPost::__destruct ( )

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

92  {
93  unset($this->db);
94  unset($this->objThread);
95  }

Member Function Documentation

◆ activateParentPosts()

ilForumPost::activateParentPosts ( )

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

References $query, $result, and $row.

Referenced by activatePost(), and activatePostAndChildPosts().

408  {
409  if ($this->id)
410  {
411  $query = "SELECT pos_pk FROM frm_posts "
412  . "INNER JOIN frm_posts_tree ON pos_fk = pos_pk "
413  . "WHERE lft < %s AND rgt > %s AND thr_fk = %s";
414  $result = $this->db->queryF(
415  $query,
416  array('integer', 'integer', 'integer'),
417  array($this->lft, $this->rgt, $this->thread_id)
418  );
419 
420  while($row = $this->db->fetchAssoc($result))
421  {
422  $this->db->update('frm_posts',
423  array('pos_status' => array('integer', 1)),
424  array('pos_pk' => array('integer', $row['pos_pk'])));
425  }
426 
427  return true;
428  }
429 
430  return false;
431  }
$result
+ Here is the caller graph for this function:

◆ activatePost()

ilForumPost::activatePost ( )

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

References activateParentPosts().

362  {
363  if ($this->id)
364  {
365  $this->db->update('frm_posts',
366  array('pos_status' => array('integer', 1)),
367  array('pos_pk' => array('integer', $this->id)));
368 
369  $this->activateParentPosts();
370 
371  return true;
372  }
373 
374  return false;
375  }
+ Here is the call graph for this function:

◆ activatePostAndChildPosts()

ilForumPost::activatePostAndChildPosts ( )

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

References $query, $result, $row, and activateParentPosts().

378  {
379  if ($this->id)
380  {
381  $query = "SELECT pos_pk FROM frm_posts_tree treea "
382  . "INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk "
383  . "AND treeb.lft BETWEEN treea.lft AND treea.rgt "
384  . "INNER JOIN frm_posts ON pos_pk = treeb.pos_fk "
385  . "WHERE treea.pos_fk = %s";
386  $result = $this->db->queryF(
387  $query,
388  array('integer'),
389  array($this->id)
390  );
391 
392  while($row = $this->db->fetchAssoc($result))
393  {
394  $this->db->update('frm_posts',
395  array('pos_status' => array('integer', 1)),
396  array('pos_pk' => array('integer', $row['pos_pk'])));
397  }
398 
399  $this->activateParentPosts();
400 
401  return true;
402  }
403 
404  return false;
405  }
$result
+ Here is the call graph for this function:

◆ assignData()

ilForumPost::assignData (   $row)

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

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

726  {
727  $this->setUserAlias($row['pos_usr_alias']);
728  $this->setSubject($row['pos_subject']);
729  $this->setCreateDate($row['pos_date']);
730  $this->setMessage($row['pos_message']);
731  $this->setForumId($row['pos_top_fk']);
732  $this->setThreadId($row['pos_thr_fk']);
733  $this->setChangeDate($row['pos_update']);
734  $this->setUpdateUserId($row['update_user']);
735  $this->setCensorship($row['pos_cens']);
736  $this->setCensorshipComment($row['pos_cens_com']);
737  $this->setNotification($row['notify']);
738  $this->setImportName($row['import_name']);
739  $this->setStatus($row['pos_status']);
740  $this->setTreeId($row['fpt_pk']);
741  $this->setParentId($row['parent_pos']);
742  $this->setLft($row['lft']);
743  $this->setRgt($row['rgt']);
744  $this->setDepth($row['depth']);
745  $this->setIsRead($row['post_read']);
746  $this->setDisplayUserId($row['pos_display_user_id']);
747  $this->setPosAuthorId($row['pos_author_id']);
748  $this->setIsAuthorModerator($row['is_author_moderator']);
749  $this->buildUserRelatedData($row);
750  }
setCreateDate($a_createdate)
setNotification($a_notification)
setTreeId($a_tree_id)
buildUserRelatedData($row)
setUserAlias($a_user_alias)
setDepth($a_depth)
setImportName($a_import_name)
setForumId($a_forum_id)
setIsAuthorModerator($is_author_moderator)
setThreadId($a_thread_id)
setCensorshipComment($a_comment)
setParentId($a_parent_id)
setDisplayUserId($a_user_id)
setStatus($a_status)
setCensorship($a_censorship)
setPosAuthorId($pos_author_id)
setMessage($a_message)
setSubject($a_subject)
setUpdateUserId($a_user_id_update)
setChangeDate($a_changedate)
setIsRead($a_is_read)
+ Here is the call graph for this function:

◆ buildUserRelatedData()

ilForumPost::buildUserRelatedData (   $row)
protected

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

References $lng, and $row.

Referenced by assignData().

296  {
297  global $lng;
298 
299  if ($row['pos_display_user_id'] && $row['pos_pk'])
300  {
301  require_once 'Services/User/classes/class.ilObjUser.php';
302  $tmp_user = new ilObjUser();
303  $tmp_user->setFirstname($row['firstname']);
304  $tmp_user->setLastname($row['lastname']);
305  $tmp_user->setUTitle($row['title']);
306  $tmp_user->setLogin($row['login']);
307 
308  $this->fullname = $tmp_user->getFullname();
309  $this->loginname = $tmp_user->getLogin();
310 
311  $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown'));
312 
313  return true;
314  }
315  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ deactivatePostAndChildPosts()

ilForumPost::deactivatePostAndChildPosts ( )

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

References $query, $result, and $row.

434  {
435  if ($this->id)
436  {
437  $query = "SELECT pos_pk FROM frm_posts_tree treea "
438  . "INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk "
439  . "AND treeb.lft BETWEEN treea.lft AND treea.rgt "
440  . "INNER JOIN frm_posts ON pos_pk = treeb.pos_fk "
441  . "WHERE treea.pos_fk = %s";
442  $result = $this->db->queryF(
443  $query,
444  array('integer'),
445  array($this->id)
446  );
447 
448  while($row = $this->db->fetchAssoc($result))
449  {
450  $this->db->update('frm_posts',
451  array('pos_status' => array('integer', 0)),
452  array('pos_pk' => array('integer', $row['pos_pk'])));
453  }
454 
455  return true;
456  }
457 
458  return false;
459  }
$result

◆ getCensorshipComment()

ilForumPost::getCensorshipComment ( )

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

References $censorship_comment.

Referenced by ilForumExportGUI\executeCommand().

607  {
609  }
+ Here is the caller graph for this function:

◆ getChangeDate()

ilForumPost::getChangeDate ( )

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

References $changedate.

Referenced by ilForumExportGUI\executeCommand().

583  {
584  return $this->changedate;
585  }
+ Here is the caller graph for this function:

◆ getCreateDate()

ilForumPost::getCreateDate ( )

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

References $createdate.

Referenced by ilForumExportGUI\executeCommand().

575  {
576  return $this->createdate;
577  }
+ Here is the caller graph for this function:

◆ getDataAsArray()

ilForumPost::getDataAsArray ( )

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

References $data.

168  {
169  $data = array(
170  'pos_pk' => $this->id,
171  'pos_top_fk' => $this->forum_id,
172  'pos_thr_fk' => $this->thread_id,
173  'pos_display_user_id' => $this->display_user_id,
174  'pos_usr_alias' => $this->user_alias,
175  'title' => $this->fullname,
176  'loginname' => $this->loginname,
177  'pos_message' => $this->message,
178  'pos_subject' => $this->subject,
179  'pos_cens_com' => $this->censorship_comment,
180  'pos_cens' => $this->censored,
181  'pos_date' => $this->createdate,
182  'pos_update' => $this->changedate,
183  'update_user' => $this->user_id_update,
184  'notify' => $this->notification,
185  'import_name' => $this->import_name,
186  'pos_status' => $this->status,
187  'pos_author_id' => $this->pos_author_id,
188  'is_author_moderator' => $this->is_author_moderator
189  );
190 
191  return $data;
192  }

◆ getDataAsArrayForExplorer()

ilForumPost::getDataAsArrayForExplorer ( )

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

References $data.

195  {
196  $data = array(
197  'pos_pk' => $this->id,
198  'child' => $this->id,
199  'author' => $this->display_user_id,
200  'alias' => $this->user_alias,
201  'title' => $this->fullname,
202  'loginname' => $this->loginname,
203  'type' => 'post',
204  'message' => $this->message,
205  'subject' => $this->subject,
206  'pos_cens_com' => $this->censorship_comment,
207  'pos_cens' => $this->censored,
208  'date' => $this->createdate,
209  'create_date' => $this->createdate,
210  'update' => $this->changedate,
211  'update_user' => $this->user_id_update,
212  'tree' => $this->thread_id,
213  'parent' => $this->parent_id,
214  'lft' => $this->lft,
215  'rgt' => $this->rgt,
216  'depth' => $this->depth,
217  'id' => $this->tree_id,
218  'notify' => $this->notification,
219  'import_name' => $this->import_name,
220  'pos_status' => $this->status,
221  'pos_author_id' => $this->pos_author_id,
222  'is_author_moderator' => $this->is_author_moderator
223  );
224 
225  return $data;
226  }

◆ getDepth()

ilForumPost::getDepth ( )

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

References $depth.

682  {
683  return $this->depth;
684  }

◆ getDisplayUserId()

ilForumPost::getDisplayUserId ( )

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

References $display_user_id.

Referenced by ilForumExportGUI\executeCommand().

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

◆ getForumId()

ilForumPost::getForumId ( )

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

References $forum_id.

527  {
528  return $this->forum_id;
529  }

◆ getFullname()

ilForumPost::getFullname ( )

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

References $fullname.

349  {
350  return $this->fullname;
351  }

◆ getId()

ilForumPost::getId ( )

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

References $id.

Referenced by ilForumExportGUI\executeCommand().

519  {
520  return $this->id;
521  }
+ Here is the caller graph for this function:

◆ getImportName()

ilForumPost::getImportName ( )

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

References $import_name.

Referenced by ilForumExportGUI\executeCommand().

623  {
624  return $this->import_name;
625  }
+ Here is the caller graph for this function:

◆ getIsAuthorModerator()

ilForumPost::getIsAuthorModerator ( )
Returns
int|null

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

References $is_author_moderator.

Referenced by ilForumExportGUI\executeCommand().

713  {
715  }
+ Here is the caller graph for this function:

◆ getIsRead()

ilForumPost::getIsRead ( )

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

References $post_read.

Referenced by isPostRead().

653  {
654  return $this->post_read;
655  }
+ Here is the caller graph for this function:

◆ getLft()

ilForumPost::getLft ( )

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

References $lft.

Referenced by ilForumTopic\getPostTree().

666  {
667  return $this->lft;
668  }
+ Here is the caller graph for this function:

◆ getLoginName()

ilForumPost::getLoginName ( )

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

References $loginname.

357  {
358  return $this->loginname;
359  }

◆ getMessage()

ilForumPost::getMessage ( )

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

References $message.

Referenced by ilForumExportGUI\executeCommand().

567  {
568  return $this->message;
569  }
+ Here is the caller graph for this function:

◆ getParentId()

ilForumPost::getParentId ( )

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

References $parent_id.

658  {
659  return $this->parent_id;
660  }

◆ getPosAuthorId()

ilForumPost::getPosAuthorId ( )
Returns
int

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

References $pos_author_id.

Referenced by ilForumExportGUI\executeCommand().

706  {
707  return $this->pos_author_id;
708  }
+ Here is the caller graph for this function:

◆ getRgt()

ilForumPost::getRgt ( )

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

References $rgt.

Referenced by ilForumTopic\getPostTree().

674  {
675  return $this->rgt;
676  }
+ Here is the caller graph for this function:

◆ getSubject()

ilForumPost::getSubject ( )

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

References $subject.

Referenced by ilForumExportGUI\executeCommand().

559  {
560  return $this->subject;
561  }
+ Here is the caller graph for this function:

◆ getThread()

ilForumPost::getThread ( )

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

References $objThread.

690  {
691  return $this->objThread;
692  }

◆ getThreadId()

ilForumPost::getThreadId ( )

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

References $thread_id.

Referenced by ilForumTopic\getPostTree().

535  {
536  return $this->thread_id;
537  }
+ Here is the caller graph for this function:

◆ getTreeId()

ilForumPost::getTreeId ( )

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

References $tree_id.

639  {
640  return $this->tree_id;
641  }

◆ getUpdateUserId()

ilForumPost::getUpdateUserId ( )

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

References $user_id_update.

Referenced by ilForumExportGUI\executeCommand().

591  {
592  return $this->user_id_update;
593  }
+ Here is the caller graph for this function:

◆ getUserAlias()

ilForumPost::getUserAlias ( )

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

References $user_alias.

Referenced by ilForumExportGUI\executeCommand().

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

◆ getUserData()

ilForumPost::getUserData ( )
private

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

References $lng, and ilObjForumAccess\getCachedUserInstance().

Referenced by read().

318  {
319  global $lng;
320 
321  if ($this->id && $this->display_user_id)
322  {
323  require_once("Modules/Forum/classes/class.ilObjForumAccess.php");
324  if(($tmp_user = ilObjForumAccess::getCachedUserInstance($this->display_user_id)))
325  {
326  $this->fullname = $tmp_user->getFullname();
327  $this->loginname = $tmp_user->getLogin();
328  unset($tmp_user);
329  }
330 
331  $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown'));
332 
333  return true;
334  }
335 
336  return false;
337  }
static getCachedUserInstance($usr_id)
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasReplies()

ilForumPost::hasReplies ( )

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

References $res.

485  {
486  if ($this->id && $this->rgt && $this->lft)
487  {
488  $res = $this->db->queryf('
489  SELECT * FROM frm_posts_tree
490  WHERE lft > %s AND rgt < %s
491  AND thr_fk = %s',
492  array('integer', 'integer', 'integer'),
493  array($this->lft, $this->rgt, $this->thread_id));
494 
495  return $res->numRows() ? true : false;
496  }
497 
498  return false;
499  }

◆ insert()

ilForumPost::insert ( )

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

References $ilDB.

98  {
99  global $ilDB;
100 
101  if ($this->forum_id && $this->thread_id)
102  {
103  $this->id = $this->db->nextId('frm_posts');
104 
105  $ilDB->insert('frm_posts', array(
106  'pos_pk' => array('integer', $this->id),
107  'pos_top_fk' => array('integer', $this->forum_id),
108  'pos_thr_fk' => array('integer', $this->thread_id),
109  'pos_display_user_id' => array('integer', $this->display_user_id),
110  'pos_usr_alias' => array('text', $this->user_alias),
111  'pos_subject' => array('text', $this->subject),
112  'pos_message' => array('clob', $this->message),
113  'pos_date' => array('timestamp', $this->createdate),
114  'pos_update' => array('timestamp', $this->createdate),
115  'update_user' => array('integer', $this->user_id_update),
116  'pos_cens' => array('integer', $this->censored),
117  'notify' => array('integer', (int)$this->notification),
118  'import_name' => array('text', (string)$this->import_name),
119  'pos_status' => array('integer', (int)$this->status),
120  'pos_author_id' => array('integer', (int)$this->pos_author_id),
121  'is_author_moderator' => array('integer', $this->is_author_moderator)
122  ));
123 
124  return true;
125  }
126 
127  return false;
128  }
global $ilDB

◆ isActivated()

ilForumPost::isActivated ( )

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

Referenced by ilForumExportGUI\executeCommand().

631  {
632  return $this->status == 1 ? true : false;
633  }
+ Here is the caller graph for this function:

◆ isAnyParentDeactivated()

ilForumPost::isAnyParentDeactivated ( )

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

References $res.

277  {
278  if ($this->id)
279  {
280  $res = $this->db->queryf('
281  SELECT * FROM frm_posts_tree
282  INNER JOIN frm_posts ON pos_pk = pos_fk
283  WHERE pos_status = %s
284  AND lft < %s AND rgt > %s
285  AND thr_fk = %s',
286  array('integer', 'integer', 'integer', 'integer'),
287  array('0', $this->lft, $this->rgt, $this->thread_id));
288 
289  return $res->numRows();
290  }
291 
292  return false;
293  }

◆ isCensored()

ilForumPost::isCensored ( )

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

Referenced by ilForumExportGUI\executeCommand().

599  {
600  return $this->censored == 1 ? true : false;
601  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilForumPost::isNotificationEnabled ( )

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

615  {
616  return $this->notification == 1 ? true : false;
617  }

◆ isOwner()

ilForumPost::isOwner (   $a_user_id = 0)

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

Referenced by ilForumExportGUI\executeCommand().

502  {
503  if ($this->pos_author_id && $a_user_id)
504  {
505  if ((int) $this->pos_author_id == (int) $a_user_id)
506  {
507  return true;
508  }
509  return false;
510  }
511  return false;
512  }
+ Here is the caller graph for this function:

◆ isPostRead()

ilForumPost::isPostRead ( )

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

References getIsRead().

462  {
463  return $this->getIsRead();
464  }
+ Here is the call graph for this function:

◆ isRead()

ilForumPost::isRead (   $a_user_id = 0)

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

References $res.

467  {
468  if ($a_user_id && $this->id)
469  {
470 
471  $res = $this->db->queryf('
472  SELECT * FROM frm_user_read
473  WHERE usr_id = %s
474  AND post_id = %s',
475  array('integer', 'integer'),
476  array($a_user_id, $this->id));
477 
478  return $res->numRows() ? true : false;
479  }
480 
481  return false;
482  }

◆ mergePosts()

static ilForumPost::mergePosts (   $source_thread_id,
  $target_thread_id 
)
static

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

References $ilDB.

Referenced by ilForum\mergeThreads().

753  {
754  global $ilDB;
755 
756  $ilDB->update('frm_posts',
757  array('pos_thr_fk' => array('integer', $target_thread_id)),
758  array('pos_thr_fk' => array('integer', $source_thread_id)));
759  }
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilForumPost::read ( )
private

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

References $res, $row, and getUserData().

Referenced by __construct(), and reload().

229  {
230  if ($this->id)
231  {
232  $res = $this->db->queryf('
233  SELECT * FROM frm_posts
234  INNER JOIN frm_posts_tree ON pos_fk = pos_pk
235  WHERE pos_pk = %s',
236  array('integer'), array($this->id));
237  $row = $this->db->fetchObject($res);
238 
239  if (is_object($row))
240  {
241  $this->id = $row->pos_pk;
242  $this->forum_id = $row->pos_top_fk;
243  $this->thread_id = $row->pos_thr_fk;
244  $this->display_user_id = $row->pos_display_user_id;
245  $this->user_alias = $row->pos_usr_alias;
246  $this->subject = $row->pos_subject;
247  $this->message = $row->pos_message;
248  $this->createdate = $row->pos_date;
249  $this->changedate = $row->pos_update;
250  $this->user_id_update = $row->update_user;
251  $this->censored = $row->pos_cens;
252  $this->censorship_comment = $row->pos_cens_com;
253  $this->notification = $row->notify;
254  $this->import_name = $row->import_name;
255  $this->status = $row->pos_status;
256  $this->tree_id = $row->fpt_pk;
257  $this->parent_id = $row->parent_pos;
258  $this->lft = $row->lft;
259  $this->rgt = $row->rgt;
260  $this->depth = $row->depth;
261  $this->pos_author_id = $row->pos_author_id;
262  $this->is_author_moderator = $row->is_author_moderator;
263  $this->getUserData();
264 
265  $this->objThread = new ilForumTopic($this->thread_id, $this->is_moderator);
266 
267  return true;
268  }
269 
270  return false;
271  }
272 
273  return false;
274  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reload()

ilForumPost::reload ( )

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

References read().

340  {
341  return $this->read();
342  }
+ Here is the call graph for this function:

◆ setCensorship()

ilForumPost::setCensorship (   $a_censorship)

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

Referenced by assignData().

595  {
596  $this->censored = $a_censorship;
597  }
+ Here is the caller graph for this function:

◆ setCensorshipComment()

ilForumPost::setCensorshipComment (   $a_comment)

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

Referenced by assignData().

603  {
604  $this->censorship_comment = $a_comment;
605  }
+ Here is the caller graph for this function:

◆ setChangeDate()

ilForumPost::setChangeDate (   $a_changedate)

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

Referenced by assignData(), and ilForumExportGUI\executeCommand().

579  {
580  $this->changedate = $a_changedate;
581  }
+ Here is the caller graph for this function:

◆ setCreateDate()

ilForumPost::setCreateDate (   $a_createdate)

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

Referenced by assignData().

571  {
572  $this->createdate = $a_createdate;
573  }
+ Here is the caller graph for this function:

◆ setDepth()

ilForumPost::setDepth (   $a_depth)

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

Referenced by assignData().

678  {
679  $this->depth = $a_depth;
680  }
+ Here is the caller graph for this function:

◆ setDisplayUserId()

ilForumPost::setDisplayUserId (   $a_user_id)

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

Referenced by assignData().

539  {
540  $this->display_user_id = $a_user_id;
541  }
+ Here is the caller graph for this function:

◆ setForumId()

ilForumPost::setForumId (   $a_forum_id)

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

Referenced by assignData().

523  {
524  $this->forum_id = $a_forum_id;
525  }
+ Here is the caller graph for this function:

◆ setFullname()

ilForumPost::setFullname (   $a_fullname)

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

345  {
346  $this->fullname = $a_fullname;
347  }

◆ setId()

ilForumPost::setId (   $a_id)

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

515  {
516  $this->id = $a_id;
517  }

◆ setImportName()

ilForumPost::setImportName (   $a_import_name)

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

Referenced by assignData().

619  {
620  $this->import_name = $a_import_name;
621  }
+ Here is the caller graph for this function:

◆ setIsAuthorModerator()

ilForumPost::setIsAuthorModerator (   $is_author_moderator)
Parameters
int|null

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

References $is_author_moderator.

Referenced by assignData().

721  {
722  $this->is_author_moderator = $is_author_moderator;
723  }
+ Here is the caller graph for this function:

◆ setIsRead()

ilForumPost::setIsRead (   $a_is_read)

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

Referenced by assignData().

648  {
649  $this->post_read = $a_is_read;
650  }
+ Here is the caller graph for this function:

◆ setLft()

ilForumPost::setLft (   $a_lft)

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

Referenced by assignData().

662  {
663  $this->lft = $a_lft;
664  }
+ Here is the caller graph for this function:

◆ setLoginName()

ilForumPost::setLoginName (   $a_loginname)

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

353  {
354  $this->loginname = $a_loginname;
355  }

◆ setMessage()

ilForumPost::setMessage (   $a_message)

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

Referenced by assignData(), and ilForumExportGUI\executeCommand().

563  {
564  $this->message = $a_message;
565  }
+ Here is the caller graph for this function:

◆ setNotification()

ilForumPost::setNotification (   $a_notification)

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

Referenced by assignData().

611  {
612  $this->notification = $a_notification;
613  }
+ Here is the caller graph for this function:

◆ setParentId()

ilForumPost::setParentId (   $a_parent_id)

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

Referenced by assignData().

643  {
644  $this->parent_id = $a_parent_id;
645  }
+ Here is the caller graph for this function:

◆ setPosAuthorId()

ilForumPost::setPosAuthorId (   $pos_author_id)
Parameters
int$pos_author_id

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

References $pos_author_id.

Referenced by assignData().

698  {
699  $this->pos_author_id = $pos_author_id;
700  }
+ Here is the caller graph for this function:

◆ setRgt()

ilForumPost::setRgt (   $a_rgt)

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

Referenced by assignData().

670  {
671  $this->rgt = $a_rgt;
672  }
+ Here is the caller graph for this function:

◆ setStatus()

ilForumPost::setStatus (   $a_status)

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

Referenced by assignData().

627  {
628  $this->status = $a_status;
629  }
+ Here is the caller graph for this function:

◆ setSubject()

ilForumPost::setSubject (   $a_subject)

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

Referenced by assignData().

555  {
556  $this->subject = $a_subject;
557  }
+ Here is the caller graph for this function:

◆ setThread()

ilForumPost::setThread ( ilForumTopic  $thread)

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

686  {
687  $this->objThread = $thread;
688  }

◆ setThreadId()

ilForumPost::setThreadId (   $a_thread_id)

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

Referenced by assignData().

531  {
532  $this->thread_id = $a_thread_id;
533  }
+ Here is the caller graph for this function:

◆ setTreeId()

ilForumPost::setTreeId (   $a_tree_id)

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

Referenced by assignData().

635  {
636  $this->tree_id = $a_tree_id;
637  }
+ Here is the caller graph for this function:

◆ setUpdateUserId()

ilForumPost::setUpdateUserId (   $a_user_id_update)

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

Referenced by assignData().

587  {
588  $this->user_id_update = $a_user_id_update;
589  }
+ Here is the caller graph for this function:

◆ setUserAlias()

ilForumPost::setUserAlias (   $a_user_alias)

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

Referenced by assignData().

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

◆ update()

ilForumPost::update ( )

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

References $id, and $ilDB.

131  {
132  global $ilDB;
133 
134  if($this->id)
135  {
136  $ilDB->update('frm_posts',
137  array(
138  'pos_top_fk' => array('integer', $this->forum_id),
139  'pos_thr_fk' => array('integer', $this->thread_id),
140  'pos_subject' => array('text', $this->subject),
141  'pos_message' => array('clob', $this->message),
142  'pos_update' => array('timestamp', $this->changedate),
143  'update_user' => array('integer', $this->user_id_update),
144  'pos_cens' => array('integer', $this->censored),
145  'pos_cens_com' => array('text', $this->censorship_comment),
146  'notify' => array('integer', (int)$this->notification),
147  'pos_status' => array('integer', (int)$this->status)
148  ),
149  array(
150  'pos_pk' => array('integer', (int)$this->id)
151  )
152  );
153 
154  if($this->objThread->getFirstPostId() == $this->id)
155  {
156  $this->objThread->setSubject($this->subject);
157  $this->objThread->update();
158  $this->objThread->reload();
159  }
160 
161  return true;
162  }
163 
164  return false;
165  }
global $ilDB

Field Documentation

◆ $censored

ilForumPost::$censored = 0
private

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

◆ $censorship_comment

ilForumPost::$censorship_comment = ''
private

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

Referenced by getCensorshipComment().

◆ $changedate

ilForumPost::$changedate = '0000-00-00 00:00:00'
private

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

Referenced by getChangeDate().

◆ $createdate

ilForumPost::$createdate = '0000-00-00 00:00:00'
private

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

Referenced by getCreateDate().

◆ $db

ilForumPost::$db = null
private

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

◆ $depth

ilForumPost::$depth = 0
private

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

Referenced by getDepth().

◆ $display_user_id

ilForumPost::$display_user_id = 0
private

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

Referenced by getDisplayUserId().

◆ $forum_id

ilForumPost::$forum_id = 0
private

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

Referenced by getForumId().

◆ $fullname

ilForumPost::$fullname = ''
private

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

Referenced by getFullname().

◆ $id

ilForumPost::$id = 0
private

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

Referenced by getId(), and update().

◆ $import_name

ilForumPost::$import_name = ''
private

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

Referenced by getImportName().

◆ $is_author_moderator

ilForumPost::$is_author_moderator = null
private

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

Referenced by getIsAuthorModerator(), and setIsAuthorModerator().

◆ $is_moderator

ilForumPost::$is_moderator = false
private

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

◆ $lft

ilForumPost::$lft = 0
private

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

Referenced by getLft().

◆ $loginname

ilForumPost::$loginname = ''
private

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

Referenced by getLoginName().

◆ $message

ilForumPost::$message = ''
private

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

Referenced by getMessage().

◆ $notification

ilForumPost::$notification = 0
private

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

◆ $objThread

ilForumPost::$objThread = null
private

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

Referenced by getThread().

◆ $parent_id

ilForumPost::$parent_id = 0
private

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

Referenced by getParentId().

◆ $pos_author_id

ilForumPost::$pos_author_id = 0
private

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

Referenced by getPosAuthorId(), and setPosAuthorId().

◆ $post_read

ilForumPost::$post_read = false
private

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

Referenced by getIsRead().

◆ $rgt

ilForumPost::$rgt = 0
private

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

Referenced by getRgt().

◆ $status

ilForumPost::$status = 1
private

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

◆ $subject

ilForumPost::$subject = ''
private

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

Referenced by getSubject().

◆ $thread_id

ilForumPost::$thread_id = 0
private

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

Referenced by getThreadId().

◆ $tree_id

ilForumPost::$tree_id = 0
private

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

Referenced by getTreeId().

◆ $user_alias

ilForumPost::$user_alias = ''
private

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

Referenced by getUserAlias().

◆ $user_id_update

ilForumPost::$user_id_update = 0
private

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

Referenced by getUpdateUserId().


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