ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumTopic Class Reference
+ Collaboration diagram for ilForumTopic:

Public Member Functions

 __construct ($a_id=0, $a_is_moderator=false, $preventImplicitRead=false)
 Constructor. More...
 
 assignData ($data)
 
 insert ()
 Inserts the object data into database. More...
 
 update ()
 Updates an existing topic. More...
 
 reload ()
 Calls the private method read() to load the topic data from database into the object. More...
 
 getFirstPostId ()
 Fetches the primary key of the first post node of the current topic from database and returns it. More...
 
 updateVisits ()
 Updates the visit counter of the current topic. More...
 
 countPosts ()
 Fetches and returns the number of posts for the given user id. More...
 
 countActivePosts ()
 Fetches and returns the number of active posts for the given user id. More...
 
 getFirstPostNode ()
 Fetches and returns an object of the first post in the current topic. More...
 
 getLastPost ()
 Fetches and returns an object of the last post in the current topic. More...
 
 getLastActivePost ()
 Fetches and returns an object of the last active post in the current topic. More...
 
 getAllPosts ()
 
 getPostTree (ilForumPost $a_post_node)
 Fetches and returns an array of posts from the post tree, starting with the node object passed by the first paramter. More...
 
 movePosts ($old_obj_id, $old_pk, $new_obj_id, $new_pk)
 Moves all posts within the current thread to a new forum. More...
 
 getNestedSetPostChildren ($pos_id=null, $expandedNodes=array())
 
 isNotificationEnabled ($a_user_id)
 Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (result == 0). More...
 
 enableNotification ($a_user_id)
 Enable a user's notification about new posts in a thread. More...
 
 disableNotification ($a_user_id)
 Disable a user's notification about new posts in a thread. More...
 
 makeSticky ()
 Sets the current topic sticky. More...
 
 unmakeSticky ()
 Sets the current topic non-sticky. More...
 
 close ()
 Closes the current topic. More...
 
 reopen ()
 Reopens the current topic. More...
 
 setId ($a_id)
 
 getId ()
 
 setForumId ($a_forum_id)
 
 getForumId ()
 
 setUserId ($a_user_id)
 
 getUserId ()
 
 setUserAlias ($a_user_alias)
 
 getUserAlias ()
 
 setSubject ($a_subject)
 
 getSubject ()
 
 setCreateDate ($a_createdate)
 
 getCreateDate ()
 
 setChangeDate ($a_changedate)
 
 getChangeDate ()
 
 setImportName ($a_import_name)
 
 getImportName ()
 
 setLastPostString ($a_last_post)
 
 getLastPostString ()
 
 setVisits ($a_visits)
 
 getVisits ()
 
 setSticky ($a_sticky)
 
 isSticky ()
 
 setClosed ($a_closed)
 
 isClosed ()
 
 setOrderField ($a_order_field)
 
 getOrderField ()
 
 setModeratorRight ($bool)
 
 getModeratorRight ()
 
 getFrmObjId ()
 
 updateThreadTitle ()
 
 setNumPosts ($a_num_posts)
 
 getNumPosts ()
 
 setNumNewPosts ($num_new_posts)
 
 getNumNewPosts ()
 
 setNumUnreadPosts ($num_unread_posts)
 
 getNumUnreadPosts ()
 
 setUserNotificationEnabled ($user_notification_enabled)
 
 getUserNotificationEnabled ()
 
 setOrderDirection ($direction)
 
 getOrderDirection ()
 
 getSorting ()
 
 updateMergedThread ()
 

Static Public Member Functions

static _lookupTitle ($a_topic_id)
 Looks up the title/subject of a topic/thread. More...
 
static lookupForumIdByTopicId ($a_topic_id)
 
static deleteByThreadId ($thr_id)
 
static _lookupDate ($thread_id)
 

Protected Attributes

 $orderDirection = 'DESC'
 

Static Protected Attributes

static $possibleOrderDirections = array('ASC', 'DESC')
 

Private Member Functions

 read ()
 Reads the data of the current object id from database and loads it into the object. More...
 

Private Attributes

 $id = 0
 
 $forum_id = 0
 
 $frm_obj_id = 0
 
 $user_id = 0
 
 $user_alias = ''
 
 $subject = ''
 
 $createdate = '0000-00-00 00:00:00'
 
 $changedate = '0000-00-00 00:00:00'
 
 $num_posts = 0
 
 $last_post_string = ''
 
 $visits = 0
 
 $import_name = ''
 
 $is_sticky = 0
 
 $is_closed = 0
 
 $orderField = ''
 
 $posts = array()
 
 $db = null
 
 $is_moderator = false
 

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.ilForumTopic.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Returns an object of a forum topic. The constructor calls the private method read() to load the topic data from database into the object.

Parameters
integer$a_idprimary key of a forum topic (optional)
bool$a_is_moderatormoderator-status of the current user (optional)
bool$preventImplicitReadPrevents the implicit database query if an id was passed

public

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

References read().

67  {
68  global $ilDB;
69 
70  $this->is_moderator = $a_is_moderator;
71  $this->db = $ilDB;
72  $this->id = $a_id;
73 
74  if(!$preventImplicitRead)
75  {
76  $this->read();
77  }
78  }
read()
Reads the data of the current object id from database and loads it into the object.
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupDate()

static ilForumTopic::_lookupDate (   $thread_id)
static
Parameters
integer$thread_id
Returns
string datetime

Definition at line 1257 of file class.ilForumTopic.php.

References $res, and $row.

Referenced by ilObjForumGUI\confirmMergeThreadsObject().

1258  {
1259  global $ilDB;
1260 
1261  $res = $ilDB->queryF('SELECT thr_date FROM frm_threads WHERE thr_pk = %s',
1262  array('integer'), array((int)$thread_id));
1263 
1264  $row = $ilDB->fetchAssoc($res);
1265 
1266  return $row['thr_date'] ? $row['thr_date'] : '0000-00-00 00:00:00';
1267 
1268  }
+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilForumTopic::_lookupTitle (   $a_topic_id)
static

Looks up the title/subject of a topic/thread.

Parameters
integerid of the topic/thread
Returns
string title/subject of the topic/thread public

Definition at line 1097 of file class.ilForumTopic.php.

References $res, and $row.

Referenced by ilObjForumGUI\cancelObject(), ilObjForumGUI\confirmMergeThreadsObject(), and ilObjForumGUI\getThreadEditingForm().

1098  {
1099  global $ilDB;
1100 
1101  $res = $ilDB->queryf('
1102  SELECT thr_subject
1103  FROM frm_threads
1104  WHERE thr_pk = %s',
1105  array('integer'), array($a_topic_id));
1106  $row = $ilDB->fetchObject($res);
1107 
1108  if(is_object($row))
1109  {
1110  return $row->thr_subject;
1111  }
1112 
1113  return '';
1114  }
+ Here is the caller graph for this function:

◆ assignData()

ilForumTopic::assignData (   $data)
Parameters
$data

Definition at line 83 of file class.ilForumTopic.php.

References $data, setChangeDate(), setClosed(), setCreateDate(), setForumId(), setId(), setImportName(), setLastPostString(), setNumNewPosts(), setNumPosts(), setNumUnreadPosts(), setSticky(), setSubject(), setUserAlias(), setUserId(), setUserNotificationEnabled(), and setVisits().

84  {
85  $this->setId((int) $data['thr_pk']);
86  $this->setForumId((int) $data['thr_top_fk']);
87  $this->setSubject($data['thr_subject']);
88  $this->setUserId((int) $data['thr_usr_id']);
89  $this->setUserAlias($data['thr_usr_alias']);
90  $this->setLastPostString($data['last_post_string']);
91  $this->setCreateDate($data['thr_date']);
92  $this->setChangeDate($data['thr_update']);
93  $this->setVisits((int) $data['visits']);
94  $this->setImportName($data['import_name']);
95  $this->setSticky((int) $data['is_sticky']);
96  $this->setClosed((int) $data['is_closed']);
97 
98  // Aggregated values
99  $this->setNumPosts((int) $data['num_posts']);
100  $this->setNumUnreadPosts((int) $data['num_unread_posts']);
101  $this->setNumNewPosts((int) $data['num_new_posts']);
102  $this->setUserNotificationEnabled((bool) $data['usr_notification_is_enabled']);
103  }
setSubject($a_subject)
setUserNotificationEnabled($user_notification_enabled)
setForumId($a_forum_id)
setUserId($a_user_id)
setNumNewPosts($num_new_posts)
setNumUnreadPosts($num_unread_posts)
setCreateDate($a_createdate)
setLastPostString($a_last_post)
setChangeDate($a_changedate)
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
setUserAlias($a_user_alias)
setNumPosts($a_num_posts)
setImportName($a_import_name)
+ Here is the call graph for this function:

◆ close()

ilForumTopic::close ( )

Closes the current topic.

Returns
bool true in case of success, false in case of failure public

Definition at line 923 of file class.ilForumTopic.php.

924  {
925  if ($this->id && !$this->is_closed)
926  {
927  $statement = $this->db->manipulateF('
928  UPDATE frm_threads
929  SET is_closed = %s
930  WHERE thr_pk = %s',
931  array('integer', 'integer'),
932  array('1', $this->id));
933 
934  $this->is_closed = 1;
935 
936  return true;
937  }
938 
939  return false;
940  }

◆ countActivePosts()

ilForumTopic::countActivePosts ( )

Fetches and returns the number of active posts for the given user id.

Parameters
integer$a_user_iduser id
Returns
integer number of active posts public

Definition at line 328 of file class.ilForumTopic.php.

References $id, $ilUser, $res, and DB_FETCHMODE_ASSOC.

329  {
330  global $ilUser;
331 
332  $res = $this->db->queryf('
333  SELECT COUNT(*) cnt
334  FROM frm_posts
335  WHERE (pos_status = %s
336  OR (pos_status = %s AND pos_usr_id = %s))
337  AND pos_thr_fk = %s',
338  array('integer', 'integer', 'integer', 'integer'), array('1', '0', $ilUser->getId(), $this->id));
339 
340  $rec = $res->fetchRow(DB_FETCHMODE_ASSOC);
341 
342  return $rec['cnt'];
343  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilUser
Definition: imgupload.php:15

◆ countPosts()

ilForumTopic::countPosts ( )

Fetches and returns the number of posts for the given user id.

Parameters
integer$a_user_iduser id
Returns
integer number of posts public

Definition at line 308 of file class.ilForumTopic.php.

References $res, and DB_FETCHMODE_ASSOC.

309  {
310  $res = $this->db->queryf('
311  SELECT COUNT(*) cnt
312  FROM frm_posts
313  WHERE pos_thr_fk = %s',
314  array('integer'), array($this->id));
315 
316  $rec = $res->fetchRow(DB_FETCHMODE_ASSOC);
317 
318  return $rec['cnt'];
319  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10

◆ deleteByThreadId()

static ilForumTopic::deleteByThreadId (   $thr_id)
static

Definition at line 1244 of file class.ilForumTopic.php.

Referenced by ilForum\mergeThreads().

1245  {
1246  global $ilDB;
1247 
1248  $ilDB->manipulateF('DELETE FROM frm_threads WHERE thr_pk = %s',
1249  array('integer'), array($thr_id));
1250  }
+ Here is the caller graph for this function:

◆ disableNotification()

ilForumTopic::disableNotification (   $a_user_id)

Disable a user's notification about new posts in a thread.

Parameters
integer$a_user_idid of an user
Returns
bool true in case of success, false in case of failure public

Definition at line 850 of file class.ilForumTopic.php.

851  {
852  if ($this->id && $a_user_id)
853  {
854  $statement = $this->db->manipulateF('
855  DELETE FROM frm_notification
856  WHERE user_id = %s
857  AND thread_id = %s',
858  array('integer', 'integer'),
859  array($a_user_id, $this->id));
860 
861  return false;
862  }
863 
864  return false;
865  }

◆ enableNotification()

ilForumTopic::enableNotification (   $a_user_id)

Enable a user's notification about new posts in a thread.

Parameters
integer$a_user_idid of an user
Returns
bool true in case of success, false in case of failure public

Definition at line 819 of file class.ilForumTopic.php.

References isNotificationEnabled().

820  {
821  if ($this->id && $a_user_id)
822  {
823  if (!$this->isNotificationEnabled($a_user_id))
824  {
825  $nextId = $this->db->nextId('frm_notification');
826  $statement = $this->db->manipulateF('
827  INSERT INTO frm_notification
828  ( notification_id,
829  user_id,
830  thread_id
831  )
832  VALUES(%s, %s, %s)',
833  array('integer', 'integer', 'integer'),
834  array($nextId, $a_user_id, $this->id));
835 
836  return true;
837  }
838  return false;
839  }
840 
841  return false;
842  }
isNotificationEnabled($a_user_id)
Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (resul...
+ Here is the call graph for this function:

◆ getAllPosts()

ilForumTopic::getAllPosts ( )

Definition at line 424 of file class.ilForumTopic.php.

References $posts, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by movePosts().

425  {
426  $posts = array();
427 
428  if($this->id)
429  {
430  $res = $this->db->queryf('
431  SELECT pos_pk
432  FROM frm_posts
433  WHERE pos_thr_fk = %s',
434  array('integer'),
435  array($this->id));
436 
437  while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
438  {
439  $posts[$row->pos_pk] = $row;
440  }
441  }
442 
443  return is_array($posts) ? $posts : array();
444  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ getChangeDate()

ilForumTopic::getChangeDate ( )

Definition at line 1022 of file class.ilForumTopic.php.

References $changedate.

1023  {
1024  return $this->changedate;
1025  }

◆ getCreateDate()

ilForumTopic::getCreateDate ( )

Definition at line 1011 of file class.ilForumTopic.php.

References $createdate.

1012  {
1013  return $this->createdate;
1014  }

◆ getFirstPostId()

ilForumTopic::getFirstPostId ( )

Fetches the primary key of the first post node of the current topic from database and returns it.

Returns
integer primary key of the first post node public

Definition at line 265 of file class.ilForumTopic.php.

References $res, $row, and DB_FETCHMODE_OBJECT.

266  {
267  $res = $this->db->queryf('
268  SELECT * FROM frm_posts_tree
269  WHERE thr_fk = %s
270  AND parent_pos = %s',
271  array('integer', 'integer'), array($this->id, '1'));
272 
273  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
274 
275  return $row->pos_fk ? $row->pos_fk : 0;
276  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ getFirstPostNode()

ilForumTopic::getFirstPostNode ( )

Fetches and returns an object of the first post in the current topic.

Returns
ilForumPost object of a post public

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

References $res, $row, and DB_FETCHMODE_OBJECT.

352  {
353  $res = $this->db->queryf('
354  SELECT pos_pk
355  FROM frm_posts
356  INNER JOIN frm_posts_tree ON pos_fk = pos_pk
357  WHERE parent_pos = %s
358  AND thr_fk = %s',
359  array('integer', 'integer'),
360  array('0', $this->id));
361 
362  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
363 
364  return new ilForumPost($row->pos_pk);
365  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ getForumId()

ilForumTopic::getForumId ( )

Definition at line 979 of file class.ilForumTopic.php.

References $forum_id.

980  {
981  return $this->forum_id;
982  }

◆ getFrmObjId()

ilForumTopic::getFrmObjId ( )

Definition at line 1084 of file class.ilForumTopic.php.

References $frm_obj_id.

1085  {
1086  return $this->frm_obj_id;
1087  }

◆ getId()

ilForumTopic::getId ( )

Definition at line 971 of file class.ilForumTopic.php.

References $id.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable(), updateMergedThread(), and updateThreadTitle().

972  {
973  return $this->id;
974  }
+ Here is the caller graph for this function:

◆ getImportName()

ilForumTopic::getImportName ( )

Definition at line 1030 of file class.ilForumTopic.php.

References $import_name.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1031  {
1032  return $this->import_name;
1033  }
+ Here is the caller graph for this function:

◆ getLastActivePost()

ilForumTopic::getLastActivePost ( )

Fetches and returns an object of the last active post in the current topic.

Returns
ilForumPost object of the last active post public

Definition at line 399 of file class.ilForumTopic.php.

References $ilUser, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

400  {
401  global $ilUser;
402 
403  if ($this->id)
404  {
405  $this->db->setLimit(1);
406  $res = $this->db->queryf('
407  SELECT pos_pk
408  FROM frm_posts
409  WHERE pos_thr_fk = %s
410  AND (pos_status = %s OR
411  (pos_status = %s AND pos_usr_id = %s))
412  ORDER BY pos_date DESC',
413  array('integer', 'integer', 'integer', 'integer'),
414  array($this->id, '1', '0', $ilUser->getId()));
415 
416  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
417 
418  return new ilForumPost($row->pos_pk);
419  }
420 
421  return false;
422  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ getLastPost()

ilForumTopic::getLastPost ( )

Fetches and returns an object of the last post in the current topic.

Returns
ilForumPost object of the last post public

Definition at line 373 of file class.ilForumTopic.php.

References $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

374  {
375  if ($this->id)
376  {
377  $this->db->setLimit(1);
378  $res = $this->db->queryf('
379  SELECT pos_pk
380  FROM frm_posts
381  WHERE pos_thr_fk = %s
382  ORDER BY pos_date DESC',
383  array('integer'), array($this->id));
384 
385  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
386 
387  return new ilForumPost($row->pos_pk);
388  }
389 
390  return false;
391  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ getLastPostString()

ilForumTopic::getLastPostString ( )

Definition at line 1040 of file class.ilForumTopic.php.

References $last_post_string.

Referenced by updateMergedThread().

1041  {
1042  return $this->last_post_string;
1043  }
+ Here is the caller graph for this function:

◆ getModeratorRight()

ilForumTopic::getModeratorRight ( )

Definition at line 1080 of file class.ilForumTopic.php.

References $is_moderator.

1081  {
1082  return $this->is_moderator;
1083  }

◆ getNestedSetPostChildren()

ilForumTopic::getNestedSetPostChildren (   $pos_id = null,
  $expandedNodes = array() 
)

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

References $data, $ilUser, $query, $res, $row, and ilDB\fetchAssoc().

648  {
649  global $ilUser;
650 
651  $data = null;
652 
653  if( $pos_id !== null )
654  {
655  $res = $this->db->queryF("
656  SELECT lft, rgt
657  FROM frm_posts_tree
658  WHERE pos_fk = %s
659  AND thr_fk = %s",
660  array('integer', 'integer'),
661  array($pos_id, $this->id)
662  );
663 
664  $data = $this->db->fetchAssoc($res);
665  }
666 
667  $query = '
668  SELECT fpt.depth,
669  fpt.rgt,
670  fpt.parent_pos,
671  fp.pos_pk,
672  fp.pos_subject,
673  fp.pos_usr_alias,
674  fp.pos_date,
675  fp.pos_update,
676  fp.pos_status,
677  fp.pos_usr_id,
678  fp.pos_usr_alias,
679  fp.import_name,
680  fur.post_id,
681  (CASE
682  WHEN fur.post_id IS NULL '.
683  ($ilUser->getId() == ANONYMOUS_USER_ID ? ' AND 1 = 2 ' : '').'
684  THEN 0
685  ELSE 1
686  END) post_read,
687  COUNT(fpt2.pos_fk) children
688 
689  FROM frm_posts_tree fpt
690 
691  INNER JOIN frm_posts fp
692  ON fp.pos_pk = fpt.pos_fk
693 
694  LEFT JOIN frm_posts_tree fpt2
695  ON fpt2.lft BETWEEN fpt.lft AND fpt.rgt
696  AND fpt.thr_fk = fpt2.thr_fk
697  AND fpt.pos_fk != fpt2.pos_fk ';
698 
699 
700  $query .= '
701  LEFT JOIN frm_user_read fur
702  ON fur.thread_id = fp.pos_thr_fk
703  AND fur.post_id = fp.pos_pk
704  AND fur.usr_id = '.$this->db->quote($ilUser->getId(), 'integer').'
705 
706  LEFT JOIN usr_data ud
707  ON ud.usr_id = fp.pos_usr_id
708 
709  WHERE fpt.thr_fk = '.$this->db->quote($this->id, 'integer');
710 
711  if( $data )
712  {
713  $query .= ' AND fpt.lft > '.$this->db->quote($data['lft'], 'integer').
714  ' AND fpt.lft < '.$this->db->quote($data['rgt'], 'integer').' ';
715  }
716 
717  if( !$this->is_moderator )
718  {
719  $query .= ' AND (fp.pos_status = 1 OR fp.pos_status = 0 AND fp.pos_usr_id = '.
720  $this->db->quote($ilUser->getId(), 'integer').') ';
721  }
722 
723  if( $expandedNodes )
724  {
725  $query .= ' AND '.$this->db->in('fpt.parent_pos', $expandedNodes, false, 'integer').' ';
726  }
727 
728 
729  $query .= ' GROUP BY fpt.depth,
730  fpt.parent_pos,
731  fp.pos_pk,
732  fp.pos_subject,
733  fp.pos_usr_alias,
734  fp.pos_date,
735  fp.pos_update,
736  fp.pos_status,
737  fp.pos_usr_id,
738  fp.pos_usr_alias,
739  fp.import_name,
740  fur.post_id,
741  fpt.rgt
742  ORDER BY fpt.rgt DESC
743  ';
744 
745  $queryCounter = '
746  SELECT pos_fk
747  FROM frm_posts_tree fpt
748  INNER JOIN frm_posts fp
749  ON fp.pos_pk = fpt.pos_fk
750  WHERE fpt.thr_fk = '.$this->db->quote($this->id, 'integer');
751  if( !$this->is_moderator )
752  {
753  $queryCounter .= ' AND (fp.pos_status = 1 OR fp.pos_status = 0 AND fp.pos_usr_id = '.
754  $this->db->quote($ilUser->getId(), 'integer').') ';
755  }
756  $queryCounter .= ' ORDER BY fpt.rgt DESC';
757 
758  $resCounter = $this->db->query($queryCounter);
759  $counter = array();
760  $i = 0;
761  while( $row = $this->db->fetchAssoc($resCounter) )
762  {
763  $counter[$row['pos_fk']] = $i++;
764  }
765 
766  $res = $this->db->query($query);
767  $children = array();
768  $usr_ids = array();
769  while( $row = $this->db->fetchAssoc($res) )
770  {
771  if((int)$row['pos_usr_id'])
772  {
773  $usr_ids[] = (int)$row['pos_usr_id'];
774  }
775 
776  $row['counter'] = $counter[$row['pos_pk']];
777  $children[] = $row;
778  }
779 
780  require_once 'Modules/Forum/classes/class.ilForumAuthorInformationCache.php';
781  ilForumAuthorInformationCache::preloadUserObjects(array_unique($usr_ids));
782 
783  return $children;
784  }
fetchAssoc($a_set)
Fetch row as associative array from result set.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ getNumNewPosts()

ilForumTopic::getNumNewPosts ( )
Returns
int

Definition at line 1157 of file class.ilForumTopic.php.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1158  {
1159  return $this->num_new_posts;
1160  }
+ Here is the caller graph for this function:

◆ getNumPosts()

ilForumTopic::getNumPosts ( )
Returns
int

Definition at line 1139 of file class.ilForumTopic.php.

References $num_posts.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable(), and updateMergedThread().

1140  {
1141  return $this->num_posts;
1142  }
+ Here is the caller graph for this function:

◆ getNumUnreadPosts()

ilForumTopic::getNumUnreadPosts ( )
Returns
int

Definition at line 1175 of file class.ilForumTopic.php.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1176  {
1177  return $this->num_unread_posts;
1178  }
+ Here is the caller graph for this function:

◆ getOrderDirection()

ilForumTopic::getOrderDirection ( )

Definition at line 1209 of file class.ilForumTopic.php.

References $orderDirection.

Referenced by getPostTree().

1210  {
1211  return $this->orderDirection;
1212  }
+ Here is the caller graph for this function:

◆ getOrderField()

ilForumTopic::getOrderField ( )

Definition at line 1072 of file class.ilForumTopic.php.

References $orderField.

1073  {
1074  return $this->orderField;
1075  }

◆ getPostTree()

ilForumTopic::getPostTree ( ilForumPost  $a_post_node)

Fetches and returns an array of posts from the post tree, starting with the node object passed by the first paramter.

Parameters
ilForumPost$a_post_nodenode-object of a post
Returns
array array of post objects public

Definition at line 454 of file class.ilForumTopic.php.

References $data, $ilUser, $posts, $query, $res, $row, ilForumPost\getLft(), getOrderDirection(), ilForumPost\getRgt(), and ilForumPost\getThreadId().

455  {
456  global $ilUser;
457 
458  $posts = array();
459 
460  $data = array();
461  $data_types = array();
462 
463  $query = '
464  SELECT pos_pk, fpt_date, rgt, pos_top_fk, pos_thr_fk,
465  pos_usr_id, pos_usr_alias, pos_subject,
466  pos_status, pos_message, pos_date, pos_update,
467  update_user, pos_cens, pos_cens_com, notify,
468  import_name, fpt_pk, parent_pos, lft, depth,
469  (CASE
470  WHEN fur.post_id IS NULL '.
471  ($ilUser->getId() == ANONYMOUS_USER_ID ? ' AND 1 = 2 ' : '').'
472  THEN 0
473  ELSE 1
474  END) post_read,
475  firstname, lastname, title, login
476 
477  FROM frm_posts_tree
478 
479  INNER JOIN frm_posts
480  ON pos_fk = pos_pk
481 
482  LEFT JOIN usr_data
483  ON pos_usr_id = usr_id
484 
485  LEFT JOIN frm_user_read fur
486  ON fur.thread_id = pos_thr_fk
487  AND fur.post_id = pos_pk
488  AND fur.usr_id = %s
489 
490  WHERE lft BETWEEN %s AND %s
491  AND thr_fk = %s';
492 
493  array_push($data_types, 'integer', 'integer', 'integer', 'integer');
494  array_push($data, $ilUser->getId(), $a_post_node->getLft(), $a_post_node->getRgt(), $a_post_node->getThreadId());
495 
496  if($this->orderField != "")
497  {
498  $query .= " ORDER BY ".$this->orderField." ".$this->getOrderDirection();
499  }
500 
501  $res = $this->db->queryf($query, $data_types, $data);
502 
503  $usr_ids = array();
504 
505  $deactivated = array();
506  while( $row = $this->db->fetchAssoc($res) )
507  {
508  $tmp_object = new ilForumPost($row['pos_pk'], false, true);
509  $tmp_object->assignData($row);
510 
511  if (!$this->is_moderator)
512  {
513  if (!$tmp_object->isActivated() && $tmp_object->getUserId() != $ilUser->getId())
514  {
515  $deactivated[] = $tmp_object;
516  unset($tmp_object);
517  continue;
518  }
519 
520  foreach ($deactivated as $deactivated_node)
521  {
522  if ($deactivated_node->getLft() < $tmp_object->getLft() && $deactivated_node->getRgt() > $tmp_object->getLft())
523  {
524  $deactivated[] = $tmp_object;
525  unset($tmp_object);
526  continue 2;
527  }
528  }
529  }
530 
531  if((int)$row['pos_usr_id'])
532  {
533  $usr_ids[] = (int)$row['pos_usr_id'];
534  }
535  if((int)$row['update_user'])
536  {
537  $usr_ids[] = (int)$row['update_user'];
538  }
539 
540  $posts[] = $tmp_object;
541 
542  unset($tmp_object);
543  }
544 
545  require_once 'Modules/Forum/classes/class.ilForumAuthorInformationCache.php';
546  ilForumAuthorInformationCache::preloadUserObjects(array_unique($usr_ids));
547 
548  return $posts;
549  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ getSorting()

ilForumTopic::getSorting ( )

Definition at line 1226 of file class.ilForumTopic.php.

1227  {
1228  return $this->thread_sorting;
1229  }

◆ getSubject()

ilForumTopic::getSubject ( )

Definition at line 1003 of file class.ilForumTopic.php.

References $subject.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable(), updateMergedThread(), and updateThreadTitle().

1004  {
1005  return $this->subject;
1006  }
+ Here is the caller graph for this function:

◆ getUserAlias()

ilForumTopic::getUserAlias ( )

Definition at line 995 of file class.ilForumTopic.php.

References $user_alias.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

996  {
997  return $this->user_alias;
998  }
+ Here is the caller graph for this function:

◆ getUserId()

ilForumTopic::getUserId ( )

Definition at line 987 of file class.ilForumTopic.php.

References $user_id.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

988  {
989  return $this->user_id;
990  }
+ Here is the caller graph for this function:

◆ getUserNotificationEnabled()

ilForumTopic::getUserNotificationEnabled ( )
Returns
boolean

Definition at line 1193 of file class.ilForumTopic.php.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1194  {
1195  return $this->user_notification_enabled;
1196  }
+ Here is the caller graph for this function:

◆ getVisits()

ilForumTopic::getVisits ( )

Definition at line 1048 of file class.ilForumTopic.php.

References $visits.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable(), and updateMergedThread().

1049  {
1050  return $this->visits;
1051  }
+ Here is the caller graph for this function:

◆ insert()

ilForumTopic::insert ( )

Inserts the object data into database.

Returns
bool true in case of success, false in case of failure public

Definition at line 111 of file class.ilForumTopic.php.

112  {
113  if ($this->forum_id)
114  {
115  $nextId = $this->db->nextId('frm_threads');
116  $statement = $this->db->manipulateF('
117  INSERT INTO frm_threads
118  ( thr_pk,
119  thr_top_fk,
120  thr_subject,
121  thr_usr_id,
122  thr_usr_alias,
123  thr_num_posts,
124  thr_last_post,
125  thr_date,
126  thr_update,
127  import_name,
128  is_sticky,
129  is_closed
130  )
131  VALUES(%s,%s,%s,%s,%s,%s,%s,%s, %s, %s,%s,%s)',
132 
133  array( 'integer',
134  'integer',
135  'text',
136  'integer',
137  'text',
138  'integer',
139  'text',
140  'timestamp',
141  'timestamp',
142  'text',
143  'integer',
144  'integer'),
145  array( $nextId,
146  $this->forum_id,
147  $this->subject,
148  $this->user_id,
149  $this->user_alias,
150  $this->num_posts,
151  $this->last_post_string,
152  $this->createdate,
153  NULL,
154  $this->import_name,
155  $this->is_sticky,
156  $this->is_closed
157  ));
158  $this->id = $nextId;
159 
160  return true;
161  }
162 
163  return false;
164  }

◆ isClosed()

ilForumTopic::isClosed ( )

Definition at line 1064 of file class.ilForumTopic.php.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1065  {
1066  return $this->is_closed == 1 ? true : false;
1067  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilForumTopic::isNotificationEnabled (   $a_user_id)

Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (result == 0).

Parameters
integer$a_user_idid of an user
Returns
bool true in case of success, false in case of failure public

Definition at line 792 of file class.ilForumTopic.php.

References $result.

Referenced by enableNotification().

793  {
794  if ($this->id && $a_user_id)
795  {
796  $result = $this->db->queryf('
797  SELECT COUNT(notification_id) cnt FROM frm_notification
798  WHERE user_id = %s AND thread_id = %s',
799  array('integer', 'integer'),
800  array($a_user_id, $this->id));
801 
802  while($record = $this->db->fetchAssoc($result))
803  {
804  return (bool)$record['cnt'];
805  }
806 
807  return false;
808  }
809 
810  return false;
811  }
$result
+ Here is the caller graph for this function:

◆ isSticky()

ilForumTopic::isSticky ( )

Definition at line 1056 of file class.ilForumTopic.php.

Referenced by ilForumTopicTableGUI\initMergeThreadsTable().

1057  {
1058  return $this->is_sticky == 1 ? true : false;
1059  }
+ Here is the caller graph for this function:

◆ lookupForumIdByTopicId()

static ilForumTopic::lookupForumIdByTopicId (   $a_topic_id)
static

Definition at line 1214 of file class.ilForumTopic.php.

References $res, and $row.

Referenced by ilObjForumGUI\confirmMergeThreadsObject().

1215  {
1216  global $ilDB;
1217 
1218  $res = $ilDB->queryF('SELECT thr_top_fk FROM frm_threads WHERE thr_pk = %s',
1219  array('integer'), array($a_topic_id));
1220 
1221  $row = $ilDB->fetchAssoc($res);
1222 
1223  return $row['thr_top_fk'];
1224  }
+ Here is the caller graph for this function:

◆ makeSticky()

ilForumTopic::makeSticky ( )

Sets the current topic sticky.

Returns
bool true in case of success, false in case of failure public

Definition at line 873 of file class.ilForumTopic.php.

874  {
875  if ($this->id && !$this->is_sticky)
876  {
877  $statement = $this->db->manipulateF('
878  UPDATE frm_threads
879  SET is_sticky = %s
880  WHERE thr_pk = %s',
881  array('integer', 'integer'),
882  array('1', $this->id));
883 
884  $this->is_sticky = 1;
885 
886  return true;
887  }
888 
889  return false;
890  }

◆ movePosts()

ilForumTopic::movePosts (   $old_obj_id,
  $old_pk,
  $new_obj_id,
  $new_pk 
)

Moves all posts within the current thread to a new forum.

Parameters
integer$old_obj_idobject id of the current forum
integer$old_pkprimary key of old forum
integer$new_obj_idobject id of the new forum
integer$new_pkprimary key of new forum
Returns
integer number of afffected rows by updating posts public

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

References $posts, ilForum\_lookupObjIdForForumId(), DB_FETCHMODE_ASSOC, getAllPosts(), ilNewsItem\getFirstNewsIdForContext(), and ilDB\LOCK_WRITE.

562  {
563  global $ilDB;
564 
565  if ($this->id)
566  {
567  $nodes = $this->getAllPosts();
568  if(is_array($nodes))
569  {
570  // Move attachments
571  foreach($nodes as $node)
572  {
573  $file_obj = new ilFileDataForum((int)$old_obj_id, (int)$node->pos_pk);
574  $file_obj->moveFilesOfPost((int)$new_obj_id);
575  unset($file_obj);
576  }
577  }
578 
579  $this->db->lockTables(
580  array(
581  0 => array('name' => 'frm_user_read', 'type' => ilDB::LOCK_WRITE),
582  1 => array('name' => 'frm_thread_access', 'type' => ilDB::LOCK_WRITE)
583  )
584  );
585 
586  $this->db->manipulateF('
587  DELETE FROM frm_user_read
588  WHERE obj_id = %s AND thread_id =%s',
589  array('integer', 'integer'),
590  array($new_obj_id, $this->id));
591 
592  $this->db->manipulateF('
593  UPDATE frm_user_read
594  SET obj_id = %s
595  WHERE thread_id = %s',
596  array('integer', 'integer'),
597  array($new_obj_id, $this->id));
598 
599  $this->db->manipulateF('
600  DELETE FROM frm_thread_access
601  WHERE obj_id = %s AND thread_id =%s',
602  array('integer', 'integer'),
603  array($new_obj_id, $this->id));
604 
605  $this->db->manipulateF('
606  UPDATE frm_thread_access
607  SET obj_id = %s
608  WHERE thread_id =%s',
609  array('integer', 'integer'),
610  array($new_obj_id, $this->id));
611 
612  $this->db->unlockTables();
613 
614  $this->db->manipulateF('
615  UPDATE frm_posts
616  SET pos_top_fk = %s
617  WHERE pos_thr_fk = %s',
618  array('integer', 'integer'),
619  array($new_pk, $this->id));
620 
621  // update all related news
622  $posts = $ilDB->queryf('
623  SELECT * FROM frm_posts WHERE pos_thr_fk = %s',
624  array('integer'), array($this->id));
625 
626  $old_obj_id = ilForum::_lookupObjIdForForumId($old_pk);
627 
628  $new_obj_id = ilForum::_lookupObjIdForForumId($new_pk);
629 
630  while($post = $posts->fetchRow(DB_FETCHMODE_ASSOC))
631  {
632  include_once("./Services/News/classes/class.ilNewsItem.php");
633  $news_id = ilNewsItem::getFirstNewsIdForContext($old_obj_id,
634  "frm", $post["pos_pk"], "pos");
635  $news_item = new ilNewsItem($news_id);
636  $news_item->setContextObjId($new_obj_id);
637  $news_item->update();
638  //echo "<br>-".$post["pos_pk"]."-".$old_obj_id."-".$new_obj_id."-";
639  }
640 
641  return count($nodes);
642  }
643 
644  return 0;
645  }
static _lookupObjIdForForumId($a_for_id)
static getFirstNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
const LOCK_WRITE
Definition: class.ilDB.php:30
This class handles all operations on files for the forum object.
+ Here is the call graph for this function:

◆ read()

ilForumTopic::read ( )
private

Reads the data of the current object id from database and loads it into the object.

Returns
bool true in case of success, false in case of failure

private

Definition at line 207 of file class.ilForumTopic.php.

References $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), and reload().

208  {
209 
210  if ($this->id)
211  {
212  $res = $this->db->queryf('
213  SELECT frm_threads.*, top_frm_fk frm_obj_id
214  FROM frm_threads
215  INNER JOIN frm_data ON top_pk = thr_top_fk
216  WHERE thr_pk = %s',
217  array('integer'), array($this->id));
218 
219  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
220 
221  if (is_object($row))
222  {
223 
224  $this->thr_pk = $row->pos_pk; // thr_pk = pos_pk ??!??!
225  $this->forum_id = $row->thr_top_fk;
226  $this->user_id = $row->thr_usr_id;
227  $this->user_alias = $row->thr_usr_alias;
228  $this->subject = html_entity_decode($row->thr_subject);
229  $this->createdate = $row->thr_date;
230  $this->changedate = $row->thr_update;
231  $this->import_name = $row->import_name;
232  $this->num_posts = $row->thr_num_posts;
233  $this->last_post_string = $row->thr_last_post;
234  $this->visits = $row->visits;
235  $this->is_sticky = $row->is_sticky;
236  $this->is_closed = $row->is_closed;
237  $this->frm_obj_id = $row->frm_obj_id;
238 
239  return true;
240  }
241  $this->id = 0;
242  return false;
243  }
244 
245  return false;
246  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ reload()

ilForumTopic::reload ( )

Calls the private method read() to load the topic data from database into the object.

Returns
bool true in case of success, false in case of failure public

Definition at line 254 of file class.ilForumTopic.php.

References read().

255  {
256  return $this->read();
257  }
read()
Reads the data of the current object id from database and loads it into the object.
+ Here is the call graph for this function:

◆ reopen()

ilForumTopic::reopen ( )

Reopens the current topic.

Returns
bool true in case of success, false in case of failure public

Definition at line 948 of file class.ilForumTopic.php.

949  {
950  if ($this->id && $this->is_closed)
951  {
952  $statement = $this->db->manipulateF('
953  UPDATE frm_threads
954  SET is_closed = %s
955  WHERE thr_pk = %s',
956  array('integer', 'integer'),
957  array('0', $this->id));
958 
959  $this->is_closed = 0;
960 
961  return true;
962  }
963 
964  return false;
965  }

◆ setChangeDate()

ilForumTopic::setChangeDate (   $a_changedate)

Definition at line 1015 of file class.ilForumTopic.php.

Referenced by assignData().

1016  {
1017  if($a_changedate == '0000-00-00 00:00:00')
1018  $this->changedate = NULL;
1019  else
1020  $this->changedate = $a_changedate;
1021  }
+ Here is the caller graph for this function:

◆ setClosed()

ilForumTopic::setClosed (   $a_closed)

Definition at line 1060 of file class.ilForumTopic.php.

Referenced by assignData().

1061  {
1062  $this->is_closed = $a_closed;
1063  }
+ Here is the caller graph for this function:

◆ setCreateDate()

ilForumTopic::setCreateDate (   $a_createdate)

Definition at line 1007 of file class.ilForumTopic.php.

Referenced by assignData().

1008  {
1009  $this->createdate = $a_createdate;
1010  }
+ Here is the caller graph for this function:

◆ setForumId()

ilForumTopic::setForumId (   $a_forum_id)

Definition at line 975 of file class.ilForumTopic.php.

Referenced by assignData().

976  {
977  $this->forum_id = $a_forum_id;
978  }
+ Here is the caller graph for this function:

◆ setId()

ilForumTopic::setId (   $a_id)

Definition at line 967 of file class.ilForumTopic.php.

Referenced by assignData().

968  {
969  $this->id = $a_id;
970  }
+ Here is the caller graph for this function:

◆ setImportName()

ilForumTopic::setImportName (   $a_import_name)

Definition at line 1026 of file class.ilForumTopic.php.

Referenced by assignData().

1027  {
1028  $this->import_name = $a_import_name;
1029  }
+ Here is the caller graph for this function:

◆ setLastPostString()

ilForumTopic::setLastPostString (   $a_last_post)

Definition at line 1034 of file class.ilForumTopic.php.

Referenced by assignData().

1035  {
1036  if($a_last_post == '') $a_last_post = NULL;
1037 
1038  $this->last_post_string = $a_last_post;
1039  }
+ Here is the caller graph for this function:

◆ setModeratorRight()

ilForumTopic::setModeratorRight (   $bool)

Definition at line 1076 of file class.ilForumTopic.php.

1077  {
1078  $this->is_moderator = $bool;
1079  }

◆ setNumNewPosts()

ilForumTopic::setNumNewPosts (   $num_new_posts)
Parameters
int$num_new_posts
Returns
ilForumTopic

Definition at line 1148 of file class.ilForumTopic.php.

Referenced by assignData().

1149  {
1150  $this->num_new_posts = $num_new_posts;
1151  return $this;
1152  }
+ Here is the caller graph for this function:

◆ setNumPosts()

ilForumTopic::setNumPosts (   $a_num_posts)
Parameters
$a_num_posts
Returns
ilForumTopic

Definition at line 1130 of file class.ilForumTopic.php.

Referenced by assignData().

1131  {
1132  $this->num_posts = $a_num_posts;
1133  return $this;
1134  }
+ Here is the caller graph for this function:

◆ setNumUnreadPosts()

ilForumTopic::setNumUnreadPosts (   $num_unread_posts)
Parameters
int$num_unread_posts
Returns
ilForumTopic

Definition at line 1166 of file class.ilForumTopic.php.

Referenced by assignData().

1167  {
1168  $this->num_unread_posts = $num_unread_posts;
1169  return $this;
1170  }
+ Here is the caller graph for this function:

◆ setOrderDirection()

ilForumTopic::setOrderDirection (   $direction)

Definition at line 1198 of file class.ilForumTopic.php.

1199  {
1200  if(!in_array(strtoupper($direction), self::$possibleOrderDirections))
1201  {
1202  $direction = current(self::$possibleOrderDirections);
1203  }
1204 
1205  $this->orderDirection = $direction;
1206  return $this;
1207  }

◆ setOrderField()

ilForumTopic::setOrderField (   $a_order_field)

Definition at line 1068 of file class.ilForumTopic.php.

1069  {
1070  $this->orderField = $a_order_field;
1071  }

◆ setSticky()

ilForumTopic::setSticky (   $a_sticky)

Definition at line 1052 of file class.ilForumTopic.php.

Referenced by assignData().

1053  {
1054  $this->is_sticky = $a_sticky;
1055  }
+ Here is the caller graph for this function:

◆ setSubject()

ilForumTopic::setSubject (   $a_subject)

Definition at line 999 of file class.ilForumTopic.php.

Referenced by assignData().

1000  {
1001  $this->subject = $a_subject;
1002  }
+ Here is the caller graph for this function:

◆ setUserAlias()

ilForumTopic::setUserAlias (   $a_user_alias)

Definition at line 991 of file class.ilForumTopic.php.

Referenced by assignData().

992  {
993  $this->user_alias = $a_user_alias;
994  }
+ Here is the caller graph for this function:

◆ setUserId()

ilForumTopic::setUserId (   $a_user_id)

Definition at line 983 of file class.ilForumTopic.php.

Referenced by assignData().

984  {
985  $this->user_id = $a_user_id;
986  }
+ Here is the caller graph for this function:

◆ setUserNotificationEnabled()

ilForumTopic::setUserNotificationEnabled (   $user_notification_enabled)
Parameters
boolean$user_notification_enabled
Returns
ilForumTopic

Definition at line 1184 of file class.ilForumTopic.php.

Referenced by assignData().

1185  {
1186  $this->user_notification_enabled = $user_notification_enabled;
1187  return $this;
1188  }
+ Here is the caller graph for this function:

◆ setVisits()

ilForumTopic::setVisits (   $a_visits)

Definition at line 1044 of file class.ilForumTopic.php.

Referenced by assignData().

1045  {
1046  $this->visits = $a_visits;
1047  }
+ Here is the caller graph for this function:

◆ unmakeSticky()

ilForumTopic::unmakeSticky ( )

Sets the current topic non-sticky.

Returns
bool true in case of success, false in case of failure public

Definition at line 898 of file class.ilForumTopic.php.

899  {
900  if ($this->id && $this->is_sticky)
901  {
902  $statement = $this->db->manipulateF('
903  UPDATE frm_threads
904  SET is_sticky = %s
905  WHERE thr_pk = %s',
906  array('integer', 'integer'),
907  array('0', $this->id));
908 
909  $this->is_sticky = 0;
910 
911  return true;
912  }
913 
914  return false;
915  }

◆ update()

ilForumTopic::update ( )

Updates an existing topic.

Returns
bool true in case of success, false in case of failure public

Definition at line 172 of file class.ilForumTopic.php.

173  {
174  if ($this->id)
175  {
176  $statement = $this->db->manipulateF('
177  UPDATE frm_threads
178  SET thr_top_fk = %s,
179  thr_subject = %s,
180  thr_update = %s,
181  thr_num_posts = %s,
182  thr_last_post = %s
183  WHERE thr_pk = %s',
184  array('integer', 'text','timestamp', 'integer', 'text', 'integer'),
185  array( $this->forum_id,
186  $this->subject,
187  /* $this->changedate, */
188  date('Y-m-d H:i:s'),
189  $this->num_posts,
190  $this->last_post_string,
191  $this->id
192  ));
193 
194  return true;
195  }
196 
197  return false;
198  }

◆ updateMergedThread()

ilForumTopic::updateMergedThread ( )

Definition at line 1230 of file class.ilForumTopic.php.

References getId(), getLastPostString(), getNumPosts(), getSubject(), and getVisits().

1231  {
1232  global $ilDB;
1233 
1234  $ilDB->update('frm_threads',
1235  array(
1236  'thr_num_posts' => array('integer', $this->getNumPosts()),
1237  'visits' => array('integer', $this->getVisits()),
1238  'thr_last_post' => array('text', $this->getLastPostString()),
1239  'thr_subject' => array('text', $this->getSubject())
1240  ),
1241  array('thr_pk' => array('integer', $this->getId())));
1242  }
+ Here is the call graph for this function:

◆ updateThreadTitle()

ilForumTopic::updateThreadTitle ( )

Definition at line 1116 of file class.ilForumTopic.php.

References getId(), and getSubject().

1117  {
1118  global $ilDB;
1119 
1120  $ilDB->update('frm_threads',
1121  array('thr_subject' => array('text',$this->getSubject())),
1122  array('thr_pk'=> array('integer', $this->getId()))
1123  );
1124  }
+ Here is the call graph for this function:

◆ updateVisits()

ilForumTopic::updateVisits ( )

Updates the visit counter of the current topic.

public

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

References $_SESSION.

284  {
285  $checkTime = time() - (60 * 60);
286 
287  if ($_SESSION['frm_visit_frm_threads_'.$this->id] < $checkTime)
288  {
289  $_SESSION['frm_visit_frm_threads_'.$this->id] = time();
290 
291  $statement = $this->db->manipulateF('
292  UPDATE frm_threads
293  SET visits = visits + 1
294  WHERE thr_pk = %s',
295  array('integer'), array($this->id));
296  }
297 
298  return true;
299  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

Field Documentation

◆ $changedate

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

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

Referenced by getChangeDate().

◆ $createdate

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

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

Referenced by getCreateDate().

◆ $db

ilForumTopic::$db = null
private

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

◆ $forum_id

ilForumTopic::$forum_id = 0
private

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

Referenced by getForumId().

◆ $frm_obj_id

ilForumTopic::$frm_obj_id = 0
private

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

Referenced by getFrmObjId().

◆ $id

ilForumTopic::$id = 0
private

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

Referenced by countActivePosts(), and getId().

◆ $import_name

ilForumTopic::$import_name = ''
private

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

Referenced by getImportName().

◆ $is_closed

ilForumTopic::$is_closed = 0
private

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

◆ $is_moderator

ilForumTopic::$is_moderator = false
private

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

Referenced by getModeratorRight().

◆ $is_sticky

ilForumTopic::$is_sticky = 0
private

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

◆ $last_post_string

ilForumTopic::$last_post_string = ''
private

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

Referenced by getLastPostString().

◆ $num_posts

ilForumTopic::$num_posts = 0
private

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

Referenced by getNumPosts().

◆ $orderDirection

ilForumTopic::$orderDirection = 'DESC'
protected

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

Referenced by getOrderDirection().

◆ $orderField

ilForumTopic::$orderField = ''
private

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

Referenced by getOrderField().

◆ $possibleOrderDirections

ilForumTopic::$possibleOrderDirections = array('ASC', 'DESC')
staticprotected

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

◆ $posts

ilForumTopic::$posts = array()
private

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

Referenced by getAllPosts(), getPostTree(), and movePosts().

◆ $subject

ilForumTopic::$subject = ''
private

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

Referenced by getSubject().

◆ $user_alias

ilForumTopic::$user_alias = ''
private

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

Referenced by getUserAlias().

◆ $user_id

ilForumTopic::$user_id = 0
private

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

Referenced by getUserId().

◆ $visits

ilForumTopic::$visits = 0
private

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

Referenced by getVisits().


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