ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilForum Class Reference

Class Forum core functions for forum. More...

+ Collaboration diagram for ilForum:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 setLanguage ($lng)
 
 setForumId ($a_obj_id)
 set object id which refers to ILIAS obj_id More...
 
 setForumRefId ($a_ref_id)
 set reference id which refers to ILIAS obj_id More...
 
 getForumId ()
 get forum id public More...
 
 getForumRefId ()
 get forum ref_id public More...
 
 getOrderField ()
 get name of orderField More...
 
 setDbTable ($dbTable)
 set database table More...
 
 getDbTable ()
 get name of database table More...
 
 setMDB2WhereCondition ($query_string, $data_type, $data_value)
 set content for additional condition More...
 
 getMDB2Query ()
 get content of additional condition More...
 
 getMDB2DataValue ()
 get content of additional condition More...
 
 getMDB2DataType ()
 get content of additional condition More...
 
 setPageHits ($pageHits)
 
 getPageHits ()
 get number of max. More...
 
 getOneTopic ()
 get one topic-dataset by WhereCondition More...
 
 getOneThread ()
 get one thread-dataset by WhereCondition More...
 
 getOnePost ($post)
 get one post-dataset More...
 
 generatePost ($forum_id, $thread_id, $author_id, $display_user_id, $message, $parent_pos, $notify, $subject='', $alias='', $date='', $status=1, $send_activation_mail=0)
 generate new dataset in frm_posts More...
 
 generateThread (ilForumTopic $thread, $message, $notify, $notify_posts, $status=1)
 
 moveThreads ($thread_ids=array(), $src_ref_id=0, $dest_top_frm_fk=0)
 Moves all chosen threads and their posts to a new forum. More...
 
 postCensorship ($message, $pos_pk, $cens=0)
 update dataset in frm_posts with censorship info More...
 
 deletePost ($post)
 delete post and sub-posts More...
 
 getAllThreads ($a_topic_id, array $params=array(), $limit=0, $offset=0)
 
 getUserStatistic ($is_moderator=false)
 
 getFirstPostByThread ($a_thread_id)
 Get first post of thread. More...
 
 getModerators ()
 get all users assigned to local role il_frm_moderator_<frm_ref_id> More...
 
 countUserArticles ($a_user_id)
 get number of articles from given user-ID More...
 
 countActiveUserArticles ($a_user_id)
 
 convertDate ($date)
 converts the date format More...
 
 addPostTree ($a_tree_id, $a_node_id=-1, $a_date='')
 create a new post-tree More...
 
 insertPostNode ($a_node_id, $a_parent_id, $tree_id, $a_date='')
 insert node under parent node public More...
 
 getPostDepth ($a_node_id, $tree_id)
 Return depth of an object private. More...
 
 getFirstPostNode ($tree_id)
 get data of the first node from frm_posts_tree and frm_posts public More...
 
 getPostNode ($post_id)
 get data of given node from frm_posts_tree and frm_posts public More...
 
 fetchPostNodeData ($a_row)
 get data of parent node from frm_posts_tree and frm_posts private More...
 
 deletePostTree ($a_node)
 delete node and the whole subtree under this node public More...
 
 updateVisits ($ID)
 update page hits of given forum- or thread-ID public More...
 
 prepareText ($text, $edit=0, $quote_user='', $type='')
 prepares given string public More...
 
 __deletePostFiles ($a_ids)
 
 getImportName ()
 
 setImportName ($a_import_name)
 
 enableForumNotification ($user_id)
 Enable a user's notification about new posts in this forum. More...
 
 disableForumNotification ($user_id)
 Disable a user's notification about new posts in this forum. More...
 
 isForumNotificationEnabled ($user_id)
 Check whether a user's notification about new posts in this forum is enabled (result > 0) or not (result == 0) More...
 
 enableThreadNotification ($user_id, $thread_id)
 no usage? ..delete . More...
 
 isThreadNotificationEnabled ($user_id, $thread_id)
 Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (result == 0) More...
 

Static Public Member Functions

static _getLanguageInstanceByUsrId ($usr_id)
 Get the ilLanguage instance for the passed user id. More...
 
static _lookupPostMessage ($a_id)
 
static _getModerators ($a_ref_id)
 get all users assigned to local role il_frm_moderator_<frm_ref_id> (static) More...
 
static _isModerator ($a_ref_id, $a_usr_id)
 checks whether a user is moderator of a given forum object More...
 
static _getThreads ($a_obj_id, $a_sort_mode=self::SORT_DATE)
 Get thread infos of object. More...
 
static _lookupObjIdForForumId ($a_for_id)
 
static updateLastPostByObjId ($a_obj_id)
 
static mergeThreads ($obj_id, $source_id, $target_id)
 

Data Fields

const SORT_TITLE = 1
 
const SORT_DATE = 2
 
const DEFAULT_PAGE_HITS = 30
 
 $lng
 
 $error
 
 $db
 
 $user
 
 $settings
 

Static Protected Attributes

static $moderators_by_ref_id_map = array()
 

Private Member Functions

 setOrderField ($orderField)
 set database field for sorting results More...
 

Private Attributes

 $dbTable
 
 $className ="ilForum"
 
 $orderField
 
 $mdb2Query
 
 $mdb2DataValue
 
 $mdb2DataType
 
 $txtQuote1 = "[quote]"
 
 $txtQuote2 = "[/quote]"
 
 $replQuote1 = '<blockquote class="ilForumQuote">'
 
 $replQuote2 = '</blockquote>'
 
 $pageHits = self::DEFAULT_PAGE_HITS
 
 $id
 

Detailed Description

Class Forum core functions for forum.

Author
Wolfgang Merkens wmerk.nosp@m.ens@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilForum::__construct ( )

Constructor public.

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

References $DIC, settings(), and user().

79  {
80  global $DIC;
81 
82  $this->error = $DIC['ilErr'];
83  $this->lng = $DIC->language();
84  $this->db = $DIC->database();
85  $this->user = $DIC->user();
86  $this->settings = $DIC->settings();
87  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ __deletePostFiles()

ilForum::__deletePostFiles (   $a_ids)

Definition at line 1883 of file class.ilForum.php.

References $file, $files, and getForumId().

Referenced by deletePost().

1884  {
1885  if (!is_array($a_ids)) {
1886  return false;
1887  }
1888  include_once "./Modules/Forum/classes/class.ilFileDataForum.php";
1889 
1890  $tmp_file_obj = new ilFileDataForum($this->getForumId());
1891  foreach ($a_ids as $pos_id) {
1892  $tmp_file_obj->setPosId($pos_id);
1893  $files = $tmp_file_obj->getFilesOfPost();
1894  foreach ($files as $file) {
1895  $tmp_file_obj->unlinkFile($file["name"]);
1896  }
1897  }
1898  unset($tmp_file_obj);
1899  return true;
1900  }
$files
Definition: add-vimline.php:18
getForumId()
get forum id public
This class handles all operations on files for the forum object.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getLanguageInstanceByUsrId()

static ilForum::_getLanguageInstanceByUsrId (   $usr_id)
static

Get the ilLanguage instance for the passed user id.

Parameters
integer$usr_ida user id
Returns
ilLanguage public

Definition at line 105 of file class.ilForum.php.

References ilObjUser\_lookupLanguage(), and array.

106  {
107  static $lngCache = array();
108 
109  $languageShorthandle = ilObjUser::_lookupLanguage($usr_id);
110 
111  // lookup in cache array
112  if (!isset($lngCache[$languageShorthandle])) {
113  $lngCache[$languageShorthandle] = new ilLanguage($languageShorthandle);
114  $lngCache[$languageShorthandle]->loadLanguageModule('forum');
115  }
116 
117  return $lngCache[$languageShorthandle];
118  }
Create styles array
The data for the language used.
static _lookupLanguage($a_usr_id)
language handling
+ Here is the call graph for this function:

◆ _getModerators()

static ilForum::_getModerators (   $a_ref_id)
static

get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

Parameters
int$a_ref_idreference id
Returns
array user_ids public

Definition at line 1380 of file class.ilForum.php.

References $DIC, ilObject\_lookupTitle(), and array.

Referenced by ilForumNotification\checkParentNodeTree(), ilObjForumNotificationDataProvider\getPostActivationRecipients(), ilForumSettingsGUI\showMembers(), and ilForumSettingsGUI\updateUserNotifications().

1381  {
1382  global $DIC;
1383  $rbacreview = $DIC->rbac()->review();
1384 
1385  $role_arr = $rbacreview->getRolesOfRoleFolder($a_ref_id);
1386  foreach ($role_arr as $role_id) {
1387  if (ilObject::_lookupTitle($role_id) == 'il_frm_moderator_' . $a_ref_id) {
1388  return $rbacreview->assignedUsers($role_id);
1389  }
1390  }
1391 
1392  return array();
1393  }
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getThreads()

static ilForum::_getThreads (   $a_obj_id,
  $a_sort_mode = self::SORT_DATE 
)
static

Get thread infos of object.

Parameters
int$a_obj_id
int$a_sort_modeSORT_TITLE or SORT_DATE
Returns
array

Definition at line 2085 of file class.ilForum.php.

References $DIC, $ilDB, $res, $row, and array.

Referenced by ilObjForumGUI\cloneWizardPageObject(), and ilObjForumSearchResultTableGUI\parse().

2086  {
2087  global $DIC;
2088  $ilDB = $DIC->database();
2089 
2090  switch ($a_sort_mode) {
2091  case self::SORT_DATE:
2092  $sort = 'thr_date';
2093  break;
2094 
2095  case self::SORT_TITLE:
2096  default:
2097  $sort = 'thr_subject';
2098  break;
2099  }
2100 
2101  $res = $ilDB->queryf(
2102  '
2103  SELECT * FROM frm_threads
2104  JOIN frm_data ON top_pk = thr_top_fk
2105  WHERE top_frm_fk = %s
2106  ORDER BY %s',
2107  array('integer', 'text'),
2108  array($a_obj_id, $sort)
2109  );
2110 
2111  while ($row = $ilDB->fetchObject($res)) {
2112  $threads[$row->thr_pk] = $row->thr_subject;
2113  }
2114  return $threads ? $threads : array();
2115  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _isModerator()

static ilForum::_isModerator (   $a_ref_id,
  $a_usr_id 
)
static

checks whether a user is moderator of a given forum object

Parameters
int$a_ref_idreference id
int$a_usr_iduser id
Returns
bool public

Definition at line 1403 of file class.ilForum.php.

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

1404  {
1405  if (!self::$moderators_by_ref_id_map[$a_ref_id]) {
1406  self::$moderators_by_ref_id_map[$a_ref_id] = self::_getModerators($a_ref_id);
1407  }
1408  return in_array($a_usr_id, self::$moderators_by_ref_id_map[$a_ref_id]);
1409  }
+ Here is the caller graph for this function:

◆ _lookupObjIdForForumId()

static ilForum::_lookupObjIdForForumId (   $a_for_id)
static

Definition at line 2117 of file class.ilForum.php.

References $DIC, $ilDB, $res, and array.

Referenced by ilForumPostingDraftsBlockGUI\fillDataSection(), ilObjMediaObject\getParentObjectIdForUsage(), ilObjForumGUI\mergeThreadsObject(), and ilForumTopic\movePosts().

2118  {
2119  global $DIC;
2120  $ilDB = $DIC->database();
2121 
2122  $res = $ilDB->queryf(
2123  '
2124  SELECT top_frm_fk FROM frm_data
2125  WHERE top_pk = %s',
2126  array('integer'),
2127  array($a_for_id)
2128  );
2129 
2130  if ($fdata = $ilDB->fetchAssoc($res)) {
2131  return $fdata["top_frm_fk"];
2132  }
2133  return false;
2134  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupPostMessage()

static ilForum::_lookupPostMessage (   $a_id)
static

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

References $DIC, $ilDB, $res, $row, and array.

Referenced by ilObjForum\update().

393  {
394  global $DIC;
395  $ilDB = $DIC->database();
396 
397  $res = $ilDB->queryf(
398  '
399  SELECT * FROM frm_posts WHERE pos_pk = %s',
400  array('integer'),
401  array($a_id)
402  );
403 
404  while ($row = $ilDB->fetchObject($res)) {
405  return $row->pos_message;
406  }
407  return '';
408  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ addPostTree()

ilForum::addPostTree (   $a_tree_id,
  $a_node_id = -1,
  $a_date = '' 
)

create a new post-tree

Parameters
integera_tree_id: id where tree belongs to
integera_node_id: root node of tree (optional; default is tree_id itself)
Returns
boolean true on success public

Definition at line 1471 of file class.ilForum.php.

References array, and date.

Referenced by generatePost().

1472  {
1473  $a_date = $a_date ? $a_date : date("Y-m-d H:i:s");
1474 
1475  if ($a_node_id <= 0) {
1476  $a_node_id = $a_tree_id;
1477  }
1478 
1479  $nextId = $this->db->nextId('frm_posts_tree');
1480 
1481  $this->db->manipulateF(
1482  '
1483  INSERT INTO frm_posts_tree
1484  ( fpt_pk,
1485  thr_fk,
1486  pos_fk,
1487  parent_pos,
1488  lft,
1489  rgt,
1490  depth,
1491  fpt_date
1492  )
1493  VALUES(%s, %s, %s, %s, %s, %s, %s, %s )',
1494  array('integer','integer', 'integer', 'integer', 'integer', 'integer', 'integer', 'timestamp'),
1495  array($nextId, $a_tree_id, $a_node_id, '0', '1', '2', '1', $a_date)
1496  );
1497 
1498  return true;
1499  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ convertDate()

ilForum::convertDate (   $date)

converts the date format

Parameters
string$date
Returns
string formatted datetime public

Definition at line 1459 of file class.ilForum.php.

References ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

Referenced by getOnePost().

1460  {
1462  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
Date and time handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countActiveUserArticles()

ilForum::countActiveUserArticles (   $a_user_id)

Definition at line 1433 of file class.ilForum.php.

References $res, array, getForumId(), and user().

1434  {
1435  $res = $this->db->queryf(
1436  '
1437  SELECT * FROM frm_data
1438  INNER JOIN frm_posts ON pos_top_fk = top_pk
1439  WHERE top_frm_fk = %s
1440  AND (pos_status = %s
1441  OR (pos_status = %s
1442  AND pos_author_id = %s
1443  )
1444  )
1445  AND pos_author_id = %s',
1446  array('integer', 'integer', 'integer', 'integer', 'integer'),
1447  array($this->getForumId(),'1', '0', $this->user->getId(), $a_user_id)
1448  );
1449 
1450  return $res->numRows();
1451  }
user()
Definition: user.php:4
foreach($_POST as $key=> $value) $res
getForumId()
get forum id public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ countUserArticles()

ilForum::countUserArticles (   $a_user_id)

get number of articles from given user-ID

Parameters
integer$user,user-ID
Returns
integer public

Definition at line 1418 of file class.ilForum.php.

References $res, array, and getForumId().

1419  {
1420  $res = $this->db->queryf(
1421  '
1422  SELECT * FROM frm_data
1423  INNER JOIN frm_posts ON pos_top_fk = top_pk
1424  WHERE top_frm_fk = %s
1425  AND pos_author_id = %s',
1426  array('integer', 'integer'),
1427  array($this->getForumId(), $a_user_id)
1428  );
1429 
1430  return $res->numRows();
1431  }
foreach($_POST as $key=> $value) $res
getForumId()
get forum id public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ deletePost()

ilForum::deletePost (   $post)

delete post and sub-posts

Parameters
integer$post,ID public
Returns
integer 0 or thread-ID

Definition at line 782 of file class.ilForum.php.

References $GLOBALS, $i, $mobs, $post, __deletePostFiles(), ilObjForum\_deleteAccessEntries(), ilObjForum\_deleteReadEntries(), ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), array, deletePostTree(), ilNewsItem\getFirstNewsIdForContext(), getForumRefId(), and getPostNode().

783  {
784  include_once "./Modules/Forum/classes/class.ilObjForum.php";
785 
786  $p_node = $this->getPostNode($post);
787 
788  $GLOBALS['ilAppEventHandler']->raise(
789  'Modules/Forum',
790  'deletedPost',
791  array(
792  'ref_id' => $this->getForumRefId(),
793  'post' => new ilForumPost($post),
794  'thread_deleted' => ($p_node["parent"] == 0)? true : false
795  )
796  );
797 
798  // delete tree and get id's of all posts to delete
799  $del_id = $this->deletePostTree($p_node);
800 
801  // delete drafts_history
802  $obj_history = new ilForumDraftsHistory();
803  $obj_history->deleteHistoryByPostIds($del_id);
804  // delete all drafts
805  $obj_draft = new ilForumPostDraft();
806  $obj_draft->deleteDraftsByPostIds($del_id);
807 
808  // Delete User read entries
809  foreach ($del_id as $post_id) {
811  }
812 
813  // DELETE ATTACHMENTS ASSIGNED TO POST
814  $this->__deletePostFiles($del_id);
815 
816  $dead_pos = count($del_id);
817  $dead_thr = 0;
818 
819  // if deletePost is thread opener ...
820  if ($p_node["parent"] == 0) {
821  // delete thread access data
822  include_once './Modules/Forum/classes/class.ilObjForum.php';
823 
824  ilObjForum::_deleteAccessEntries($p_node['tree']);
825 
826  // delete thread
827  $dead_thr = $p_node["tree"];
828 
829  $this->db->manipulateF(
830  '
831  DELETE FROM frm_threads
832  WHERE thr_pk = %s',
833  array('integer'),
834  array($p_node['tree'])
835  );
836 
837  // update num_threads
838  $this->db->manipulateF(
839  '
840  UPDATE frm_data
841  SET top_num_threads = top_num_threads - 1
842  WHERE top_frm_fk = %s',
843  array('integer'),
844  array($this->id)
845  );
846 
847  // delete all related news
848  $posset = $this->db->queryf(
849  '
850  SELECT * FROM frm_posts
851  WHERE pos_thr_fk = %s',
852  array('integer'),
853  array($p_node['tree'])
854  );
855 
856  while ($posrec = $this->db->fetchAssoc($posset)) {
857  include_once("./Services/News/classes/class.ilNewsItem.php");
859  $this->id,
860  "frm",
861  $posrec["pos_pk"],
862  "pos"
863  );
864  if ($news_id > 0) {
865  $news_item = new ilNewsItem($news_id);
866  $news_item->delete();
867  }
868 
869  try {
870  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
871  $mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $posrec['pos_pk']);
872  foreach ($mobs as $mob) {
873  if (ilObjMediaObject::_exists($mob)) {
874  ilObjMediaObject::_removeUsage($mob, 'frm:html', $posrec['pos_pk']);
875  $mob_obj = new ilObjMediaObject($mob);
876  $mob_obj->delete();
877  }
878  }
879  } catch (Exception $e) {
880  }
881  }
882 
883  // delete all posts of this thread
884  $this->db->manipulateF(
885  '
886  DELETE FROM frm_posts
887  WHERE pos_thr_fk = %s',
888  array('integer'),
889  array($p_node['tree'])
890  );
891  } else {
892  // delete this post and its sub-posts
893  for ($i = 0; $i < $dead_pos; $i++) {
894  $this->db->manipulateF(
895  '
896  DELETE FROM frm_posts
897  WHERE pos_pk = %s',
898  array('integer'),
899  array($del_id[$i])
900  );
901 
902  // delete related news item
903  include_once("./Services/News/classes/class.ilNewsItem.php");
905  $this->id,
906  "frm",
907  $del_id[$i],
908  "pos"
909  );
910  if ($news_id > 0) {
911  $news_item = new ilNewsItem($news_id);
912  $news_item->delete();
913  }
914 
915  try {
916  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
917  $mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $del_id[$i]);
918  foreach ($mobs as $mob) {
919  if (ilObjMediaObject::_exists($mob)) {
920  ilObjMediaObject::_removeUsage($mob, 'frm:html', $del_id[$i]);
921  $mob_obj = new ilObjMediaObject($mob);
922  $mob_obj->delete();
923  }
924  }
925  } catch (Exception $e) {
926  }
927  }
928 
929  // update num_posts in frm_threads
930  $this->db->manipulateF(
931  '
932  UPDATE frm_threads
933  SET thr_num_posts = thr_num_posts - %s
934  WHERE thr_pk = %s',
935  array('integer', 'integer'),
936  array($dead_pos, $p_node['tree'])
937  );
938 
939  // get latest post of thread and update last_post
940  $res1 = $this->db->queryf(
941  '
942  SELECT * FROM frm_posts
943  WHERE pos_thr_fk = %s
944  ORDER BY pos_date DESC',
945  array('integer'),
946  array($p_node['tree'])
947  );
948 
949  if ($res1->numRows() == 0) {
950  $lastPost_thr = "";
951  } else {
952  $z = 0;
953 
954  while ($selData = $this->db->fetchAssoc($res1)) {
955  if ($z > 0) {
956  break;
957  }
958 
959  $lastPost_thr = $selData["pos_top_fk"] . "#" . $selData["pos_thr_fk"] . "#" . $selData["pos_pk"];
960  $z++;
961  }
962  }
963 
964  $this->db->manipulateF(
965  '
966  UPDATE frm_threads
967  SET thr_last_post = %s
968  WHERE thr_pk = %s',
969  array('text', 'integer'),
970  array($lastPost_thr, $p_node['tree'])
971  );
972  }
973 
974  // update num_posts in frm_data
975  $this->db->manipulateF(
976  '
977  UPDATE frm_data
978  SET top_num_posts = top_num_posts - %s
979  WHERE top_frm_fk = %s',
980  array('integer', 'integer'),
981  array($dead_pos, $this->id)
982  );
983 
984  // get latest post of forum and update last_post
985  $res2 = $this->db->queryf(
986  '
987  SELECT * FROM frm_posts, frm_data
988  WHERE pos_top_fk = top_pk
989  AND top_frm_fk = %s
990  ORDER BY pos_date DESC',
991  array('integer'),
992  array($this->id)
993  );
994 
995  if ($res2->numRows() == 0) {
996  $lastPost_top = "";
997  } else {
998  $z = 0;
999 
1000  while ($selData = $this->db->fetchAssoc($res2)) {
1001  if ($z > 0) {
1002  break;
1003  }
1004 
1005  $lastPost_top = $selData["pos_top_fk"] . "#" . $selData["pos_thr_fk"] . "#" . $selData["pos_pk"];
1006  $z++;
1007  }
1008  }
1009 
1010  $this->db->manipulateF(
1011  '
1012  UPDATE frm_data
1013  SET top_last_post = %s
1014  WHERE top_frm_fk = %s',
1015  array('text', 'integer'),
1016  array($lastPost_top, $this->id)
1017  );
1018 
1019  return $dead_thr;
1020  }
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
getForumRefId()
get forum ref_id public
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
Class ilForumDraftHistory.
static _deleteReadEntries($a_post_id)
__deletePostFiles($a_ids)
$mobs
$post
Definition: post.php:34
deletePostTree($a_node)
delete node and the whole subtree under this node public
Class ilObjMediaObject.
Create styles array
The data for the language used.
static _deleteAccessEntries($a_thread_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.
$i
Definition: disco.tpl.php:19
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
getPostNode($post_id)
get data of given node from frm_posts_tree and frm_posts public
+ Here is the call graph for this function:

◆ deletePostTree()

ilForum::deletePostTree (   $a_node)

delete node and the whole subtree under this node public

Parameters
arraynode_data of a node
Returns
array ID's of deleted posts

Definition at line 1704 of file class.ilForum.php.

References $res, $result, $row, and array.

Referenced by deletePost().

1705  {
1706  // GET LEFT AND RIGHT VALUES
1707  $res = $this->db->queryf(
1708  '
1709  SELECT * FROM frm_posts_tree
1710  WHERE thr_fk = %s
1711  AND pos_fk = %s
1712  AND parent_pos = %s',
1713  array('integer', 'integer', 'integer'),
1714  array($a_node['tree'], $a_node['pos_pk'], $a_node['parent'])
1715  );
1716 
1717  while ($row = $this->db->fetchObject($res)) {
1718  $a_node["lft"] = $row->lft;
1719  $a_node["rgt"] = $row->rgt;
1720  }
1721 
1722  $diff = $a_node["rgt"] - $a_node["lft"] + 1;
1723 
1724  // get data of posts
1725  $result = $this->db->queryf(
1726  '
1727  SELECT * FROM frm_posts_tree
1728  WHERE lft BETWEEN %s AND %s
1729  AND thr_fk = %s',
1730  array('integer', 'integer', 'integer'),
1731  array($a_node['lft'], $a_node['rgt'], $a_node['tree'])
1732  );
1733 
1734  $del_id = array();
1735 
1736  while ($treeData = $this->db->fetchAssoc($result)) {
1737  $del_id[] = $treeData["pos_fk"];
1738  }
1739 
1740  // delete subtree
1741  $this->db->manipulateF(
1742  '
1743  DELETE FROM frm_posts_tree
1744  WHERE lft BETWEEN %s AND %s
1745  AND thr_fk = %s',
1746  array('integer', 'integer', 'integer'),
1747  array($a_node['lft'], $a_node['rgt'], $a_node['tree'])
1748  );
1749 
1750  // close gaps
1751  $this->db->manipulateF(
1752  '
1753  UPDATE frm_posts_tree
1754  SET lft = CASE
1755  WHEN lft > %s
1756  THEN lft - %s
1757  ELSE lft
1758  END,
1759  rgt = CASE
1760  WHEN rgt > %s
1761  THEN rgt - %s
1762  ELSE rgt
1763  END
1764  WHERE thr_fk = %s',
1765  array('integer', 'integer', 'integer', 'integer', 'integer'),
1766  array($a_node['lft'], $diff, $a_node['lft'], $diff, $a_node['tree'])
1767  );
1768 
1769  return $del_id;
1770  }
$result
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ disableForumNotification()

ilForum::disableForumNotification (   $user_id)

Disable a user's notification about new posts in this forum.

Parameters
integeruser_id A user's ID
Returns
bool true private

Definition at line 1990 of file class.ilForum.php.

References array.

1991  {
1992  $this->db->manipulateF(
1993  '
1994  DELETE FROM frm_notification
1995  WHERE user_id = %s
1996  AND frm_id = %s',
1997  array('integer', 'integer'),
1998  array($user_id, $this->id)
1999  );
2000 
2001  return true;
2002  }
Create styles array
The data for the language used.

◆ enableForumNotification()

ilForum::enableForumNotification (   $user_id)

Enable a user's notification about new posts in this forum.

Parameters
integeruser_id A user's ID
Returns
bool true private

Definition at line 1917 of file class.ilForum.php.

References $counter, $query, $res, $row, array, and isForumNotificationEnabled().

1918  {
1919  if (!$this->isForumNotificationEnabled($user_id)) {
1920  /* Remove all notifications of threads that belong to the forum */
1921 
1922  $res = $this->db->queryf(
1923  '
1924  SELECT frm_notification.thread_id FROM frm_data, frm_notification, frm_threads
1925  WHERE frm_notification.user_id = %s
1926  AND frm_notification.thread_id = frm_threads.thr_pk
1927  AND frm_threads.thr_top_fk = frm_data.top_pk
1928  AND frm_data.top_frm_fk = %s
1929  GROUP BY frm_notification.thread_id',
1930  array('integer', 'integer'),
1931  array($user_id, $this->id)
1932  );
1933 
1934  if (is_object($res) && $res->numRows() > 0) {
1935  $thread_data = array();
1936  $thread_data_types = array();
1937 
1938  $query = ' DELETE FROM frm_notification
1939  WHERE user_id = %s
1940  AND thread_id IN (';
1941 
1942  array_push($thread_data, $user_id);
1943  array_push($thread_data_types, 'integer');
1944 
1945  $counter = 1;
1946 
1947  while ($row = $this->db->fetchAssoc($res)) {
1948  if ($counter < $res->numRows()) {
1949  $query .= '%s, ';
1950  array_push($thread_data, $row['thread_id']);
1951  array_push($thread_data_types, 'integer');
1952  }
1953 
1954  if ($counter == $res->numRows()) {
1955  $query .= '%s)';
1956  array_push($thread_data, $row['thread_id']);
1957  array_push($thread_data_types, 'integer');
1958  }
1959  $counter++;
1960  }
1961 
1962  $this->db->manipulateF($query, $thread_data_types, $thread_data);
1963  }
1964 
1965  /* Insert forum notification */
1966 
1967  $nextId = $this->db->nextId('frm_notification');
1968 
1969  $this->db->manipulateF(
1970  '
1971  INSERT INTO frm_notification
1972  ( notification_id,
1973  user_id,
1974  frm_id
1975  )
1976  VALUES(%s, %s, %s)',
1977  array('integer','integer', 'integer'),
1978  array($nextId, $user_id, $this->id)
1979  );
1980  }
1981  return true;
1982  }
$counter
foreach($_POST as $key=> $value) $res
$query
isForumNotificationEnabled($user_id)
Check whether a user&#39;s notification about new posts in this forum is enabled (result > 0) or not (res...
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ enableThreadNotification()

ilForum::enableThreadNotification (   $user_id,
  $thread_id 
)

no usage? ..delete .

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

Parameters
integeruser_id A user's ID
integerthread_id ID of the thread
Returns
bool true private

Definition at line 2034 of file class.ilForum.php.

References array, and isThreadNotificationEnabled().

2035  {
2036  if (!$this->isThreadNotificationEnabled($user_id, $thread_id)) {
2037  $nextId = $this->db->nextId('frm_notification');
2038  $this->db->manipulateF(
2039  '
2040  INSERT INTO frm_notification
2041  ( notification_id,
2042  user_id,
2043  thread_id
2044  )
2045  VALUES (%s, %s, %s)',
2046  array('integer', 'integer', 'integer'),
2047  array($nextId, $user_id, $thread_id)
2048  );
2049  }
2050 
2051  return true;
2052  }
Create styles array
The data for the language used.
isThreadNotificationEnabled($user_id, $thread_id)
Check whether a user&#39;s notification about new posts in a thread is enabled (result > 0) or not (resul...
+ Here is the call graph for this function:

◆ fetchPostNodeData()

ilForum::fetchPostNodeData (   $a_row)

get data of parent node from frm_posts_tree and frm_posts private

Parameters
objectdb db result object containing node_data
Returns
array 2-dim (int/str) node_data

Definition at line 1655 of file class.ilForum.php.

References $data, ilObject\_exists(), and array.

Referenced by getFirstPostNode(), and getPostNode().

1656  {
1657  require_once('./Services/User/classes/class.ilObjUser.php');
1658 
1659  if (ilObject::_exists($a_row->pos_display_user_id)) {
1660  $tmp_user = new ilObjUser($a_row->pos_display_user_id);
1661  $fullname = $tmp_user->getFullname();
1662  $loginname = $tmp_user->getLogin();
1663  }
1664 
1665  $fullname = $fullname ? $fullname : ($a_row->import_name ? $a_row->import_name : $this->lng->txt("unknown"));
1666 
1667  $data = array(
1668  "pos_pk" => $a_row->pos_pk,
1669  "child" => $a_row->pos_pk,
1670  "author" => $a_row->pos_display_user_id,
1671  "alias" => $a_row->pos_usr_alias,
1672  "title" => $fullname,
1673  "loginname" => $loginname,
1674  "type" => "post",
1675  "message" => $a_row->pos_message,
1676  "subject" => $a_row->pos_subject,
1677  "pos_cens_com" => $a_row->pos_cens_com,
1678  "pos_cens" => $a_row->pos_cens,
1679  // "date" => $a_row->date,
1680  "date" => $a_row->fpt_date,
1681  "create_date" => $a_row->pos_date,
1682  "update" => $a_row->pos_update,
1683  "update_user" => $a_row->update_user,
1684  "tree" => $a_row->thr_fk,
1685  "parent" => $a_row->parent_pos,
1686  "lft" => $a_row->lft,
1687  "rgt" => $a_row->rgt,
1688  "depth" => $a_row->depth,
1689  "id" => $a_row->fpt_pk,
1690  "notify" => $a_row->notify,
1691  "import_name" => $a_row->import_name,
1692  "pos_status" => $a_row->pos_status
1693  );
1694 
1695  return $data ? $data : array();
1696  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generatePost()

ilForum::generatePost (   $forum_id,
  $thread_id,
  $author_id,
  $display_user_id,
  $message,
  $parent_pos,
  $notify,
  $subject = '',
  $alias = '',
  $date = '',
  $status = 1,
  $send_activation_mail = 0 
)

generate new dataset in frm_posts

Parameters
int$forum_id
int$thread_id
int$author_id
int$display_user_id
string$message
int$parent_pos
int$notify
string$subject
string$alias
string$datedatetime|timestamp
int$status
int$send_activation_mail
Returns
int new post_id

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

References $message, ilRTE\_replaceMediaObjectImageSrc(), addPostTree(), array, date, getForumId(), getForumRefId(), getImportName(), ilForumProperties\getInstance(), ilObjectFactory\getInstanceByRefId(), insertPostNode(), NEWS_NOTICE, NEWS_USERS, and prepareText().

Referenced by generateThread().

427  {
428  $objNewPost = new ilForumPost();
429  $objNewPost->setForumId($forum_id);
430  $objNewPost->setThreadId($thread_id);
431  $objNewPost->setSubject($subject);
432  $objNewPost->setMessage($message);
433  $objNewPost->setDisplayUserId($display_user_id);
434  $objNewPost->setUserAlias($alias);
435  $objNewPost->setPosAuthorId($author_id);
436 
437  $frm_settings = ilForumProperties::getInstance($this->getForumId());
438 
439  if ($frm_settings->getMarkModeratorPosts() == 1) {
440  self::_isModerator($this->getForumRefId(), $author_id) ? $is_moderator = true : $is_moderator = false;
441  } else {
442  $is_moderator = false;
443  }
444  $objNewPost->setIsAuthorModerator($is_moderator);
445 
446  if ($date == "") {
447  $objNewPost->setCreateDate(date("Y-m-d H:i:s"));
448  } else {
449  if (strpos($date, "-") > 0) { // in mysql format
450  $objNewPost->setCreateDate($date);
451  } else { // a timestamp
452  $objNewPost->setCreateDate(date("Y-m-d H:i:s", $date));
453  }
454  }
455  if ($status == 1) {
456  $objNewPost->setPostActivationDate($objNewPost->getCreateDate());
457  }
458 
459  $objNewPost->setImportName($this->getImportName());
460  $objNewPost->setNotification($notify);
461  $objNewPost->setStatus($status);
462  $objNewPost->insert();
463 
464  // entry in tree-table
465  if ($parent_pos == 0) {
466  $this->addPostTree($objNewPost->getThreadId(), $objNewPost->getId(), $objNewPost->getCreateDate());
467  } else {
468  $this->insertPostNode($objNewPost->getId(), $parent_pos, $objNewPost->getThreadId(), $objNewPost->getCreateDate());
469  }
470 
471  // string last post
472  $lastPost = $objNewPost->getForumId() . "#" . $objNewPost->getThreadId() . "#" . $objNewPost->getId();
473 
474  // update thread
475  $this->db->manipulateF(
476  '
477  UPDATE frm_threads
478  SET thr_num_posts = thr_num_posts + 1,
479  thr_last_post = %s
480  WHERE thr_pk = %s',
481  array('text', 'integer'),
482  array($lastPost, $objNewPost->getThreadId())
483  );
484 
485  // update forum
486  $this->db->manipulateF(
487  '
488  UPDATE frm_data
489  SET top_num_posts = top_num_posts + 1,
490  top_last_post = %s
491  WHERE top_pk = %s',
492  array('text', 'integer'),
493  array($lastPost, $objNewPost->getForumId())
494  );
495 
496  // MARK READ
497  $forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId());
498  $forum_obj->markPostRead($objNewPost->getPosAuthorId(), $objNewPost->getThreadId(), $objNewPost->getId());
499 
500  // Add Notification to news
501  if ($status) {
502  require_once 'Services/RTE/classes/class.ilRTE.php';
503  include_once("./Services/News/classes/class.ilNewsItem.php");
504  $news_item = new ilNewsItem();
505  $news_item->setContext($forum_obj->getId(), 'frm', $objNewPost->getId(), 'pos');
506  $news_item->setPriority(NEWS_NOTICE);
507  $news_item->setTitle($objNewPost->getSubject());
508  $news_item->setContent(ilRTE::_replaceMediaObjectImageSrc($this->prepareText($objNewPost->getMessage(), 0), 1));
509  if ($objNewPost->getMessage() != strip_tags($objNewPost->getMessage())) {
510  $news_item->setContentHtml(true);
511  }
512 
513  $news_item->setUserId($display_user_id);
514  $news_item->setVisibility(NEWS_USERS);
515  $news_item->create();
516  }
517 
518  return $objNewPost->getId();
519  }
getForumRefId()
get forum ref_id public
insertPostNode($a_node_id, $a_parent_id, $tree_id, $a_date='')
insert node under parent node public
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static getInstance($a_obj_id=0)
catch(Exception $e) $message
prepareText($text, $edit=0, $quote_user='', $type='')
prepares given string public
const NEWS_NOTICE
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
getForumId()
get forum id public
Create styles array
The data for the language used.
addPostTree($a_tree_id, $a_node_id=-1, $a_date='')
create a new post-tree
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
const NEWS_USERS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateThread()

ilForum::generateThread ( ilForumTopic  $thread,
  $message,
  $notify,
  $notify_posts,
  $status = 1 
)
Parameters
ilForumTopic$thread
string$message
int$notify
int$notify_posts
int$status
Returns
int The id of the new posting, created implicitly when creating new threads

Definition at line 529 of file class.ilForum.php.

References $message, array, date, ilForumTopic\enableNotification(), generatePost(), ilForumTopic\getCreateDate(), ilForumTopic\getDisplayUserId(), ilForumTopic\getForumId(), ilForumTopic\getId(), getImportName(), ilForumTopic\getSubject(), ilForumTopic\getThrAuthorId(), ilForumTopic\getUserAlias(), ilForumTopic\insert(), ilForumTopic\setCreateDate(), and ilForumTopic\setImportName().

530  {
531  if (!$thread->getCreateDate()) {
532  $thread->setCreateDate(date('Y-m-d H:i:s'));
533  }
534 
535  $thread->setImportName($this->getImportName());
536  $thread->insert();
537 
538  if ($notify_posts == 1) {
539  $thread->enableNotification($thread->getThrAuthorId());
540  }
541 
542  $this->db->manipulateF(
543  '
544  UPDATE frm_data
545  SET top_num_threads = top_num_threads + 1
546  WHERE top_pk = %s',
547  array('integer'),
548  array($thread->getForumId())
549  );
550 
551  return $this->generatePost(
552  $thread->getForumId(),
553  $thread->getId(),
554  $thread->getThrAuthorId(),
555  $thread->getDisplayUserId(),
556  $message,
557  0,
558  $notify,
559  $thread->getSubject(),
560  $thread->getUserAlias(),
561  $thread->getCreateDate(),
562  $status,
563  0
564  );
565  }
insert()
Inserts the object data into database.
setCreateDate($a_createdate)
catch(Exception $e) $message
generatePost($forum_id, $thread_id, $author_id, $display_user_id, $message, $parent_pos, $notify, $subject='', $alias='', $date='', $status=1, $send_activation_mail=0)
generate new dataset in frm_posts
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
enableNotification($a_user_id)
Enable a user&#39;s notification about new posts in a thread.
setImportName($a_import_name)
+ Here is the call graph for this function:

◆ getAllThreads()

ilForum::getAllThreads (   $a_topic_id,
array  $params = array(),
  $limit = 0,
  $offset = 0 
)
Parameters
$a_topic_id
array$params
int$limit
int$offset
Returns
array

Definition at line 1029 of file class.ilForum.php.

References $data, $params, $query, $res, $row, array, date, ilForumProperties\FORUM_OVERVIEW_WITH_NEW_POSTS, getForumId(), ilForumProperties\getInstance(), settings(), and user().

1030  {
1031  $frm_overview_setting = (int) $this->settings->get('forum_overview');
1032  $frm_props = ilForumProperties::getInstance($this->getForumId());
1033  $is_post_activation_enabled = $frm_props->isPostActivationEnabled();
1034 
1035  $user_id = $this->user->getId();
1036 
1037  $excluded_ids_condition = '';
1038  if (isset($params['excluded_ids']) && is_array($params['excluded_ids']) && $params['excluded_ids']) {
1039  $excluded_ids_condition = ' AND ' . $this->db->in('thr_pk', $params['excluded_ids'], true, 'integer') . ' ';
1040  }
1041 
1042  if (!in_array(strtolower($params['order_column']), array('lp_date', 'rating', 'thr_subject', 'num_posts', 'num_visit'))) {
1043  $params['order_column'] = 'post_date';
1044  }
1045  if (!in_array(strtolower($params['order_direction']), array('asc', 'desc'))) {
1046  $params['order_direction'] = 'desc';
1047  }
1048 
1049  $cnt_active_pos_query = '';
1050  $cnt_join_type = 'LEFT';
1051  if ($is_post_activation_enabled && !$params['is_moderator']) {
1052  $cnt_active_pos_query = " AND (pos_status = {$this->db->quote(1, 'integer')} OR pos_author_id = {$this->db->quote($user_id, 'integer')}) ";
1053  $cnt_join_type = "INNER";
1054  }
1055  $query =
1056  "SELECT COUNT(DISTINCT(thr_pk)) cnt
1057  FROM frm_threads
1058  {$cnt_join_type} JOIN frm_posts
1059  ON pos_thr_fk = thr_pk {$cnt_active_pos_query}
1060  WHERE thr_top_fk = %s {$excluded_ids_condition}
1061  ";
1062  $res = $this->db->queryF($query, array('integer'), array($a_topic_id));
1063  $cntData = $this->db->fetchAssoc($res);
1064  $cnt = (int) $cntData['cnt'];
1065 
1066  $active_query = '';
1067  $active_inner_query = '';
1068  $having = '';
1069  if ($is_post_activation_enabled && !$params['is_moderator']) {
1070  $active_query = ' AND (pos_status = %s OR pos_author_id = %s) ';
1071  $active_inner_query = ' AND (ipos.pos_status = %s OR ipos.pos_author_id = %s) ';
1072  $having = ' HAVING num_posts > 0';
1073  }
1074 
1075  $threads = array();
1076  $data = array();
1077  $data_types = array();
1078 
1079  $optional_fields = '';
1080  if ($frm_props->isIsThreadRatingEnabled()) {
1081  $optional_fields = ',avg_rating';
1082  }
1083  if ($frm_props->getThreadSorting() == 1) {
1084  $optional_fields = ',thread_sorting';
1085  }
1086 
1087  $additional_sort = '';
1088  if ($frm_props->getThreadSorting()) {
1089  $additional_sort .= ' , thread_sorting ASC ';
1090  }
1091 
1092  if ($params['order_column'] == 'thr_subject') {
1093  $dynamic_columns = array(', thr_subject ' . $params['order_direction']);
1094  } elseif ($params['order_column'] == 'num_posts') {
1095  $dynamic_columns = array(', thr_num_posts ' . $params['order_direction']);
1096  } elseif ($params['order_column'] == 'num_visit') {
1097  $dynamic_columns = array(', visits ' . $params['order_direction']);
1098  } else {
1099  $dynamic_columns = array(', post_date ' . $params['order_direction']);
1100  }
1101 
1102  if ($frm_props->isIsThreadRatingEnabled()) {
1103  $dynamic_columns[] = ' ,avg_rating ' . $params['order_direction'];
1104  }
1105  if ('rating' == strtolower($params['order_column'])) {
1106  $dynamic_columns = array_reverse($dynamic_columns);
1107  }
1108  $additional_sort .= implode(' ', $dynamic_columns);
1109 
1110  if (!$this->user->isAnonymous()) {
1111  $query = "SELECT
1112  (CASE WHEN COUNT(DISTINCT(notification_id)) > 0 THEN 1 ELSE 0 END) usr_notification_is_enabled,
1113  MAX(pos_date) post_date,
1114  COUNT(DISTINCT(pos_pk)) num_posts,
1115  COUNT(DISTINCT(pos_pk)) - COUNT(DISTINCT(postread.post_id)) num_unread_posts, ";
1116 
1117  // new posts query
1118  if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
1119  $query .= "
1120  (SELECT COUNT(DISTINCT(ipos.pos_pk))
1121  FROM frm_posts ipos
1122  LEFT JOIN frm_user_read iread ON iread.post_id = ipos.pos_pk AND iread.usr_id = %s
1123  LEFT JOIN frm_thread_access iacc ON (iacc.thread_id = ipos.pos_thr_fk AND iacc.usr_id = %s)
1124  WHERE ipos.pos_thr_fk = thr_pk
1125 
1126  AND (ipos.pos_update > iacc.access_old_ts
1127  OR
1128  (iacc.access_old IS NULL AND (ipos.pos_update > " . $this->db->quote(date('Y-m-d H:i:s', NEW_DEADLINE), 'timestamp') . "))
1129  )
1130 
1131  AND ipos.pos_author_id != %s
1132  AND iread.usr_id IS NULL $active_inner_query
1133  ) num_new_posts, ";
1134  }
1135 
1136  $query .= " thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed
1137  {$optional_fields}
1138  FROM frm_threads
1139 
1140  LEFT JOIN frm_notification
1141  ON frm_notification.thread_id = thr_pk
1142  AND frm_notification.user_id = %s
1143 
1144  LEFT JOIN frm_posts
1145  ON pos_thr_fk = thr_pk $active_query
1146 
1147  LEFT JOIN frm_user_read postread
1148  ON postread.post_id = pos_pk
1149  AND postread.usr_id = %s";
1150 
1151  $query .= " WHERE thr_top_fk = %s
1152  {$excluded_ids_condition}
1153  GROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed
1154  {$optional_fields}
1155  {$having}
1156  ORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
1157 
1158 
1159  // data_types for new posts query and $active_inner_query
1160  if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
1161  $data_types[] = 'integer';
1162  $data_types[] = 'integer';
1163  $data_types[] = 'integer';
1164  if ($is_post_activation_enabled && !$params['is_moderator']) {
1165  array_push($data_types, 'integer', 'integer');
1166  }
1167  }
1168  $data_types[] = 'integer';
1169  if ($is_post_activation_enabled && !$params['is_moderator']) {
1170  array_push($data_types, 'integer', 'integer');
1171  }
1172  $data_types[] = 'integer';
1173  $data_types[] = 'integer';
1174 
1175  // data_values for new posts query and $active_inner_query
1176  if ($frm_overview_setting == ilForumProperties::FORUM_OVERVIEW_WITH_NEW_POSTS) {
1177  $data[] = $user_id;
1178  $data[] = $user_id;
1179  $data[] = $user_id;
1180  if ($is_post_activation_enabled && !$params['is_moderator']) {
1181  array_push($data, '1', $user_id);
1182  }
1183  }
1184  $data[] = $user_id;
1185  if ($is_post_activation_enabled && !$params['is_moderator']) {
1186  array_push($data, '1', $user_id);
1187  }
1188  $data[] = $user_id;
1189  $data[] = $a_topic_id;
1190  } else {
1191  $query = "SELECT
1192  0 usr_notification_is_enabled,
1193  MAX(pos_date) post_date,
1194  COUNT(DISTINCT(pos_pk)) num_posts,
1195  COUNT(DISTINCT(pos_pk)) num_unread_posts,
1196  COUNT(DISTINCT(pos_pk)) num_new_posts,
1197  thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed
1198  {$optional_fields}
1199  FROM frm_threads
1200 
1201  LEFT JOIN frm_posts
1202  ON pos_thr_fk = thr_pk $active_query";
1203 
1204  $query .= " WHERE thr_top_fk = %s
1205  {$excluded_ids_condition}
1206  GROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed
1207  {$optional_fields}
1208  {$having}
1209  ORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
1210 
1211  if ($is_post_activation_enabled && !$params['is_moderator']) {
1212  array_push($data_types, 'integer', 'integer');
1213  }
1214  $data_types[] = 'integer';
1215  if ($is_post_activation_enabled && !$params['is_moderator']) {
1216  array_push($data, '1', $user_id);
1217  }
1218  $data[] = $a_topic_id;
1219  }
1220 
1221  if ($limit || $offset) {
1222  $this->db->setLimit($limit, $offset);
1223  }
1224  $res = $this->db->queryF($query, $data_types, $data);
1225 
1226  $threadIds = [];
1227  while ($row = $this->db->fetchAssoc($res)) {
1228  $thread = new ilForumTopic($row['thr_pk'], $params['is_moderator'], true);
1229  $thread->assignData($row);
1230  $threads[$row['thr_pk']] = $thread;
1231 
1232  $threadIds[] = $row['thr_pk'];
1233  }
1234 
1235  $inner_last_active_post_condition = '';
1236  if ($params['is_moderator'] == false) {
1237  $inner_last_active_post_condition = "
1238  AND ( iposts.pos_status = " . $this->db->quote(1, 'integer') . "
1239  OR ( iposts.pos_status = " . $this->db->quote(0, 'integer') . "
1240  AND iposts.pos_author_id = " . $this->db->quote($this->user->getId(), 'integer') . "))";
1241  }
1242 
1243  $post_res = $this->db->query(
1244  '
1245  SELECT frm_posts.*
1246  FROM frm_posts
1247  INNER JOIN (
1248  SELECT pos_thr_fk, MAX(iposts.pos_date) i_pos_date
1249  FROM frm_posts iposts
1250  WHERE ' . $this->db->in('iposts.pos_thr_fk', $threadIds, false, 'integer') . '
1251  ' . $inner_last_active_post_condition . '
1252  GROUP BY pos_thr_fk
1253  ) opost ON frm_posts.pos_thr_fk = opost.pos_thr_fk AND frm_posts.pos_date = opost.i_pos_date'
1254  );
1255 
1256  while ($post_row = $this->db->fetchAssoc($post_res)) {
1257  $tmp_obj = new ilForumPost($post_row['pos_pk'], $params['is_moderator'], true);
1258 
1259  $tmp_obj->setPosAuthorId($post_row['pos_author_id']);
1260  $tmp_obj->setDisplayUserId($post_row['pos_display_user_id']);
1261  $tmp_obj->setUserAlias($post_row['pos_usr_alias']);
1262  $tmp_obj->setImportName($post_row['import_name']);
1263  $tmp_obj->setId($post_row['pos_pk']);
1264  $tmp_obj->setCreateDate($post_row['pos_date']);
1265 
1266  $threads[$post_row['pos_thr_fk']]->setLastPostForThreadOverview($tmp_obj);
1267  }
1268 
1269  return array('items' => $threads,'cnt' => $cnt);
1270  }
$params
Definition: disable.php:11
user()
Definition: user.php:4
static getInstance($a_obj_id=0)
foreach($_POST as $key=> $value) $res
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$query
getForumId()
get forum id public
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getDbTable()

ilForum::getDbTable ( )

get name of database table

Returns
string name of database table
See also
$dbTable User interface

Definition at line 217 of file class.ilForum.php.

References $dbTable.

218  {
219  return $this->dbTable;
220  }

◆ getFirstPostByThread()

ilForum::getFirstPostByThread (   $a_thread_id)

Get first post of thread.

public

Parameters
intthread id
Returns

Definition at line 1346 of file class.ilForum.php.

References $res, $row, and array.

1347  {
1348  $res = $this->db->queryf(
1349  '
1350  SELECT * FROM frm_posts_tree
1351  WHERE thr_fk = %s
1352  AND parent_pos = %s',
1353  array('integer', 'integer'),
1354  array($a_thread_id, '0')
1355  );
1356 
1357  $row = $this->db->fetchObject($res);
1358 
1359  return $row->pos_fk ? $row->pos_fk : 0;
1360  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.

◆ getFirstPostNode()

ilForum::getFirstPostNode (   $tree_id)

get data of the first node from frm_posts_tree and frm_posts public

Parameters
integertree id
Returns
object db result object

Definition at line 1610 of file class.ilForum.php.

References $res, $row, array, and fetchPostNodeData().

1611  {
1612  $res = $this->db->queryf(
1613  '
1614  SELECT * FROM frm_posts, frm_posts_tree
1615  WHERE pos_pk = pos_fk
1616  AND parent_pos = %s
1617  AND thr_fk = %s',
1618  array('integer', 'integer'),
1619  array('0', $tree_id)
1620  );
1621 
1622  $row = $this->db->fetchObject($res);
1623 
1624  return $this->fetchPostNodeData($row);
1625  }
fetchPostNodeData($a_row)
get data of parent node from frm_posts_tree and frm_posts private
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getForumId()

ilForum::getForumId ( )

get forum id public

Returns
integer object id of forum

Definition at line 155 of file class.ilForum.php.

References $id.

Referenced by __deletePostFiles(), countActiveUserArticles(), countUserArticles(), generatePost(), getAllThreads(), and getUserStatistic().

156  {
157  return $this->id;
158  }
+ Here is the caller graph for this function:

◆ getForumRefId()

ilForum::getForumRefId ( )

get forum ref_id public

Returns
integer reference id of forum

Definition at line 165 of file class.ilForum.php.

Referenced by deletePost(), generatePost(), getModerators(), and postCensorship().

166  {
167  return $this->ref_id;
168  }
+ Here is the caller graph for this function:

◆ getImportName()

ilForum::getImportName ( )

Definition at line 1902 of file class.ilForum.php.

Referenced by generatePost(), and generateThread().

1903  {
1904  return $this->import_name;
1905  }
+ Here is the caller graph for this function:

◆ getMDB2DataType()

ilForum::getMDB2DataType ( )

get content of additional condition

Returns
array

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

References $mdb2DataType.

Referenced by getOneThread(), getOneTopic(), and updateVisits().

266  {
267  if ($this->mdb2DataType != '') {
268  return $this->mdb2DataType;
269  }
270  }
+ Here is the caller graph for this function:

◆ getMDB2DataValue()

ilForum::getMDB2DataValue ( )

get content of additional condition

Returns
array

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

References $mdb2DataValue.

Referenced by getOneThread(), getOneTopic(), and updateVisits().

255  {
256  if ($this->mdb2DataValue != '') {
257  return $this->mdb2DataValue;
258  }
259  }
+ Here is the caller graph for this function:

◆ getMDB2Query()

ilForum::getMDB2Query ( )

get content of additional condition

Returns
string

Definition at line 243 of file class.ilForum.php.

References $mdb2Query.

Referenced by getOneThread(), getOneTopic(), and updateVisits().

244  {
245  if ($this->mdb2Query != '') {
246  return $this->mdb2Query;
247  }
248  }
+ Here is the caller graph for this function:

◆ getModerators()

ilForum::getModerators ( )

get all users assigned to local role il_frm_moderator_<frm_ref_id>

Returns
array user_ids public

Definition at line 1368 of file class.ilForum.php.

References getForumRefId().

1369  {
1370  return self::_getModerators($this->getForumRefId());
1371  }
getForumRefId()
get forum ref_id public
+ Here is the call graph for this function:

◆ getOnePost()

ilForum::getOnePost (   $post)

get one post-dataset

Parameters
integerpost id
Returns
array result dataset of the post public

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

References $post, $res, $row, array, and convertDate().

374  {
375  $res = $this->db->queryf(
376  '
377  SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data
378  WHERE pos_pk = %s
379  AND pos_display_user_id = usr_id',
380  array('integer'),
381  array($post)
382  );
383 
384  $row = $this->db->fetchAssoc($res);
385 
386  $row["pos_date"] = $this->convertDate($row["pos_date"]);
387  $row["pos_message"] = nl2br($row["pos_message"]);
388 
389  return $row;
390  }
foreach($_POST as $key=> $value) $res
$post
Definition: post.php:34
convertDate($date)
converts the date format
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getOneThread()

ilForum::getOneThread ( )

get one thread-dataset by WhereCondition

Returns
array $result dataset of the thread public

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

References $query, $result, array, getMDB2DataType(), getMDB2DataValue(), and getMDB2Query().

348  {
349  $data_type = array();
350  $data_value = array();
351 
352  $query = 'SELECT * FROM frm_threads WHERE ';
353 
354  if ($this->getMDB2Query() != '' && $this->getMDB2DataType() != '' && $this->getMDB2DataValue() != '') {
355  $query .= $this->getMDB2Query();
356  $data_type = $data_type + $this->getMDB2DataType();
357  $data_value = $data_value + $this->getMDB2DataValue();
358 
359  $sql_res = $this->db->queryf($query, $data_type, $data_value);
360  $result = $this->db->fetchAssoc($sql_res);
361  $result["thr_subject"] = trim($result["thr_subject"]);
362  }
363 
364  return $result;
365  }
$result
getMDB2DataType()
get content of additional condition
$query
Create styles array
The data for the language used.
getMDB2Query()
get content of additional condition
getMDB2DataValue()
get content of additional condition
+ Here is the call graph for this function:

◆ getOneTopic()

ilForum::getOneTopic ( )

get one topic-dataset by WhereCondition

Returns
array $result dataset of the topic public

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

References $query, $res, $row, array, getMDB2DataType(), getMDB2DataValue(), and getMDB2Query().

Referenced by moveThreads().

303  {
304  $data_type = array();
305  $data_value = array();
306 
307  $query = 'SELECT * FROM frm_data WHERE ';
308 
309  if ($this->getMDB2Query() != '' && $this->getMDB2DataType() != '' && $this->getMDB2DataValue() != '') {
310  $query .= '' . $this->getMDB2Query() . '';
311  $data_type = $data_type + $this->getMDB2DataType();
312  $data_value = $data_value + $this->getMDB2DataValue();
313 
314  $res = $this->db->queryf($query, $data_type, $data_value);
315  $row = $this->db->fetchAssoc($res);
316 
317  if (is_null($row)) {
318  return null;
319  }
320 
321  $row["top_name"] = trim($row["top_name"]);
322  $row["top_description"] = nl2br($row["top_description"]);
323 
324  return $row;
325  } else {
326  $query .= '1 = 1';
327 
328  $res = $this->db->query($query);
329  $row = $this->db->fetchAssoc($res);
330 
331  if (!is_array($row) || !count($row)) {
332  return null;
333  }
334 
335  $row['top_name'] = trim($row['top_name']);
336  $row['top_description'] = nl2br($row['top_description']);
337 
338  return $row;
339  }
340  }
getMDB2DataType()
get content of additional condition
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
getMDB2Query()
get content of additional condition
getMDB2DataValue()
get content of additional condition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderField()

ilForum::getOrderField ( )

get name of orderField

Returns
string name of orderField
See also
$orderField User interface

Definition at line 191 of file class.ilForum.php.

References $orderField.

192  {
193  return $this->orderField;
194  }

◆ getPageHits()

ilForum::getPageHits ( )

get number of max.

visible datasets

Returns
integer $pageHits
See also
$pageHits User interface

Definition at line 292 of file class.ilForum.php.

References $pageHits.

293  {
294  return $this->pageHits;
295  }

◆ getPostDepth()

ilForum::getPostDepth (   $a_node_id,
  $tree_id 
)

Return depth of an object private.

Parameters
integernode_id of parent's node_id
integernode_id of parent's node parent_id
Returns
integer depth of node

Definition at line 1584 of file class.ilForum.php.

References $res, and array.

Referenced by insertPostNode().

1585  {
1586  if ($tree_id) {
1587  $sql_res = $this->db->queryf(
1588  '
1589  SELECT depth FROM frm_posts_tree
1590  WHERE pos_fk = %s
1591  AND thr_fk = %s',
1592  array('integer', 'integer'),
1593  array($a_node_id, $tree_id)
1594  );
1595 
1596  $res = $this->db->fetchObject($sql_res);
1597 
1598  return $res->depth;
1599  } else {
1600  return 0;
1601  }
1602  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getPostNode()

ilForum::getPostNode (   $post_id)

get data of given node from frm_posts_tree and frm_posts public

Parameters
integerpost_id
Returns
object db result object

Definition at line 1633 of file class.ilForum.php.

References $res, $row, array, and fetchPostNodeData().

Referenced by deletePost().

1634  {
1635  $res = $this->db->queryf(
1636  '
1637  SELECT * FROM frm_posts, frm_posts_tree
1638  WHERE pos_pk = pos_fk
1639  AND pos_pk = %s',
1640  array('integer'),
1641  array($post_id)
1642  );
1643 
1644  $row = $this->db->fetchObject($res);
1645 
1646  return $this->fetchPostNodeData($row);
1647  }
fetchPostNodeData($a_row)
get data of parent node from frm_posts_tree and frm_posts private
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserStatistic()

ilForum::getUserStatistic (   $is_moderator = false)
Parameters
bool$is_moderator
Returns
array

Definition at line 1276 of file class.ilForum.php.

References $counter, $data, $query, $res, $row, array, getForumId(), and user().

1277  {
1278  $statistic = array();
1279 
1280  $data_types = array();
1281  $data = array();
1282 
1283  $query = "SELECT COUNT(f.pos_display_user_id) ranking, u.login, p.value, u.lastname, u.firstname
1284  FROM frm_posts f
1285  INNER JOIN frm_posts_tree t
1286  ON f.pos_pk = t.pos_fk
1287  INNER JOIN frm_threads th
1288  ON t.thr_fk = th.thr_pk
1289  INNER JOIN usr_data u
1290  ON u.usr_id = f.pos_display_user_id
1291  INNER JOIN frm_data d
1292  ON d.top_pk = f.pos_top_fk
1293  LEFT JOIN usr_pref p
1294  ON p.usr_id = u.usr_id AND p.keyword = %s
1295  WHERE 1 = 1";
1296 
1297  array_push($data_types, 'text');
1298  array_push($data, 'public_profile');
1299 
1300  if (!$is_moderator) {
1301  $query .= ' AND (pos_status = %s
1302  OR (pos_status = %s
1303  AND pos_author_id = %s ))';
1304 
1305  array_push($data_types, 'integer', 'integer', 'integer');
1306  array_push($data, '1', '0', $this->user->getId());
1307  }
1308 
1309  $query .= ' AND d.top_frm_fk = %s
1310  GROUP BY pos_display_user_id, u.login, p.value,u.lastname, u.firstname';
1311 
1312  array_push($data_types, 'integer');
1313  array_push($data, $this->getForumId());
1314 
1315  $res = $this->db->queryf($query, $data_types, $data);
1316 
1317  $counter = 0;
1318  while ($row = $this->db->fetchAssoc($res)) {
1319  $statistic[$counter][] = $row['ranking'];
1320  $statistic[$counter][] = $row['login'];
1321 
1322  $lastname ='';
1323  $firstname = '';
1324  if (!$this->user->isAnonymous() && in_array($row['value'], array('y', 'g')) ||
1325  $this->user->isAnonymous() && 'g' == $row['value']) {
1326  $lastname = $row['lastname'];
1327  $firstname = $row['firstname'];
1328  }
1329 
1330  $statistic[$counter][] = $lastname;
1331  $statistic[$counter][] = $firstname;
1332 
1333  ++$counter;
1334  }
1335 
1336  return is_array($statistic) ? $statistic : array();
1337  }
user()
Definition: user.php:4
$counter
foreach($_POST as $key=> $value) $res
$query
getForumId()
get forum id public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ insertPostNode()

ilForum::insertPostNode (   $a_node_id,
  $a_parent_id,
  $tree_id,
  $a_date = '' 
)

insert node under parent node public

Parameters
integernode_id
integertree_id
integerparent_id (optional)

Definition at line 1508 of file class.ilForum.php.

References $res, array, date, and getPostDepth().

Referenced by generatePost().

1509  {
1510  $a_date = $a_date ? $a_date : date("Y-m-d H:i:s");
1511 
1512  // get left value
1513  $sql_res = $this->db->queryf(
1514  '
1515  SELECT * FROM frm_posts_tree
1516  WHERE pos_fk = %s
1517  AND thr_fk = %s',
1518  array('integer', 'integer'),
1519  array($a_parent_id, $tree_id)
1520  );
1521 
1522  $res = $this->db->fetchObject($sql_res);
1523 
1524  $left = $res->lft;
1525 
1526  $lft = $left + 1;
1527  $rgt = $left + 2;
1528 
1529  // spread tree
1530  $this->db->manipulateF(
1531  '
1532  UPDATE frm_posts_tree
1533  SET lft = CASE
1534  WHEN lft > %s
1535  THEN lft + 2
1536  ELSE lft
1537  END,
1538  rgt = CASE
1539  WHEN rgt > %s
1540  THEN rgt + 2
1541  ELSE rgt
1542  END
1543  WHERE thr_fk = %s',
1544  array('integer', 'integer', 'integer'),
1545  array($left, $left, $tree_id)
1546  );
1547 
1548  $depth = $this->getPostDepth($a_parent_id, $tree_id) + 1;
1549 
1550  // insert node
1551  $nextId = $this->db->nextId('frm_posts_tree');
1552  $this->db->manipulateF(
1553  '
1554  INSERT INTO frm_posts_tree
1555  ( fpt_pk,
1556  thr_fk,
1557  pos_fk,
1558  parent_pos,
1559  lft,
1560  rgt,
1561  depth,
1562  fpt_date
1563  )
1564  VALUES(%s,%s,%s, %s, %s, %s,%s, %s)',
1565  array('integer','integer', 'integer', 'integer', 'integer', 'integer', 'integer', 'timestamp'),
1566  array( $nextId,
1567  $tree_id,
1568  $a_node_id,
1569  $a_parent_id,
1570  $lft,
1571  $rgt,
1572  $depth,
1573  $a_date)
1574  );
1575  }
getPostDepth($a_node_id, $tree_id)
Return depth of an object private.
foreach($_POST as $key=> $value) $res
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isForumNotificationEnabled()

ilForum::isForumNotificationEnabled (   $user_id)

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

Parameters
integeruser_id A user's ID
Returns
integer Result

Definition at line 2009 of file class.ilForum.php.

References $result, and array.

Referenced by enableForumNotification().

2010  {
2011  $result = $this->db->queryf(
2012  'SELECT COUNT(*) cnt FROM frm_notification WHERE user_id = %s AND frm_id = %s',
2013  array('integer', 'integer'),
2014  array($user_id, $this->id)
2015  );
2016 
2017  while ($record = $this->db->fetchAssoc($result)) {
2018  return (bool) $record['cnt'];
2019  }
2020 
2021  return false;
2022  }
$result
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isThreadNotificationEnabled()

ilForum::isThreadNotificationEnabled (   $user_id,
  $thread_id 
)

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

Parameters
integeruser_id A user's ID
integerthread_id ID of the thread
Returns
integer Result

Definition at line 2060 of file class.ilForum.php.

References $result, and array.

Referenced by enableThreadNotification().

2061  {
2062  $result = $this->db->queryf(
2063  '
2064  SELECT COUNT(*) cnt FROM frm_notification
2065  WHERE user_id = %s
2066  AND thread_id = %s',
2067  array('integer', 'integer'),
2068  array($user_id, $thread_id)
2069  );
2070 
2071 
2072  while ($record = $this->db->fetchAssoc($result)) {
2073  return (bool) $record['cnt'];
2074  }
2075 
2076  return false;
2077  }
$result
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ mergeThreads()

static ilForum::mergeThreads (   $obj_id,
  $source_id,
  $target_id 
)
static
Parameters
$obj_id
$source_id
$target_id
Exceptions
ilException

Definition at line 2180 of file class.ilForum.php.

References $GLOBALS, $post, $target_id, ilObjForum\_deleteAccessEntries(), array, ilForumTopic\deleteByThreadId(), ilObjForum\mergeForumUserRead(), ilForumPost\mergePosts(), ilForumNotification\mergeThreadNotificiations(), updateLastPostByObjId(), and ilForumPostsTree\updateTargetRootRgt().

Referenced by ilObjForumGUI\performMergeThreadsObject().

2181  {
2182  // selected source & target objects
2183  $source_thread_obj = new ilForumTopic((int) $source_id);
2184  $target_thread_obj = new ilForumTopic((int) $target_id);
2185 
2186  if ($source_thread_obj->getForumId() != $target_thread_obj->getForumId()) {
2187  throw new ilException('not_allowed_to_merge_into_another_forum');
2188  }
2189  // use the "older" thread as target
2190  if ($source_thread_obj->getCreateDate() > $target_thread_obj->getCreateDate()) {
2191  $merge_thread_source = $source_thread_obj;
2192  $merge_thread_target = $target_thread_obj;
2193  } else {
2194  $merge_thread_source = $target_thread_obj;
2195  $merge_thread_target = $source_thread_obj;
2196  }
2197 
2198  $thread_subject = $target_thread_obj->getSubject();
2199 
2200  // remember if the threads are open or closed and then close both threads !
2201  $targed_was_closed = $merge_thread_target->isClosed();
2202 
2203  $merge_thread_source->close();
2204 
2205  if ($targed_was_closed == false) {
2206  $merge_thread_target->close();
2207  }
2208 
2209  $source_all_posts = $merge_thread_source->getAllPosts();
2210  $source_root_node = $merge_thread_source->getFirstPostNode();
2211  $target_root_node = $merge_thread_target->getFirstPostNode();
2212 
2213  $add_difference = $target_root_node->getRgt();
2214 
2215  // update target root node rgt
2216  include_once 'Modules/Forum/classes/class.ilForumPostsTree.php';
2217  // $new_target_rgt = ($target_root_node->getRgt() + $source_root_node->getRgt() + 1);
2218  $new_target_rgt = ($target_root_node->getRgt() + $source_root_node->getRgt());
2219  ilForumPostsTree::updateTargetRootRgt($target_root_node->getId(), $new_target_rgt);
2220 
2221  $new_target_root = $target_root_node->getId();
2222 
2223  // get source post tree and update posts tree
2224  foreach ($source_all_posts as $post) {
2225  $post_obj = new ilForumPost($post->pos_pk);
2226 
2227  $posts_tree_obj = new ilForumPostsTree();
2228  $posts_tree_obj->setPosFk($post->pos_pk);
2229 
2230  if ($post_obj->getParentId() == 0) {
2231  $posts_tree_obj->setParentPos($new_target_root);
2232 
2233  //$posts_tree_obj->setRgt(($post_obj->getRgt() + $add_difference));
2234  $posts_tree_obj->setRgt(($post_obj->getRgt() + $add_difference) - 1);
2235  $posts_tree_obj->setLft($target_root_node->getRgt());
2236 
2237  $posts_tree_obj->setDepth(($post_obj->getDepth() + 1));
2238  $posts_tree_obj->setSourceThreadId($merge_thread_source->getId());
2239 
2240  $posts_tree_obj->setTargetThreadId($merge_thread_target->getId());
2241 
2242  $posts_tree_obj->mergeParentPos();
2243  } else {
2244  $posts_tree_obj->setRgt(($post_obj->getRgt() + $add_difference) - 1);
2245  $posts_tree_obj->setLft(($post_obj->getLft() + $add_difference) - 1);
2246 
2247  $posts_tree_obj->setDepth(($post_obj->getDepth() + 1));
2248  $posts_tree_obj->setSourceThreadId($merge_thread_source->getId());
2249 
2250  $posts_tree_obj->setParentPos($post_obj->getParentId());
2251  $posts_tree_obj->setTargetThreadId($merge_thread_target->getId());
2252 
2253  $posts_tree_obj->merge();
2254  }
2255  }
2256 
2257  // update frm_posts pos_thr_fk = target_thr_id
2258  include_once 'Modules/Forum/classes/class.ilForumPost.php';
2259  ilForumPost::mergePosts($merge_thread_source->getId(), $merge_thread_target->getId());
2260 
2261  // check notifications
2262  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
2263  ilForumNotification::mergeThreadNotificiations($merge_thread_source->getId(), $merge_thread_target->getId());
2264 
2265  // delete frm_thread_access entries
2266  include_once './Modules/Forum/classes/class.ilObjForum.php';
2267  ilObjForum::_deleteAccessEntries($merge_thread_source->getId());
2268 
2269  // update frm_user_read
2270  ilObjForum::mergeForumUserRead($merge_thread_source->getId(), $merge_thread_target->getId());
2271 
2272  // update visits, thr_num_posts, last_post, subject
2273  $post_date_source = $merge_thread_source->getLastPost()->getCreateDate();
2274  $post_date_target = $merge_thread_target->getLastPost()->getCreateDate();
2275 
2276  $target_last_post = $merge_thread_target->getLastPostString();
2277  $exp = explode('#', $target_last_post);
2278 
2279  if ($post_date_source > $post_date_target) {
2280  $exp[2] = $merge_thread_source->getLastPost()->getId();
2281  } else {
2282  $exp[2] = $merge_thread_target->getLastPost()->getId();
2283  }
2284  $new_thr_last_post = implode('#', $exp);
2285 
2286  $num_posts_source = (int) $merge_thread_source->getNumPosts();
2287  $num_visits_source = (int) $merge_thread_source->getVisits();
2288  $num_posts_target = (int) $merge_thread_target->getNumPosts();
2289  $num_visits_target = (int) $merge_thread_source->getVisits();
2290 
2291  $frm_topic_obj = new ilForumTopic(0, false, true);
2292  $frm_topic_obj->setNumPosts(($num_posts_source + $num_posts_target));
2293  $frm_topic_obj->setVisits(($num_visits_source + $num_visits_target));
2294  $frm_topic_obj->setLastPostString($new_thr_last_post);
2295  $frm_topic_obj->setSubject($thread_subject);
2296  $frm_topic_obj->setId($merge_thread_target->getId());
2297 
2298  $frm_topic_obj->updateMergedThread();
2299 
2300  // update frm_data: top_last_post , top_num_threads
2302 
2303  // reopen target if was not "closed" before merging
2304  if (!$targed_was_closed) {
2305  $merge_thread_target->reopen();
2306  }
2307  // raise event for updating existing drafts
2308  $GLOBALS['ilAppEventHandler']->raise(
2309  'Modules/Forum',
2310  'mergedThreads',
2311  array( 'source_thread_id' => $merge_thread_source->getId(),
2312  'target_thread_id' => $merge_thread_target->getId())
2313  );
2314 
2315  // delete source thread
2316  ilForumTopic::deleteByThreadId($merge_thread_source->getId());
2317  }
static mergeForumUserRead($merge_source_thread_id, $merge_target_thread_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$target_id
Definition: goto.php:49
static updateTargetRootRgt($root_node_id, $rgt)
static mergeThreadNotificiations($merge_source_thread_id, $merge_target_thread_id)
static updateLastPostByObjId($a_obj_id)
$post
Definition: post.php:34
Create styles array
The data for the language used.
static _deleteAccessEntries($a_thread_id)
static mergePosts($source_thread_id, $target_thread_id)
static deleteByThreadId($thr_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveThreads()

ilForum::moveThreads (   $thread_ids = array(),
  $src_ref_id = 0,
  $dest_top_frm_fk = 0 
)

Moves all chosen threads and their posts to a new forum.

Parameters
arraychosen thread pks
integerobject id of src forum
integerobject id of dest forum public
Returns
array

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

References $id, $res, $row, ilObject\_lookupObjectId(), array, getOneTopic(), and setMDB2WhereCondition().

577  {
578  $src_top_frm_fk = ilObject::_lookupObjectId($src_ref_id);
579 
580  $errorMessages = array();
581 
582  if (is_numeric($src_top_frm_fk) && $src_top_frm_fk > 0 && is_numeric($dest_top_frm_fk) && $dest_top_frm_fk > 0) {
583  $this->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($src_top_frm_fk));
584 
585  $oldFrmData = $this->getOneTopic();
586 
587  $this->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($dest_top_frm_fk));
588 
589  $newFrmData = $this->getOneTopic();
590 
591  if ($oldFrmData['top_pk'] && $newFrmData['top_pk']) {
592  $moved_posts = 0;
593  $moved_threads = 0;
594  $visits = 0;
595 
596  foreach ($thread_ids as $id) {
597  $objTmpThread = new ilForumTopic($id);
598 
599  try {
600  $numPosts = $objTmpThread->movePosts(
601  $src_top_frm_fk,
602  $oldFrmData['top_pk'],
603  $dest_top_frm_fk,
604  $newFrmData['top_pk']
605  );
606 
607  if (($last_post_string = $objTmpThread->getLastPostString()) != '') {
608  $last_post_string = explode('#', $last_post_string);
609  $last_post_string[0] = $newFrmData['top_pk'];
610  $last_post_string = implode('#', $last_post_string);
611  $objTmpThread->setLastPostString($last_post_string);
612  }
613 
614  $visits += $objTmpThread->getVisits();
615 
616  $moved_posts += $numPosts;
617  ++$moved_threads;
618 
619  $objTmpThread->setForumId($newFrmData['top_pk']);
620  $objTmpThread->update();
621 
622  unset($objTmpThread);
623  } catch (\ilFileUtilsException $exception) {
624  $errorMessages[] = sprintf($this->lng->txt('frm_move_invalid_file_type'), $objTmpThread->getSubject());
625  continue;
626  }
627  }
628 
629  if ($moved_threads > 0 || $moved_posts > 0 || $visits > 0) {
630  // update frm_data source forum
631  $this->db->setLimit(1);
632  $res = $this->db->queryf(
633  '
634  SELECT pos_thr_fk, pos_pk
635  FROM frm_posts
636  WHERE pos_top_fk = %s
637  ORDER BY pos_date DESC',
638  array('integer'),
639  array($oldFrmData['top_pk'])
640  );
641 
642  $row = $this->db->fetchObject($res);
643  $last_post_src = $oldFrmData['top_pk'] . '#' . $row->pos_thr_fk . '#' . $row->pos_pk;
644 
645  $this->db->manipulateF(
646  '
647  UPDATE frm_data
648  SET top_num_posts = top_num_posts - %s,
649  top_num_threads = top_num_threads - %s,
650  visits = visits - %s,
651  top_last_post = %s
652  WHERE top_pk = %s',
653  array('integer', 'integer', 'integer', 'text', 'integer'),
654  array( $moved_posts,
655  $moved_threads,
656  $visits,
657  $last_post_src,
658  $oldFrmData['top_pk'])
659  );
660 
661  // update frm_data destination forum
662  $this->db->setLimit(1);
663  $res = $this->db->queryf(
664  '
665  SELECT pos_thr_fk, pos_pk
666  FROM frm_posts
667  WHERE pos_top_fk = %s
668  ORDER BY pos_date DESC',
669  array('integer'),
670  array($newFrmData['top_kp'])
671  );
672 
673  $row = $this->db->fetchObject($res);
674  $last_post_dest = $newFrmData['top_pk'] . '#' . $row->pos_thr_fk . '#' . $row->pos_pk;
675 
676  $this->db->manipulateF(
677  '
678  UPDATE frm_data
679  SET top_num_posts = top_num_posts + %s,
680  top_num_threads = top_num_threads + %s,
681  visits = visits + %s,
682  top_last_post = %s
683  WHERE top_pk = %s',
684  array('integer', 'integer', 'integer', 'text', 'integer'),
685  array($moved_posts, $moved_threads, $visits, $last_post_dest, $newFrmData['top_pk'])
686  );
687  }
688  }
689 
690  return $errorMessages;
691  }
692  }
static _lookupObjectId($a_ref_id)
lookup object id
setMDB2WhereCondition($query_string, $data_type, $data_value)
set content for additional condition
foreach($_POST as $key=> $value) $res
getOneTopic()
get one topic-dataset by WhereCondition
Create styles array
The data for the language used.
Class to report exception.
+ Here is the call graph for this function:

◆ postCensorship()

ilForum::postCensorship (   $message,
  $pos_pk,
  $cens = 0 
)

update dataset in frm_posts with censorship info

Parameters
stringmessage
integerpos_pk
Returns
boolean public

Definition at line 702 of file class.ilForum.php.

References $GLOBALS, $message, $res, array, date, ilNewsItem\getFirstNewsIdForContext(), getForumRefId(), and prepareText().

703  {
704  $cens_date = date("Y-m-d H:i:s");
705 
706  $this->db->manipulateF(
707  '
708  UPDATE frm_posts
709  SET pos_cens_com = %s,
710  pos_cens_date = %s,
711  pos_cens = %s,
712  update_user = %s
713  WHERE pos_pk = %s',
714  array('text', 'timestamp', 'integer', 'integer', 'integer'),
715  array($message, $cens_date, $cens, $GLOBALS['DIC']['ilUser']->getId(), $pos_pk)
716  );
717 
718  // Change news item accordingly
719  include_once("./Services/News/classes/class.ilNewsItem.php");
721  $this->id,
722  "frm",
723  $pos_pk,
724  "pos"
725  );
726  if ($news_id > 0) {
727  if ($cens > 0) { // censor
728  $news_item = new ilNewsItem($news_id);
729  //$news_item->setTitle($subject);
730  $news_item->setContent(nl2br($this->prepareText($message, 0)));
731  if ($message != strip_tags($message)) {
732  $news_item->setContentHtml(true);
733  } else {
734  $news_item->setContentHtml(false);
735  }
736 
737  $news_item->update();
738  } else { // revoke censorship
739  // get original message
740  $res = $this->db->queryf(
741  '
742  SELECT * FROM frm_posts
743  WHERE pos_pk = %s',
744  array('integer'),
745  array($pos_pk)
746  );
747 
748  $rec = $this->db->fetchAssoc($res);
749 
750  $news_item = new ilNewsItem($news_id);
751  //$news_item->setTitle($subject);
752  $news_item->setContent(nl2br($this->prepareText($rec["pos_message"], 0)));
753  if ($rec["pos_message"] != strip_tags($rec["pos_message"])) {
754  $news_item->setContentHtml(true);
755  } else {
756  $news_item->setContentHtml(false);
757  }
758 
759  $news_item->update();
760  }
761  }
762 
763  require_once 'Modules/Forum/classes/class.ilForumPost.php';
764  $GLOBALS['ilAppEventHandler']->raise(
765  'Modules/Forum',
766  'censoredPost',
767  array(
768  'ref_id' => $this->getForumRefId(),
769  'post' => new ilForumPost($pos_pk)
770  )
771  );
772 
773  return true;
774  }
getForumRefId()
get forum ref_id public
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
catch(Exception $e) $message
foreach($_POST as $key=> $value) $res
prepareText($text, $edit=0, $quote_user='', $type='')
prepares given string public
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
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.
+ Here is the call graph for this function:

◆ prepareText()

ilForum::prepareText (   $text,
  $edit = 0,
  $quote_user = '',
  $type = '' 
)

prepares given string public

Parameters
string
integer
Returns
string

Definition at line 1805 of file class.ilForum.php.

References $i, $text, $txtQuote2, $type, and ilMathJax\getInstance().

Referenced by generatePost(), and postCensorship().

1806  {
1807  if ($type == 'export') {
1808  $this->replQuote1 = "<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">";
1809  $this->replQuote2 = "<hr size=\"1\" color=\"#000000\"/></blockquote>";
1810  }
1811 
1812  if ($edit == 1) {
1813  // add login name of quoted users
1814  $lname = ($quote_user != "")
1815  ? '="' . $quote_user . '"'
1816  : "";
1817 
1818  $text = "[quote$lname]" . $text . "[/quote]";
1819  } else {
1820  // check for quotation
1821  $startZ = substr_count($text, "[quote"); // also count [quote="..."]
1822  $endZ = substr_count($text, "[/quote]");
1823 
1824  if ($startZ > 0 || $endZ > 0) {
1825  // add missing opening and closing tags
1826  if ($startZ > $endZ) {
1827  $diff = $startZ - $endZ;
1828 
1829  for ($i = 0; $i < $diff; $i++) {
1830  if ($type == 'export') {
1832  } else {
1833  $text .= "[/quote]";
1834  }
1835  }
1836  } elseif ($startZ < $endZ) {
1837  $diff = $endZ - $startZ;
1838 
1839  for ($i = 0; $i < $diff; $i++) {
1840  if ($type == 'export') {
1841  $text = $this->txtQuote1 . $text;
1842  } else {
1843  $text = "[quote]" . $text;
1844  }
1845  }
1846  }
1847 
1848  if ($edit == 0) {
1849  $text = preg_replace(
1850  '@\[(quote\s*?=\s*?"([^"]*?)"\s*?)\]@i',
1851  $this->replQuote1 . '<div class="ilForumQuoteHead">' . $this->lng->txt('quote') . ' ($2)</div>',
1852  $text
1853  );
1854 
1855  $text = str_replace(
1856  "[quote]",
1857  $this->replQuote1 . '<div class="ilForumQuoteHead">' . $this->lng->txt("quote") . '</div>',
1858  $text
1859  );
1860 
1861  $text = str_replace("[/quote]", $this->replQuote2, $text);
1862  }
1863  }
1864  }
1865 
1866  if ($type != 'export') {
1867  if ($edit == 0) {
1868  include_once './Services/MathJax/classes/class.ilMathJax.php';
1869  $text = ilMathJax::getInstance()->insertLatexImages($text, "<span class\=\"latex\">", "<\/span>");
1870  $text = ilMathJax::getInstance()->insertLatexImages($text, "\[tex\]", "\[\/tex\]");
1871  }
1872 
1873  // workaround for preventing template engine
1874  // from hiding text that is enclosed
1875  // in curly brackets (e.g. "{a}")
1876  $text = str_replace("{", "&#123;", $text);
1877  $text = str_replace("}", "&#125;", $text);
1878  }
1879 
1880  return $text;
1881  }
$type
$text
Definition: errorreport.php:18
static getInstance()
Singleton: get instance.
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDbTable()

ilForum::setDbTable (   $dbTable)

set database table

Parameters
string$dbTabledatabase table
See also
$dbTable User interface

Definition at line 202 of file class.ilForum.php.

References $dbTable.

203  {
204  if ($dbTable == "") {
205  die($this->className . "::setDbTable(): No database table given.");
206  } else {
207  $this->dbTable = $dbTable;
208  }
209  }

◆ setForumId()

ilForum::setForumId (   $a_obj_id)

set object id which refers to ILIAS obj_id

Parameters
integerobject id public

Definition at line 125 of file class.ilForum.php.

References $message.

126  {
127  if (!isset($a_obj_id)) {
128  $message = get_class($this) . "::setForumId(): No obj_id given!";
129  $this->error->raiseError($message, $this->error->WARNING);
130  }
131 
132  $this->id = $a_obj_id;
133  }
catch(Exception $e) $message

◆ setForumRefId()

ilForum::setForumRefId (   $a_ref_id)

set reference id which refers to ILIAS obj_id

Parameters
integerobject id public

Definition at line 140 of file class.ilForum.php.

References $message.

141  {
142  if (!isset($a_ref_id)) {
143  $message = get_class($this) . "::setForumRefId(): No ref_id given!";
144  $this->error->raiseError($message, $this->error->WARNING);
145  }
146 
147  $this->ref_id = $a_ref_id;
148  }
catch(Exception $e) $message

◆ setImportName()

ilForum::setImportName (   $a_import_name)

Definition at line 1906 of file class.ilForum.php.

1907  {
1908  $this->import_name = $a_import_name;
1909  }

◆ setLanguage()

ilForum::setLanguage (   $lng)

Definition at line 90 of file class.ilForum.php.

References $lng.

91  {
92  $this->lng = $lng;
93  }

◆ setMDB2WhereCondition()

ilForum::setMDB2WhereCondition (   $query_string,
  $data_type,
  $data_value 
)

set content for additional condition

Parameters
string$query_string
array$data_type
array$data_value
Returns
bool

Definition at line 230 of file class.ilForum.php.

Referenced by moveThreads().

231  {
232  $this->mdb2Query = $query_string;
233  $this->mdb2DataValue = $data_value;
234  $this->mdb2DataType = $data_type;
235 
236  return true;
237  }
+ Here is the caller graph for this function:

◆ setOrderField()

ilForum::setOrderField (   $orderField)
private

set database field for sorting results

Parameters
string$orderFielddatabase field for sorting
See also
$orderField private

Definition at line 176 of file class.ilForum.php.

References $orderField.

177  {
178  if ($orderField == "") {
179  die($this->className . "::setOrderField(): No orderField given.");
180  } else {
181  $this->orderField = $orderField;
182  }
183  }

◆ setPageHits()

ilForum::setPageHits (   $pageHits)
Parameters
int$pageHits
Returns
bool

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

References $pageHits.

277  {
278  if ($pageHits < 1 || !is_numeric($pageHits)) {
279  $pageHits = 1;
280  }
281 
282  $this->pageHits = (int) $pageHits;
283  return true;
284  }

◆ updateLastPostByObjId()

static ilForum::updateLastPostByObjId (   $a_obj_id)
static

Definition at line 2136 of file class.ilForum.php.

References $DIC, $ilDB, and array.

Referenced by mergeThreads().

2137  {
2138  global $DIC;
2139  $ilDB = $DIC->database();
2140  // get latest post of forum and update last_post
2141  $ilDB->setLimit(1);
2142  $res2 = $ilDB->queryf(
2143  '
2144  SELECT pos_top_fk, pos_thr_fk, pos_pk FROM frm_posts, frm_data
2145  WHERE pos_top_fk = top_pk
2146  AND top_frm_fk = %s
2147  ORDER BY pos_date DESC',
2148  array('integer'),
2149  array($a_obj_id)
2150  );
2151 
2152  if ($res2->numRows() == 0) {
2153  $lastPost_top = "";
2154  } else {
2155  $z = 0;
2156 
2157  while ($selData = $ilDB->fetchAssoc($res2)) {
2158  if ($z > 0) {
2159  break;
2160  }
2161 
2162  $lastPost_top = $selData["pos_top_fk"] . "#" . $selData["pos_thr_fk"] . "#" . $selData["pos_pk"];
2163  $z++;
2164  }
2165  }
2166 
2167  $ilDB->update(
2168  'frm_data',
2169  array('top_last_post' => array('text', $lastPost_top)),
2170  array('top_frm_fk' => array('integer', $a_obj_id))
2171  );
2172  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ updateVisits()

ilForum::updateVisits (   $ID)

update page hits of given forum- or thread-ID public

Parameters
integer

Definition at line 1777 of file class.ilForum.php.

References $_SESSION, $query, $res, array, getMDB2DataType(), getMDB2DataValue(), getMDB2Query(), and time.

1778  {
1779  $checkTime = time() - (60*60);
1780 
1781  if ($_SESSION["frm_visit_" . $this->dbTable . "_" . $ID] < $checkTime) {
1782  $_SESSION["frm_visit_" . $this->dbTable . "_" . $ID] = time();
1783  $query = 'UPDATE ' . $this->dbTable . ' SET visits = visits + 1 WHERE ';
1784 
1785  $data_type = array();
1786  $data_value = array();
1787 
1788  if ($this->getMDB2Query() != '' && $this->getMDB2DataType() != '' && $this->getMDB2DataValue() != '') {
1789  $query .= $this->getMDB2Query();
1790  $data_type = $data_type + $this->getMDB2DataType();
1791  $data_value = $data_value + $this->getMDB2DataValue();
1792 
1793  $res = $this->db->queryf($query, $data_type, $data_value);
1794  }
1795  }
1796  }
$_SESSION["AccountId"]
getMDB2DataType()
get content of additional condition
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
getMDB2Query()
get content of additional condition
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getMDB2DataValue()
get content of additional condition
+ Here is the call graph for this function:

Field Documentation

◆ $className

ilForum::$className ="ilForum"
private

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

◆ $db

ilForum::$db

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

◆ $dbTable

ilForum::$dbTable
private

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

Referenced by getDbTable(), and setDbTable().

◆ $error

ilForum::$error

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

◆ $id

ilForum::$id
private

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

Referenced by getForumId(), and moveThreads().

◆ $lng

ilForum::$lng

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

Referenced by setLanguage().

◆ $mdb2DataType

ilForum::$mdb2DataType
private

Definition at line 61 of file class.ilForum.php.

Referenced by getMDB2DataType().

◆ $mdb2DataValue

ilForum::$mdb2DataValue
private

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

Referenced by getMDB2DataValue().

◆ $mdb2Query

ilForum::$mdb2Query
private

Definition at line 59 of file class.ilForum.php.

Referenced by getMDB2Query().

◆ $moderators_by_ref_id_map

ilForum::$moderators_by_ref_id_map = array()
staticprotected

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

◆ $orderField

ilForum::$orderField
private

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

Referenced by getOrderField(), and setOrderField().

◆ $pageHits

ilForum::$pageHits = self::DEFAULT_PAGE_HITS
private

Definition at line 69 of file class.ilForum.php.

Referenced by getPageHits(), and setPageHits().

◆ $replQuote1

ilForum::$replQuote1 = '<blockquote class="ilForumQuote">'
private

Definition at line 65 of file class.ilForum.php.

◆ $replQuote2

ilForum::$replQuote2 = '</blockquote>'
private

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

◆ $settings

ilForum::$settings

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

◆ $txtQuote1

ilForum::$txtQuote1 = "[quote]"
private

Definition at line 63 of file class.ilForum.php.

◆ $txtQuote2

ilForum::$txtQuote2 = "[/quote]"
private

Definition at line 64 of file class.ilForum.php.

Referenced by prepareText().

◆ $user

ilForum::$user

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

◆ DEFAULT_PAGE_HITS

const ilForum::DEFAULT_PAGE_HITS = 30

Definition at line 23 of file class.ilForum.php.

◆ SORT_DATE

const ilForum::SORT_DATE = 2

Definition at line 21 of file class.ilForum.php.

◆ SORT_TITLE

const ilForum::SORT_TITLE = 1

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

Referenced by ilObjForumGUI\cloneWizardPageObject().


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