Class Forum core functions for forum. More...
Collaboration diagram for ilForum:Public Member Functions | |
| ilForum () | |
| Constructor public. | |
| setLanguage ($lng) | |
| setForumId ($a_obj_id) | |
| set object id which refers to ILIAS obj_id | |
| setForumRefId ($a_ref_id) | |
| set reference id which refers to ILIAS obj_id | |
| getForumId () | |
| get forum id public | |
| getForumRefId () | |
| get forum ref_id public | |
| setOrderField ($orderField) | |
| set database field for sorting results | |
| getOrderField () | |
| get name of orderField | |
| setDbTable ($dbTable) | |
| set database table | |
| getDbTable () | |
| get name of database table | |
| setWhereCondition ($whereCondition="1") | |
| set content of WHERE condition | |
| getWhereCondition () | |
| get content of whereCondition | |
| setPageHits ($pageHits) | |
| set number of max. | |
| getPageHits () | |
| get number of max. | |
| getOneDataset () | |
| get one dataset from set Table and set WhereCondition | |
| getOneTopic () | |
| get one topic-dataset by WhereCondition | |
| fixThreadNumber ($a_top_pk, $a_num_threads) | |
| In some rare cases the thread number in frm_data is incorrect. | |
| _lookupForumData ($a_obj_id) | |
| lookup forum data | |
| getOneThread () | |
| get one thread-dataset by WhereCondition | |
| getOnePost ($post) | |
| get one post-dataset | |
| getPostById ($a_id) | |
| _lookupPostMessage ($a_id) | |
| generatePost ($forum_id, $thread_id, $user, $message, $parent_pos, $notify, $subject= '', $alias= '', $date= '', $status=1, $send_activation_mail=false) | |
| generate new dataset in frm_posts | |
| generateThread ($forum_id, $user, $subject, $message, $notify, $notify_posts, $alias= '', $date= '') | |
| generate new dataset in frm_threads | |
| updatePost ($message, $pos_pk, $notify, $subject, $thr_pk=0) | |
| update dataset in frm_posts | |
| updateThread ($thr_pk, $subject) | |
| update dataset in frm_threads | |
| getAllForums () | |
| moveThreads ($tread_ids=array(), $src_ref_id=0, $dest_top_frm_fk=0) | |
| Moves all chosen threads and their posts to a new forum. | |
| postCensorship ($message, $pos_pk, $cens=0) | |
| update dataset in frm_posts with censorship info | |
| deletePost ($post) | |
| delete post and sub-posts | |
| getAllThreads ($a_topic_id, $is_moderator=false) | |
| Get all threads of given thread. | |
| getPostList ($topic, $thread) | |
| get all posts of given thread | |
| getUserStatistic ($is_moderator=false) | |
| getFirstPostByThread ($a_thread_id) | |
| Get first post of thread. | |
| getLastPost ($lastPost) | |
| get content of given ID's | |
| getUser ($a_user_id) | |
| get content of given user-ID | |
| getModerators () | |
| get all users assigned to local role il_frm_moderator_<frm_ref_id> | |
| _getModerators ($a_ref_id) | |
| get all users assigned to local role il_frm_moderator_<frm_ref_id> (static) | |
| _isModerator ($a_ref_id, $a_usr_id) | |
| checks whether a user is moderator of a given forum object | |
| countUserArticles ($a_user_id) | |
| get number of articles from given user-ID | |
| countActiveUserArticles ($a_user_id) | |
| getForumPath ($a_ref_id) | |
| builds a string to show the forum-context | |
| convertDate ($date) | |
| converts the date format | |
| addPostTree ($a_tree_id, $a_node_id=-1, $a_date= '') | |
| create a new post-tree | |
| insertPostNode ($a_node_id, $a_parent_id, $tree_id, $a_date= '') | |
| insert node under parent node public | |
| getPostDepth ($a_node_id, $tree_id) | |
| Return depth of an object private. | |
| getPostTree ($a_node) | |
| get all nodes in the subtree under specified node | |
| getPostChilds ($a_node_id, $a_thr_id) | |
| get child nodes of given node public | |
| getFirstPostNode ($tree_id) | |
| get data of the first node from frm_posts_tree and frm_posts public | |
| getPostNode ($post_id) | |
| get data of given node from frm_posts_tree and frm_posts public | |
| fetchPostNodeData ($a_row) | |
| get data of parent node from frm_posts_tree and frm_posts private | |
| getPostMaximumDepth ($a_thr_id) | |
| Return the maximum depth in tree public. | |
| deletePostTree ($a_node) | |
| delete node and the whole subtree under this node public | |
| updateVisits ($ID) | |
| update page hits of given forum- or thread-ID public | |
| prepareText ($text, $edit=0, $quote_user="", $type= '') | |
| prepares given string public | |
| getModeratorFromPost ($pos_pk) | |
| get one post-dataset | |
| __deletePostFiles ($a_ids) | |
| __sendMessage ($a_parent_pos, $post_data=array()) | |
| __formatSubject ($thread_data) | |
| __formatMessage ($thread_data, $post_data=array()) | |
| getUserData ($a_id, $a_import_name=0) | |
| getImportName () | |
| setImportName ($a_import_name) | |
| enableForumNotification ($user_id) | |
| Enable a user's notification about new posts in this forum. | |
| disableForumNotification ($user_id) | |
| Disable a user's notification about new posts in this forum. | |
| isForumNotificationEnabled ($user_id) | |
| Check whether a user's notification about new posts in this forum is enabled (result > 0) or not (result == 0). | |
| enableThreadNotification ($user_id, $thread_id) | |
| Enable a user's notification about new posts in a thread. | |
| 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). | |
| sendThreadNotifications ($post_data) | |
| sendForumNotifications ($post_data) | |
| formatPostActivationNotificationSubject () | |
| formatPostActivationNotification ($post_data) | |
| sendPostActivationNotification ($post_data) | |
| formatNotificationSubject () | |
| formatNotification ($post_data, $cron=0) | |
| limitMsgString ($message) | |
| _lookupObjIdForForumId ($a_for_id) | |
Static Public Member Functions | |
| static | _getThreads ($a_obj_id, $a_sort_mode=self::SORT_DATE) |
| Get thread infos of object. | |
Data Fields | |
| const | SORT_TITLE = 1 |
| const | SORT_DATE = 2 |
| $ilias | |
| $lng | |
| $dbTable | |
| $className = "ilForum" | |
| $orderField | |
| $whereCondition = "1" | |
| $txtQuote1 = "[quote]" | |
| $txtQuote2 = "[/quote]" | |
| $replQuote1 = '<blockquote class="ilForumQuote">' | |
| $replQuote2 = '</blockquote>' | |
| $pageHits = 30 | |
| $id | |
Private Attributes | |
| $threads = array() | |
Class Forum core functions for forum.
Definition at line 38 of file class.ilForum.php.
| ilForum::__deletePostFiles | ( | $ | a_ids | ) |
Definition at line 1799 of file class.ilForum.php.
References $file, $files, and getForumId().
Referenced by deletePost().
{
if(!is_array($a_ids))
{
return false;
}
include_once "./Modules/Forum/classes/class.ilFileDataForum.php";
$tmp_file_obj =& new ilFileDataForum($this->getForumId());
foreach($a_ids as $pos_id)
{
$tmp_file_obj->setPosId($pos_id);
$files = $tmp_file_obj->getFilesOfPost();
foreach($files as $file)
{
$tmp_file_obj->unlinkFile($file["name"]);
}
}
unset($tmp_file_obj);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::__formatMessage | ( | $ | thread_data, | |
| $ | post_data = array() | |||
| ) |
Definition at line 1857 of file class.ilForum.php.
References $title, getForumRefId(), and ilObjectFactory::getInstanceByRefId().
Referenced by __sendMessage().
{
include_once "./classes/class.ilObjectFactory.php";
$frm_obj =& ilObjectFactory::getInstanceByRefId($this->getForumRefId());
$title = $frm_obj->getTitle();
unset($frm_obj);
$message = $this->lng->txt("forum").": ".$title." -> ".$thread_data["thr_subject"]."\n\n";
$message .= $this->lng->txt("forum_post_replied");
$message .= "\n------------------------------------------------------------\n";
$message .= $post_data["pos_message"];
$message .= "\n------------------------------------------------------------\n";
$message .= sprintf($this->lng->txt("forums_notification_show_post"), "http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/goto.php?target=frm_".$post_data["ref_id"]."_".$post_data["pos_thr_fk"].'&client_id='.CLIENT_ID);
return $message;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::__formatSubject | ( | $ | thread_data | ) |
Definition at line 1852 of file class.ilForum.php.
Referenced by __sendMessage().
{
return $this->lng->txt("forums_notification_subject");
}
Here is the caller graph for this function:| ilForum::__sendMessage | ( | $ | a_parent_pos, | |
| $ | post_data = array() | |||
| ) |
Definition at line 1822 of file class.ilForum.php.
References __formatMessage(), __formatSubject(), getOnePost(), getOneThread(), and setWhereCondition().
Referenced by generatePost().
{
global $ilUser, $ilDB;
$parent_data = $this->getOnePost($a_parent_pos);
// only if the current user is not the owner of the parent post and the parent's notification flag is set...
if($parent_data["notify"] && $parent_data["pos_usr_id"] != $ilUser->getId())
{
// SEND MESSAGE
include_once "Services/Mail/classes/class.ilMail.php";
include_once './Services/User/classes/class.ilObjUser.php';
$tmp_user =& new ilObjUser($parent_data["pos_usr_id"]);
// NONSENSE
$this->setWhereCondition("thr_pk = ".$ilDB->quote($parent_data["pos_thr_fk"])."");
$thread_data = $this->getOneThread();
$tmp_mail_obj = new ilMail(ANONYMOUS_USER_ID);
$message = $tmp_mail_obj->sendMail($tmp_user->getLogin(),"","",
$this->__formatSubject($thread_data),
$this->__formatMessage($thread_data, $post_data),
array(),array("system"));
unset($tmp_user);
unset($tmp_mail_obj);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::_getModerators | ( | $ | a_ref_id | ) |
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
| int | $a_ref_id reference id |
Definition at line 1190 of file class.ilForum.php.
References $title, and ilObject::_lookupTitle().
Referenced by _isModerator(), getModerators(), and ilObjForumListGUI::getProperties().
{
global $rbacreview;
$rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
$role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);
foreach ($role_arr as $role_id)
{
//$roleObj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
$title = ilObject::_lookupTitle($role_id);
if ($title == "il_frm_moderator_".$a_ref_id)
{
#return $rbacreview->assignedUsers($roleObj->getId());
return $title = $rbacreview->assignedUsers($role_id);
}
}
return array();
}
Here is the call graph for this function:
Here is the caller graph for this function:| static ilForum::_getThreads | ( | $ | a_obj_id, | |
| $ | a_sort_mode = self::SORT_DATE | |||
| ) | [static] |
Get thread infos of object.
public
| int | obj_id of forum | |
| int | sort mode SORT_TITLE or SORT_DATE |
Definition at line 2243 of file class.ilForum.php.
References $res, and $threads.
Referenced by ilObjForumGUI::cloneWizardPageObject().
{
global $ilDB;
switch($a_sort_mode)
{
case self::SORT_DATE:
$sort = 'thr_date';
break;
case self::SORT_TITLE:
default:
$sort = 'thr_subject';
break;
}
$query = "SELECT * FROM frm_threads JOIN frm_data ON top_pk = thr_top_fk ".
"WHERE top_frm_fk = ".$ilDB->quote($a_obj_id)." ".
"ORDER BY ".$sort;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$threads[$row->thr_pk] = $row->thr_subject;
}
return $threads ? $threads : array();
}
Here is the caller graph for this function:| ilForum::_isModerator | ( | $ | a_ref_id, | |
| $ | a_usr_id | |||
| ) |
checks whether a user is moderator of a given forum object
| int | $a_ref_id reference id | |
| int | $a_usr_id user id |
Definition at line 1219 of file class.ilForum.php.
References _getModerators().
Referenced by ilForumExplorer::setOutput().
{
return in_array($a_usr_id, ilForum::_getModerators($a_ref_id));
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::_lookupForumData | ( | $ | a_obj_id | ) |
lookup forum data
Definition at line 332 of file class.ilForum.php.
{
global $ilDB;
$query = "SELECT * FROM frm_data WHERE top_frm_fk = ".$ilDB->quote($a_obj_id);
$result = $ilDB->getRow($query, DB_FETCHMODE_ASSOC);
$result["top_name"] = trim($result["top_name"]);
$result["top_description"] = nl2br($result["top_description"]);
return $result;
}
| ilForum::_lookupObjIdForForumId | ( | $ | a_for_id | ) |
Definition at line 2290 of file class.ilForum.php.
Referenced by ilForumTopic::movePosts().
{
global $ilDB;
$forum = $ilDB->query("SELECT * FROM frm_data ".
" WHERE top_pk = ".$ilDB->quote($a_for_id));
if ($fdata = $forum->fetchRow(DB_FETCHMODE_ASSOC))
{
return $fdata["top_frm_fk"];
}
return false;
}
Here is the caller graph for this function:| ilForum::_lookupPostMessage | ( | $ | a_id | ) |
Definition at line 398 of file class.ilForum.php.
References $res.
Referenced by ilObjForum::cloneObject().
{
global $ilDB;
$query = "SELECT * FROM frm_posts WHERE pos_pk = ".$ilDB->quote($a_id)."";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->pos_message;
}
return '';
}
Here is the caller graph for this function:| ilForum::addPostTree | ( | $ | a_tree_id, | |
| $ | a_node_id = -1, |
|||
| $ | a_date = '' | |||
| ) |
create a new post-tree
| integer | a_tree_id: id where tree belongs to | |
| integer | a_node_id: root node of tree (optional; default is tree_id itself) |
Definition at line 1314 of file class.ilForum.php.
Referenced by generatePost().
{
global $ilDB;
$a_date = $a_date ? $a_date : date("Y-m-d H:i:s");
if ($a_node_id <= 0)
{
$a_node_id = $a_tree_id;
}
$query = "INSERT INTO frm_posts_tree (thr_fk, pos_fk, parent_pos, lft, rgt, depth, date) ".
"VALUES ".
"(".$ilDB->quote($a_tree_id).",".$ilDB->quote($a_node_id).", 0, 1, 2, 1, ".$ilDB->quote($a_date).")";
$this->ilias->db->query($query);
return true;
}
Here is the caller graph for this function:| ilForum::convertDate | ( | $ | date | ) |
converts the date format
| string | $date |
Definition at line 1295 of file class.ilForum.php.
References $lng, and formatDate().
Referenced by getLastPost(), and getOnePost().
{
global $lng;
if ($date > date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d"), date("Y"))))
{
return $lng->txt("today").", ".ilFormat::formatDate($date,"time", true);
}
return ilFormat::formatDate($date, "datetime", true);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::countActiveUserArticles | ( | $ | a_user_id | ) |
Definition at line 1246 of file class.ilForum.php.
References $res, and getForumId().
{
global $ilDB, $ilUser;
$q = "SELECT *
FROM frm_data
INNER JOIN frm_posts ON pos_top_fk = top_pk
WHERE 1
AND top_frm_fk = ".$ilDB->quote($this->getForumId())."
AND (pos_status = '1' OR (pos_status = '0' AND pos_usr_id = ".$ilDB->quote($ilUser->getId())."))
AND pos_usr_id = ".$ilDB->quote($a_user_id)." ";
$res = $this->ilias->db->query($q);
return $res->numRows();
}
Here is the call graph for this function:| ilForum::countUserArticles | ( | $ | a_user_id | ) |
get number of articles from given user-ID
| integer | $user: user-ID |
Definition at line 1231 of file class.ilForum.php.
References $res, and getForumId().
{
global $ilDB;
$q = "SELECT *
FROM frm_data
INNER JOIN frm_posts ON pos_top_fk = top_pk
WHERE 1
AND top_frm_fk = ".$ilDB->quote($this->getForumId())."
AND pos_usr_id = ".$ilDB->quote($a_user_id)." ";
$res = $this->ilias->db->query($q);
return $res->numRows();
}
Here is the call graph for this function:| ilForum::deletePost | ( | $ | post | ) |
delete post and sub-posts
| integer | $post: ID public |
Definition at line 839 of file class.ilForum.php.
References __deletePostFiles(), ilObjForum::_deleteAccessEntries(), ilObjForum::_deleteReadEntries(), deletePostTree(), ilNewsItem::getFirstNewsIdForContext(), and getPostNode().
{
global $ilDB;
include_once "./Modules/Forum/classes/class.ilObjForum.php";
// delete tree and get id's of all posts to delete
$p_node = $this->getPostNode($post);
$del_id = $this->deletePostTree($p_node);
// Delete User read entries
foreach($del_id as $post_id)
{
ilObjForum::_deleteReadEntries($post_id);
}
// DELETE ATTACHMENTS ASSIGNED TO POST
$this->__deletePostFiles($del_id);
$dead_pos = count($del_id);
$dead_thr = 0;
// if deletePost is thread opener ...
if ($p_node["parent"] == 0)
{
// delete thread access data
include_once './Modules/Forum/classes/class.ilObjForum.php';
ilObjForum::_deleteAccessEntries($p_node['tree']);
// delete thread
$dead_thr = $p_node["tree"];
$query = "DELETE FROM frm_threads ".
"WHERE thr_pk = ".$ilDB->quote($p_node["tree"])."";
$this->ilias->db->query($query);
// update num_threads
$query2 = "UPDATE frm_data ".
"SET ".
"top_num_threads = top_num_threads - 1 ".
"WHERE top_frm_fk = ".$ilDB->quote($this->id)."";
$this->ilias->db->query($query2);
// delete all related news
$q = "SELECT * FROM frm_posts ".
"WHERE pos_thr_fk = ".$ilDB->quote($p_node["tree"])."";
$posset = $this->ilias->db->query($q);
while ($posrec = $posset->fetchRow(DB_FETCHMODE_ASSOC))
{
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id,
"frm", $posrec["pos_pk"], "pos");
if ($news_id > 0)
{
$news_item = new ilNewsItem($news_id);
$news_item->delete();
}
}
// delete all posts of this thread
$query3 = "DELETE FROM frm_posts ".
"WHERE pos_thr_fk = ".$ilDB->quote($p_node["tree"])."";
$this->ilias->db->query($query3);
}
else
{
// delete this post and its sub-posts
for ($i = 0; $i < $dead_pos; $i++)
{
$query = "DELETE FROM frm_posts ".
"WHERE pos_pk = ".$ilDB->quote($del_id[$i])."";
$this->ilias->db->query($query);
// delete related news item
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id,
"frm", $del_id[$i], "pos");
if ($news_id > 0)
{
$news_item = new ilNewsItem($news_id);
$news_item->delete();
}
}
// update num_posts in frm_threads
$query2 = "UPDATE frm_threads ".
"SET ".
"thr_num_posts = thr_num_posts - ".$ilDB->quote($dead_pos)." ".
"WHERE thr_pk = ".$ilDB->quote($p_node["tree"])."";
$this->ilias->db->query($query2);
// get latest post of thread and update last_post
$q = "SELECT * FROM frm_posts WHERE ";
$q .= "pos_thr_fk = ".$ilDB->quote($p_node["tree"])." ";
$q .= "ORDER BY pos_date DESC";
$res1 = $this->ilias->db->query($q);
if ($res1->numRows() == 0)
{
$lastPost_thr = "";
}
else
{
$z = 0;
while ($selData = $res1->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($z > 0)
{
break;
}
$lastPost_thr = $selData["pos_top_fk"]."#".$selData["pos_thr_fk"]."#".$selData["pos_pk"];
$z ++;
}
}
$query4 = "UPDATE frm_threads ".
"SET ".
"thr_last_post = ".$ilDB->quote($lastPost_thr)." ".
"WHERE thr_pk = ".$ilDB->quote($p_node["tree"])."";
$this->ilias->db->query($query4);
}
// update num_posts in frm_data
$qu = "UPDATE frm_data ".
"SET ".
"top_num_posts = top_num_posts - ".$ilDB->quote($dead_pos)." ".
"WHERE top_frm_fk = ".$ilDB->quote($this->id)."";
$this->ilias->db->query($qu);
// get latest post of forum and update last_post
$q = "SELECT * FROM frm_posts, frm_data WHERE ";
$q .= "pos_top_fk = top_pk AND ";
$q .= "top_frm_fk = ".$ilDB->quote($this->id)." ";
$q .= "ORDER BY pos_date DESC";
$res2 = $this->ilias->db->query($q);
if ($res2->numRows() == 0)
{
$lastPost_top = "";
}
else
{
$z = 0;
while ($selData = $res2->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($z > 0)
{
break;
}
$lastPost_top = $selData["pos_top_fk"]."#".$selData["pos_thr_fk"]."#".$selData["pos_pk"];
$z ++;
}
}
$query5 = "UPDATE frm_data ".
"SET ".
"top_last_post = ".$ilDB->quote($lastPost_top)." ".
"WHERE top_frm_fk = ".$ilDB->quote($this->id)."";
$this->ilias->db->query($query5);
return $dead_thr;
}
Here is the call graph for this function:| ilForum::deletePostTree | ( | $ | a_node | ) |
delete node and the whole subtree under this node public
| array | node_data of a node |
Definition at line 1606 of file class.ilForum.php.
References $res.
Referenced by deletePost().
{
global $ilDB;
// GET LEFT AND RIGHT VALUES
$query = "SELECT * FROM frm_posts_tree ".
"WHERE thr_fk = ".$ilDB->quote($a_node["tree"])." ".
"AND pos_fk = ".$ilDB->quote($a_node["pos_pk"])." ".
"AND parent_pos = ".$ilDB->quote($a_node["parent"])."";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$a_node["lft"] = $row->lft;
$a_node["rgt"] = $row->rgt;
}
$diff = $a_node["rgt"] - $a_node["lft"] + 1;
// get data of posts
$query = "SELECT * FROM frm_posts_tree ".
"WHERE lft BETWEEN ".$ilDB->quote($a_node["lft"])." AND ".$ilDB->quote($a_node["rgt"])." ".
"AND thr_fk = ".$ilDB->quote($a_node["tree"])."";
$result = $this->ilias->db->query($query);
$del_id = array();
while ($treeData = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$del_id[] = $treeData["pos_fk"];
}
// delete subtree
$query = "DELETE FROM frm_posts_tree ".
"WHERE lft BETWEEN ".$ilDB->quote($a_node["lft"])." AND ".$ilDB->quote($a_node["rgt"])." ".
"AND thr_fk = ".$ilDB->quote($a_node["tree"])."";
$this->ilias->db->query($query);
// close gaps
$query = "UPDATE frm_posts_tree SET ".
"lft = CASE ".
"WHEN lft > ".$ilDB->quote($a_node["lft"])." ".
"THEN lft - ".$ilDB->quote($diff)." ".
"ELSE lft ".
"END, ".
"rgt = CASE ".
"WHEN rgt > ".$ilDB->quote($a_node["lft"])." ".
"THEN rgt - ".$ilDB->quote($diff)." ".
"ELSE rgt ".
"END ".
"WHERE thr_fk = ".$ilDB->quote($a_node["tree"])."";
$this->ilias->db->query($query);
return $del_id;
}
Here is the caller graph for this function:| ilForum::disableForumNotification | ( | $ | user_id | ) |
Disable a user's notification about new posts in this forum.
| integer | user_id A user's ID |
Definition at line 1966 of file class.ilForum.php.
{
global $ilDB;
$q = "DELETE FROM frm_notification WHERE ";
$q .= "user_id = ".$ilDB->quote($user_id)." AND ";
$q .= "frm_id = ".$ilDB->quote($this->id)."";
$this->ilias->db->query($q);
return true;
}
| ilForum::enableForumNotification | ( | $ | user_id | ) |
Enable a user's notification about new posts in this forum.
| integer | user_id A user's ID |
Definition at line 1920 of file class.ilForum.php.
References $res, and isForumNotificationEnabled().
{
global $ilDB;
if (!$this->isForumNotificationEnabled($user_id))
{
/* Remove all notifications of threads that belong to the forum */
$q = "SELECT frm_notification.thread_id FROM frm_data, frm_notification, frm_threads WHERE " .
"frm_notification.user_id = ".$ilDB->quote($user_id)." AND " .
"frm_notification.thread_id = frm_threads.thr_pk AND " .
"frm_threads.thr_top_fk = frm_data.top_pk AND " .
"frm_data.top_frm_fk = ".$this->id." " .
"GROUP BY frm_notification.thread_id";
$res = $this->ilias->db->query($q);
if (!DB::isError($res) &&
is_object($res) &&
$res->numRows() > 0)
{
$thread_ids = "";
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$thread_ids .= $row["thread_id"].",";
}
$thread_ids = substr($thread_ids, 0, strlen($thread_ids)-1);
$q = "DELETE FROM frm_notification WHERE " .
"user_id = ".$ilDB->quote($user_id)." AND " .
"thread_id IN (".$thread_ids.")";
$this->ilias->db->query($q);
}
/* Insert forum notification */
$q = "INSERT INTO frm_notification (user_id, frm_id) VALUES (";
$q .= $ilDB->quote($user_id).", ";
$q .= $ilDB->quote($this->id).")";
$this->ilias->db->query($q);
}
return true;
}
Here is the call graph for this function:| ilForum::enableThreadNotification | ( | $ | user_id, | |
| $ | thread_id | |||
| ) |
Enable a user's notification about new posts in a thread.
| integer | user_id A user's ID | |
| integer | thread_id ID of the thread |
Definition at line 2001 of file class.ilForum.php.
References isThreadNotificationEnabled().
{
global $ilDB;
if (!$this->isThreadNotificationEnabled($user_id, $thread_id))
{
$q = "INSERT INTO frm_notification (user_id, thread_id) VALUES (";
$q .= $ilDB->quote($user_id).", ";
$q .= $ilDB->quote($thread_id).")";
$this->ilias->db->query($q);
}
return true;
}
Here is the call graph for this function:| ilForum::fetchPostNodeData | ( | $ | a_row | ) |
get data of parent node from frm_posts_tree and frm_posts private
| object | db db result object containing node_data |
Definition at line 1533 of file class.ilForum.php.
References $data, $lng, and ilObject::_exists().
Referenced by getFirstPostNode(), getPostChilds(), getPostNode(), and getPostTree().
{
global $lng;
require_once('./Services/User/classes/class.ilObjUser.php');
if (ilObject::_exists($a_row->pos_usr_id))
{
$tmp_user = new ilObjUser($a_row->pos_usr_id);
$fullname = $tmp_user->getFullname();
$loginname = $tmp_user->getLogin();
}
$fullname = $fullname ? $fullname : ($a_row->import_name ? $a_row->import_name : $lng->txt("unknown"));
$data = array(
"pos_pk" => $a_row->pos_pk,
"child" => $a_row->pos_pk,
"author" => $a_row->pos_usr_id,
"alias" => $a_row->pos_usr_alias,
"title" => $fullname,
"loginname" => $loginname,
"type" => "post",
"message" => $a_row->pos_message,
"subject" => $a_row->pos_subject,
"pos_cens_com" => $a_row->pos_cens_com,
"pos_cens" => $a_row->pos_cens,
"date" => $a_row->date,
"create_date" => $a_row->pos_date,
"update" => $a_row->pos_update,
"update_user" => $a_row->update_user,
"tree" => $a_row->thr_fk,
"parent" => $a_row->parent_pos,
"lft" => $a_row->lft,
"rgt" => $a_row->rgt,
"depth" => $a_row->depth,
"id" => $a_row->fpt_pk,
"notify" => $a_row->notify,
"import_name" => $a_row->import_name,
"pos_status" => $a_row->pos_status
);
// why this line? data should be stored without slashes in db
//$data["message"] = stripslashes($data["message"]);
return $data ? $data : array();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::fixThreadNumber | ( | $ | a_top_pk, | |
| $ | a_num_threads | |||
| ) |
In some rare cases the thread number in frm_data is incorrect.
This function fixes this. (called in ilObjForumGUI->showThreadsObject())
Definition at line 315 of file class.ilForum.php.
{
global $ilDB;
if ($a_top_pk > 0)
{
$query = "UPDATE frm_data SET top_num_threads = ".
$ilDB->quote($a_num_threads)." WHERE top_pk = ".
$ilDB->quote($a_top_pk);
$ilDB->query($query);
}
}
| ilForum::formatNotification | ( | $ | post_data, | |
| $ | cron = 0 | |||
| ) |
Definition at line 2191 of file class.ilForum.php.
Referenced by sendForumNotifications(), and sendThreadNotifications().
{
global $ilIliasIniFile;
if ($cron == 1)
{
$message = sprintf($this->lng->txt("forums_notification_intro"),
$this->ilias->ini->readVariable("client","name"),
$ilIliasIniFile->readVariable("server","http_path"))."\n\n";
}
else
{
$message = sprintf($this->lng->txt("forums_notification_intro"),
$this->ilias->ini->readVariable("client","name"),
ILIAS_HTTP_PATH)."\n\n";
}
$message .= $this->lng->txt("forum").": ".$post_data["top_name"]."\n\n";
$message .= $this->lng->txt("thread").": ".$post_data["thr_subject"]."\n\n";
$message .= $this->lng->txt("new_post").":\n------------------------------------------------------------\n";
$message .= $this->lng->txt("author").": ".$post_data["pos_usr_name"]."\n";
$message .= $this->lng->txt("date").": ".$post_data["pos_date"]."\n";
$message .= $this->lng->txt("subject").": ".$post_data["pos_subject"]."\n\n";
if ($post_data["pos_cens"] == 1)
{
$message .= $post_data["pos_cens_com"]."\n";
}
else
{
$message .= $post_data["pos_message"]."\n";
}
$message .= "------------------------------------------------------------\n";
if ($cron == 1)
{
$message .= sprintf($this->lng->txt("forums_notification_show_post"), $ilIliasIniFile->readVariable("server","http_path")."/goto.php?target=frm_".$post_data["ref_id"]."_".$post_data["pos_thr_fk"]."_".$post_data["pos_pk"].'&client_id='.CLIENT_ID);
}
else
{
$message .= sprintf($this->lng->txt("forums_notification_show_post"), ILIAS_HTTP_PATH."/goto.php?target=frm_".$post_data["ref_id"]."_".$post_data["pos_thr_fk"]."_".$post_data["pos_pk"].'&client_id='.CLIENT_ID);
}
return $message;
}
Here is the caller graph for this function:| ilForum::formatNotificationSubject | ( | ) |
Definition at line 2186 of file class.ilForum.php.
Referenced by sendForumNotifications(), and sendThreadNotifications().
{
return $this->lng->txt("forums_notification_subject");
}
Here is the caller graph for this function:| ilForum::formatPostActivationNotification | ( | $ | post_data | ) |
Definition at line 2129 of file class.ilForum.php.
Referenced by sendPostActivationNotification().
{
$message = sprintf($this->lng->txt('forums_notification_intro'),
$this->ilias->ini->readVariable('client', 'name'),
ILIAS_HTTP_PATH)."\n\n";
$message .= $this->lng->txt("forum").": ".$post_data["top_name"]."\n\n";
$message .= $this->lng->txt("thread").": ".$post_data["thr_subject"]."\n\n";
$message .= $this->lng->txt("new_post").":\n------------------------------------------------------------\n";
$message .= $this->lng->txt("author").": ".$post_data["pos_usr_name"]."\n";
$message .= $this->lng->txt("date").": ".$post_data["pos_date"]."\n";
$message .= $this->lng->txt("subject").": ".$post_data["pos_subject"]."\n\n";
if ($post_data["pos_cens"] == 1)
{
$message .= $post_data["pos_cens_com"]."\n";
}
else
{
$message .= $post_data["pos_message"]."\n";
}
$message .= "------------------------------------------------------------\n";
$message .= sprintf($this->lng->txt('forums_notification_show_post'), ILIAS_HTTP_PATH."/goto.php?target=frm_".$post_data["ref_id"]."_".$post_data["pos_thr_fk"]."_".$post_data["pos_pk"].'&client_id='.CLIENT_ID);
return $message;
}
Here is the caller graph for this function:| ilForum::formatPostActivationNotificationSubject | ( | ) |
Definition at line 2124 of file class.ilForum.php.
Referenced by sendPostActivationNotification().
{
return $this->lng->txt('forums_notification_subject');
}
Here is the caller graph for this function:| ilForum::generatePost | ( | $ | forum_id, | |
| $ | thread_id, | |||
| $ | user, | |||
| $ | message, | |||
| $ | parent_pos, | |||
| $ | notify, | |||
| $ | subject = '', |
|||
| $ | alias = '', |
|||
| $ | date = '', |
|||
| $ | status = 1, |
|||
| $ | send_activation_mail = false | |||
| ) |
generate new dataset in frm_posts
| integer | $topic | |
| integer | $thread | |
| integer | $user | |
| string | $message | |
| integer | $parent_pos | |
| integer | $notify | |
| integer | $anonymize | |
| string | $subject | |
| datetime | $date |
Definition at line 426 of file class.ilForum.php.
References $user, __sendMessage(), addPostTree(), getForumRefId(), getImportName(), ilObjectFactory::getInstanceByRefId(), insertPostNode(), prepareText(), sendForumNotifications(), sendPostActivationNotification(), and sendThreadNotifications().
Referenced by generateThread().
{
global $ilUser, $ilDB;
if ($alias != '')
{
$user = 0;
}
$objNewPost = new ilForumPost();
$objNewPost->setForumId($forum_id);
$objNewPost->setThreadId($thread_id);
$objNewPost->setSubject($subject);
$objNewPost->setMessage(strip_tags($message));
$objNewPost->setUserId($user);
$objNewPost->setUserAlias($alias);
if ($date == "")
{
$objNewPost->setCreateDate(date("Y-m-d H:i:s"));
}
else
{
if (strpos($date, "-") > 0) // in mysql format
{
$objNewPost->setCreateDate($date);
}
else // a timestamp
{
$objNewPost->setCreateDate(date("Y-m-d H:i:s", $date));
}
}
$objNewPost->setImportName($this->getImportName());
$objNewPost->setNotification($notify);
$objNewPost->setStatus($status);
$objNewPost->insert();
// entry in tree-table
if ($parent_pos == 0)
{
$this->addPostTree($objNewPost->getThreadId(), $objNewPost->getId(), $objNewPost->getCreateDate());
}
else
{
$this->insertPostNode($objNewPost->getId(), $parent_pos, $objNewPost->getThreadId(), $objNewPost->getCreateDate());
}
//echo "<br>->".$objNewPost->getId()."-".$parent_pos."-".$objNewPost->getThreadId()."-".
// $objNewPost->getCreateDate()."-".$forum_id."-".$message."-".$user."-";
// string last post
$lastPost = $objNewPost->getForumId()."#".$objNewPost->getThreadId()."#".$objNewPost->getId();
// update thread
$q = "UPDATE frm_threads SET thr_num_posts = thr_num_posts + 1, ";
$q .= "thr_last_post = ".$ilDB->quote($lastPost). " ";
$q .= "WHERE thr_pk = ".$ilDB->quote($objNewPost->getThreadId())."";
$result = $this->ilias->db->query($q);
// update forum
$q = "UPDATE frm_data SET top_num_posts = top_num_posts + 1, ";
$q .= "top_last_post = ".$ilDB->quote($lastPost). " ";
$q .= "WHERE top_pk = ".$ilDB->quote($objNewPost->getForumId())."";
$result = $this->ilias->db->query($q);
// MARK READ
$forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId());
$forum_obj->markPostRead($objNewPost->getUserId(), $objNewPost->getThreadId(), $objNewPost->getId());
$pos_data = $objNewPost->getDataAsArray();
$pos_data["ref_id"] = $this->getForumRefId();
// FINALLY SEND MESSAGE
$this->__sendMessage($parent_pos, $pos_data);
// SEND NOTIFICATIONS ABOUT NEW POSTS IN A SPECIFIED TOPIC
if ($this->ilias->getSetting("forum_notification") == 1)
{
$pos_data["top_name"] = $forum_obj->getTitle();
$this->sendForumNotifications($pos_data);
$this->sendThreadNotifications($pos_data);
}
// Send notification to moderators if they have to enable a post
if (!$status && $send_activation_mail)
{
$pos_data["top_name"] = $forum_obj->getTitle();
$this->sendPostActivationNotification($pos_data);
}
// Add Notification to news
if ($status)
{
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_item = new ilNewsItem();
$news_item->setContext($forum_obj->getId(), 'frm', $objNewPost->getId(), 'pos');
$news_item->setPriority(NEWS_NOTICE);
$news_item->setTitle($objNewPost->getSubject());
$news_item->setContent($this->prepareText($objNewPost->getMessage(), 0));
$news_item->setUserId($user);
$news_item->setVisibility(NEWS_USERS);
$news_item->create();
}
return $objNewPost->getId();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::generateThread | ( | $ | forum_id, | |
| $ | user, | |||
| $ | subject, | |||
| $ | message, | |||
| $ | notify, | |||
| $ | notify_posts, | |||
| $ | alias = '', |
|||
| $ | date = '' | |||
| ) |
generate new dataset in frm_threads
| integer | $topic | |
| integer | $user | |
| string | $subject | |
| string | $message | |
| integer | $notify | |
| integer | $notify_posts | |
| integer | $anonymize | |
| datetime | $date |
Definition at line 543 of file class.ilForum.php.
References $user, generatePost(), and getImportName().
{
global $ilDB;
if ($alias != '')
{
$user = 0;
}
$objNewThread = new ilForumTopic();
$objNewThread->setForumId($forum_id);
$objNewThread->setUserId($user);
$objNewThread->setSubject($subject);
if ($date == "")
{
$objNewThread->setCreateDate(date("Y-m-d H:i:s"));
}
else
{
if (strpos($date, "-") > 0) // in mysql format
{
$objNewThread->setCreateDate($date);
}
else // a timestamp
{
$objNewThread->setCreateDate(date("Y-m-d H:i:s", $date));
}
}
$objNewThread->setImportName($this->getImportName());
$objNewThread->setUserAlias($alias);
$objNewThread->insert();
if ($notify_posts == 1)
{
$objNewThread->enableNotification($user);
}
// update forum
$query = "UPDATE frm_data SET top_num_threads = top_num_threads + 1
WHERE top_pk = ".$ilDB->quote($forum_id)." ";
$this->ilias->db->query($query);
return $this->generatePost($forum_id, $objNewThread->getId(), $user, $message, 0, $notify, $subject, $alias, $date);
}
Here is the call graph for this function:| ilForum::getAllForums | ( | ) |
Definition at line 651 of file class.ilForum.php.
References $res.
{
$query = "SELECT *
FROM frm_data
WHERE 1 ";
if ($this->whereCondition != '') $query .= $this->whereCondition;
$res = $this->ilias->db->query($query);
$counter = 0;
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$forums[$counter] = $row;
++$counter;
}
return is_array($forums) ? $forums : array();
}
| ilForum::getAllThreads | ( | $ | a_topic_id, | |
| $ | is_moderator = false | |||
| ) |
Get all threads of given thread.
| integer | topic: Forum-ID |
Definition at line 1015 of file class.ilForum.php.
References $res.
{
global $ilDB, $ilUser;
$this->threads = array();
$query = "SELECT *, MAX(pos_date) AS post_date
FROM `frm_threads`
LEFT JOIN frm_posts ON pos_thr_fk = thr_pk ";
if (!$is_moderator) $query .= " AND (pos_status = '1' OR (pos_status = '0' AND pos_usr_id = ".$ilDB->quote($ilUser->getId()).")) ";
$query .="WHERE 1
AND thr_top_fk = ".$ilDB->quote($a_topic_id)."
GROUP BY thr_pk
ORDER BY is_sticky DESC, post_date DESC, thr_date DESC";
$res = $this->ilias->db->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->threads[] = new ilForumTopic($row->thr_pk);
}
return $this->threads;
}
| ilForum::getDbTable | ( | ) |
get name of database table
Definition at line 211 of file class.ilForum.php.
{
return $this->dbTable;
}
| ilForum::getFirstPostByThread | ( | $ | a_thread_id | ) |
Get first post of thread.
public
| int | thread id |
Definition at line 1109 of file class.ilForum.php.
References $res.
Referenced by updatePost().
{
global $ilDB;
$query = "SELECT * FROM frm_posts_tree ".
"WHERE thr_fk = ".$ilDB->quote($a_thread_id)." ".
"AND parent_pos = 0";
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return $row->pos_fk ? $row->pos_fk : 0;
}
Here is the caller graph for this function:| ilForum::getFirstPostNode | ( | $ | tree_id | ) |
get data of the first node from frm_posts_tree and frm_posts public
| integer | tree id |
Definition at line 1491 of file class.ilForum.php.
References $res, and fetchPostNodeData().
{
global $ilDB;
$query = "SELECT * FROM frm_posts, frm_posts_tree ".
"WHERE pos_pk = pos_fk ".
"AND parent_pos = 0 ".
"AND thr_fk = ".$ilDB->quote($tree_id)."";
$res = $this->ilias->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return $this->fetchPostNodeData($row);
}
Here is the call graph for this function:| ilForum::getForumId | ( | ) |
get forum id public
Definition at line 143 of file class.ilForum.php.
Referenced by __deletePostFiles(), countActiveUserArticles(), countUserArticles(), and getUserStatistic().
{
return $this->id;
}
Here is the caller graph for this function:| ilForum::getForumPath | ( | $ | a_ref_id | ) |
builds a string to show the forum-context
| integer | ref_id |
Definition at line 1268 of file class.ilForum.php.
{
global $tree;
$path = "";
$tmpPath = $tree->getPathFull($a_ref_id);
// count -1, to exclude the forum itself
for ($i = 0; $i < (count($tmpPath)-1); $i++)
{
if ($path != "")
{
$path .= " > ";
}
$path .= $tmpPath[$i]["title"];
}
return $path;
}
| ilForum::getForumRefId | ( | ) |
get forum ref_id public
Definition at line 153 of file class.ilForum.php.
Referenced by __formatMessage(), generatePost(), and getModerators().
{
return $this->ref_id;
}
Here is the caller graph for this function:| ilForum::getImportName | ( | ) |
Definition at line 1905 of file class.ilForum.php.
Referenced by generatePost(), and generateThread().
{
return $this->import_name;
}
Here is the caller graph for this function:| ilForum::getLastPost | ( | $ | lastPost | ) |
get content of given ID's
| string | $lastPost: ID's, separated with # |
Definition at line 1128 of file class.ilForum.php.
References $data, convertDate(), and prepareText().
{
$data = explode('#', $lastPost);
$objLastPost = new ilForumPost($data[2]);
// limit the message-size
$message = $this->prepareText($objLastPost->getMessage(), 2);
if (strpos($message, $this->txtQuote2) > 0)
{
$viewPos = strrpos($message, $this->txtQuote2) + strlen($this->txtQuote2);
$message = substr($message, $viewPos);
}
if (strlen($message) > 40)
{
$message = substr($objLastPost->getMessage(), 0, 37).'...';
}
$result["pos_message"] = $result["pos_message"];
// convert date
$objLastPost->setCreateDate($this->convertDate($objLastPost->getCreateDate()));
return $objLastPost;
}
Here is the call graph for this function:| ilForum::getModeratorFromPost | ( | $ | pos_pk | ) |
get one post-dataset
| integer | post id |
Definition at line 1786 of file class.ilForum.php.
{
global $ilDB;
$q = "SELECT frm_data.* FROM frm_data, frm_posts WHERE ";
$q .= "pos_pk = ".$ilDB->quote($pos_pk)." AND ";
$q .= "pos_top_fk = top_pk";
$result = $this->ilias->db->getRow($q, DB_FETCHMODE_ASSOC);
return $result;
}
| ilForum::getModerators | ( | ) |
get all users assigned to local role il_frm_moderator_<frm_ref_id>
Definition at line 1176 of file class.ilForum.php.
References _getModerators(), and getForumRefId().
Referenced by sendPostActivationNotification().
{
global $rbacreview;
return $this->_getModerators($this->getForumRefId());
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::getOneDataset | ( | ) |
get one dataset from set Table and set WhereCondition
Definition at line 276 of file class.ilForum.php.
References $res, and setWhereCondition().
{
$q = "SELECT * FROM ".$this->dbTable." WHERE ( ".$this->whereCondition." )";
if ($this->orderField != "")
$q .= " ORDER BY ".$this->orderField;
$res = $this->ilias->db->getRow($q, DB_FETCHMODE_ASSOC);
$this->setWhereCondition("1");
return $res;
}
Here is the call graph for this function:| ilForum::getOnePost | ( | $ | post | ) |
get one post-dataset
| integer | post id |
Definition at line 369 of file class.ilForum.php.
References convertDate().
Referenced by __sendMessage().
{
global $ilDB;
$q = "SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data WHERE ";
$q .= "pos_pk = ".$ilDB->quote($post)." AND ";
$q .= "pos_usr_id = usr_id";
$result = $this->ilias->db->getRow($q, DB_FETCHMODE_ASSOC);
$result["pos_date"] = $this->convertDate($result["pos_date"]);
$result["pos_message"] = nl2br($result["pos_message"]);
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::getOneThread | ( | ) |
get one thread-dataset by WhereCondition
Definition at line 350 of file class.ilForum.php.
References setWhereCondition().
Referenced by __sendMessage().
{
$query = "SELECT * FROM frm_threads WHERE ( ".$this->whereCondition." )";
$result = $this->ilias->db->getRow($query, DB_FETCHMODE_ASSOC);
$this->setWhereCondition("1");
$result["thr_subject"] = trim($result["thr_subject"]);
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::getOneTopic | ( | ) |
get one topic-dataset by WhereCondition
Definition at line 296 of file class.ilForum.php.
References setWhereCondition().
Referenced by moveThreads().
{
$query = "SELECT * FROM frm_data WHERE ( ".$this->whereCondition." )";
$result = $this->ilias->db->getRow($query, DB_FETCHMODE_ASSOC);
$this->setWhereCondition("1");
if(is_null($result)) return NULL;
$result["top_name"] = trim($result["top_name"]);
$result["top_description"] = nl2br($result["top_description"]);
return $result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::getOrderField | ( | ) |
get name of orderField
Definition at line 182 of file class.ilForum.php.
{
return $this->orderField;
}
| ilForum::getPageHits | ( | ) |
get number of max.
visible datasets
Definition at line 264 of file class.ilForum.php.
{
return $this->pageHits;
}
| ilForum::getPostById | ( | $ | a_id | ) |
Definition at line 385 of file class.ilForum.php.
References $res.
| ilForum::getPostChilds | ( | $ | a_node_id, | |
| $ | a_thr_id | |||
| ) |
get child nodes of given node public
| integer | node_id | |
| string | sort order of returned childs, optional (possible values: 'title','desc','last_update' or 'type') | |
| string | sort direction, optional (possible values: 'DESC' or 'ASC'; defalut is 'ASC') |
Definition at line 1449 of file class.ilForum.php.
References fetchPostNodeData().
{
global $ilDB;
// init childs
$childs = array();
// number of childs
$count = 0;
$q = "SELECT * FROM frm_posts_tree,frm_posts ".
"WHERE frm_posts.pos_pk = frm_posts_tree.pos_fk ".
"AND frm_posts_tree.parent_pos = ".$ilDB->quote($a_node_id)." ".
"AND frm_posts_tree.thr_fk = ".$ilDB->quote($a_thr_id)." ".
"ORDER BY frm_posts_tree.lft DESC";
$r = $this->ilias->db->query($q);
$count = $r->numRows();
if ($count > 0)
{
while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
{
$childs[] = $this->fetchPostNodeData($row);
}
// mark the last child node (important for display)
$childs[$count - 1]["last"] = true;
return $childs;
}
else
{
return $childs;
}
}
Here is the call graph for this function:| ilForum::getPostDepth | ( | $ | a_node_id, | |
| $ | tree_id | |||
| ) |
Return depth of an object private.
| integer | node_id of parent's node_id | |
| integer | node_id of parent's node parent_id |
Definition at line 1389 of file class.ilForum.php.
References $res.
Referenced by insertPostNode().
{
global $ilDB;
if ($tree_id)
{
$query = "SELECT depth FROM frm_posts_tree ".
"WHERE pos_fk = ".$ilDB->quote($a_node_id)." ".
"AND thr_fk = ".$ilDB->quote($tree_id)."";
$res = $this->ilias->db->getRow($query);
return $res->depth;
}
else
{
return 0;
}
}
Here is the caller graph for this function:| ilForum::getPostList | ( | $ | topic, | |
| $ | thread | |||
| ) |
get all posts of given thread
| integer | topic: forum-ID | |
| integer | thread: thread-ID |
Definition at line 1047 of file class.ilForum.php.
References $res.
{
global $ilDB;
$q = "SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data WHERE ";
$q .= "pos_top_fk = ".$ilDB->quote($topic)." AND ";
$q .= "pos_thr_fk = ".$ilDB->quote($thread)." AND ";
$q .= "pos_usr_id = usr_id";
if ($this->orderField != "")
{
$q .= " ORDER BY ".$this->orderField;
}
$res = $this->ilias->db->query($q);
return $res;
}
| ilForum::getPostMaximumDepth | ( | $ | a_thr_id | ) |
Return the maximum depth in tree public.
Definition at line 1586 of file class.ilForum.php.
{
global $ilDB;
$q = "SELECT MAX(depth) FROM frm_posts_tree ".
"WHERE thr_fk = ".$ilDB->quote($a_thr_id)."";
$r = $this->ilias->db->query($q);
$row = $r->fetchRow();
return $row[0];
}
| ilForum::getPostNode | ( | $ | post_id | ) |
get data of given node from frm_posts_tree and frm_posts public
| integer | post_id |
Definition at line 1513 of file class.ilForum.php.
References $res, and fetchPostNodeData().
Referenced by deletePost().
{
global $ilDB;
$query = "SELECT * FROM frm_posts, frm_posts_tree ".
"WHERE pos_pk = pos_fk ".
"AND pos_pk = ".$ilDB->quote($post_id)."";
$res = $this->ilias->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return $this->fetchPostNodeData($row);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::getPostTree | ( | $ | a_node | ) |
get all nodes in the subtree under specified node
public
| array | node_data |
Definition at line 1416 of file class.ilForum.php.
References $res, and fetchPostNodeData().
{
global $ilDB;
$subtree = array();
$query = "SELECT * FROM frm_posts_tree ".
"LEFT JOIN frm_posts ON frm_posts.pos_pk = frm_posts_tree.pos_fk ".
"WHERE frm_posts_tree.lft BETWEEN ".$ilDB->quote($a_node["lft"])." AND ".$ilDB->quote($a_node["rgt"])." ".
"AND thr_fk = ".$ilDB->quote($a_node["tree"])."";
if ($this->orderField == "frm_posts_tree.date")
$query .= " ORDER BY ".$this->orderField." ASC";
else if ($this->orderField != "")
$query .= " ORDER BY ".$this->orderField." DESC";
//echo ":".$this->orderField.":<br>";
$res = $this->ilias->db->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$subtree[] = $this->fetchPostNodeData($row);
}
return $subtree;
}
Here is the call graph for this function:| ilForum::getUser | ( | $ | a_user_id | ) |
get content of given user-ID
| integer | $a_user_id: user-ID |
Definition at line 1163 of file class.ilForum.php.
{
$userObj = new ilObjUser($a_user_id);
return $userObj;
}
| ilForum::getUserData | ( | $ | a_id, | |
| $ | a_import_name = 0 | |||
| ) |
Definition at line 1877 of file class.ilForum.php.
References $lng, $res, ilObject::_exists(), ilObjUser::_lookupPref(), and ilObjectFactory::getInstanceByObjId().
{
global $lng, $ilDB;
if($a_id && ilObject::_exists($a_id) && ilObjectFactory::getInstanceByObjId($a_id,false))
{
$query = "SELECT * FROM usr_data WHERE usr_id = ".$ilDB->quote($a_id)."";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tmp_array["usr_id"] = $row->usr_id;
$tmp_array["login"] = $row->login;
$tmp_array["firstname"] = $row->firstname;
$tmp_array["lastname"] = $row->lastname;
$tmp_array["public_profile"] = ilObjUser::_lookupPref($a_id, "public_profile");
$tmp_array["create_date"] = $row->create_date;
}
return $tmp_array ? $tmp_array : array();
}
else
{
$login = $a_import_name ? $a_import_name." (".$lng->txt("imported").")" : $lng->txt("unknown");
return array("usr_id" => 0, "login" => $login, "firstname" => "", "lastname" => "");
}
}
Here is the call graph for this function:| ilForum::getUserStatistic | ( | $ | is_moderator = false |
) |
Definition at line 1066 of file class.ilForum.php.
References $res, and getForumId().
{
global $ilDB, $ilUser;
$statistic = array();
$query = "SELECT COUNT(f.pos_usr_id) as ranking, u.login, IF(p.value<>'n',u.lastname,'') as lastname, IF (p.value<>'n',u.firstname,'') as firstname
FROM frm_posts f, frm_posts_tree t, frm_threads th, usr_data u, frm_data d , usr_pref p
WHERE p.usr_id = u.usr_id AND p.keyword='public_profile'";
if (!$is_moderator) $query .= " AND (pos_status = '1' OR (pos_status = '0' AND pos_usr_id = ".$ilDB->quote($ilUser->getId()).")) ";
$query .="AND f.pos_pk = t.pos_fk
AND t.thr_fk = th.thr_pk
AND u.usr_id = f.pos_usr_id
AND d.top_pk = f.pos_top_fk
AND d.top_frm_fk = ".$ilDB->quote($this->getForumId())."
GROUP BY pos_usr_id";
$res = $this->ilias->db->query ($query);
$counter = 0;
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$statistic[$counter][] = $row['ranking'];
$statistic[$counter][] = $row['login'];
$statistic[$counter][] = $row['lastname'];
$statistic[$counter][] = $row['firstname'];
++$counter;
}
return is_array($statistic) ? $statistic : array();
}
Here is the call graph for this function:| ilForum::getWhereCondition | ( | ) |
get content of whereCondition
Definition at line 234 of file class.ilForum.php.
{
return $this->whereCondition;
}
| ilForum::ilForum | ( | ) |
| ilForum::insertPostNode | ( | $ | a_node_id, | |
| $ | a_parent_id, | |||
| $ | tree_id, | |||
| $ | a_date = '' | |||
| ) |
insert node under parent node public
| integer | node_id | |
| integer | tree_id | |
| integer | parent_id (optional) |
Definition at line 1340 of file class.ilForum.php.
References $left, $res, and getPostDepth().
Referenced by generatePost().
{
global $ilDB;
$a_date = $a_date ? $a_date : date("Y-m-d H:i:s");
// get left value
$query = "SELECT * FROM frm_posts_tree ".
"WHERE pos_fk = ".$ilDB->quote($a_parent_id)." ".
"AND thr_fk = ".$ilDB->quote($tree_id)."";
$res = $this->ilias->db->getRow($query);
$left = $res->lft;
$lft = $left + 1;
$rgt = $left + 2;
// spread tree
$query = "UPDATE frm_posts_tree SET ".
"lft = CASE ".
"WHEN lft > ".$ilDB->quote($left)." ".
"THEN lft + 2 ".
"ELSE lft ".
"END, ".
"rgt = CASE ".
"WHEN rgt > ".$ilDB->quote($left)." ".
"THEN rgt + 2 ".
"ELSE rgt ".
"END ".
"WHERE thr_fk = ".$ilDB->quote($tree_id)."";
$this->ilias->db->query($query);
$depth = $this->getPostDepth($a_parent_id, $tree_id) + 1;
// insert node
$query = "INSERT INTO frm_posts_tree (thr_fk,pos_fk,parent_pos,lft,rgt,depth,date) ".
"VALUES ".
"(".$ilDB->quote($tree_id).",".$ilDB->quote($a_node_id).",".$ilDB->quote($a_parent_id).",".$ilDB->quote($lft).",".
$ilDB->quote($rgt).",".$ilDB->quote($depth).",".$ilDB->quote($a_date).")";
$this->ilias->db->query($query);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::isForumNotificationEnabled | ( | $ | user_id | ) |
Check whether a user's notification about new posts in this forum is enabled (result > 0) or not (result == 0).
| integer | user_id A user's ID |
Definition at line 1984 of file class.ilForum.php.
Referenced by enableForumNotification().
{
global $ilDB;
$q = "SELECT COUNT(*) FROM frm_notification WHERE ";
$q .= "user_id = ".$ilDB->quote($user_id)." AND ";
$q .= "frm_id = ".$ilDB->quote($this->id);
return $this->ilias->db->getOne($q);
}
Here is the caller graph for this function:| 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).
| integer | user_id A user's ID | |
| integer | thread_id ID of the thread |
Definition at line 2023 of file class.ilForum.php.
Referenced by enableThreadNotification().
{
global $ilDB;
$q = "SELECT COUNT(*) FROM frm_notification WHERE ";
$q .= "user_id = ".$ilDB->quote($user_id)." AND ";
$q .= "thread_id = ".$ilDB->quote($thread_id)."";
return $this->ilias->db->getOne($q);
}
Here is the caller graph for this function:| ilForum::limitMsgString | ( | $ | message | ) |
Definition at line 2270 of file class.ilForum.php.
References prepareText().
{
// limit the message-size
$message = $this->prepareText($message, 2);
if (strpos($message, $this->txtQuote2) > 0)
{
$viewPos = strrpos($message, $this->txtQuote2) + strlen($this->txtQuote2);
$message = substr($message, $viewPos);
}
if (strlen($message) > 40)
{
$message = substr($message, 0, 37).'...';
}
return $this->prepareText($message);
}
Here is the call graph for this function:| ilForum::moveThreads | ( | $ | tread_ids = array(), |
|
| $ | src_ref_id = 0, |
|||
| $ | dest_top_frm_fk = 0 | |||
| ) |
Moves all chosen threads and their posts to a new forum.
| array | chosen thread pks | |
| integer | object id of src forum | |
| integer | object id of dest forum public |
Definition at line 678 of file class.ilForum.php.
References $id, $res, ilObject::_lookupObjectId(), getOneTopic(), and setWhereCondition().
{
$src_top_frm_fk = ilObject::_lookupObjectId($src_ref_id);
if (is_numeric($src_top_frm_fk) && $src_top_frm_fk > 0 && is_numeric($dest_top_frm_fk) && $dest_top_frm_fk > 0)
{
$this->setWhereCondition(" top_frm_fk = ".$this->ilias->db->quote($src_top_frm_fk));
$oldFrmData = $this->getOneTopic();
$this->setWhereCondition(" top_frm_fk = ".$this->ilias->db->quote($dest_top_frm_fk));
$newFrmData = $this->getOneTopic();
if ($oldFrmData['top_pk'] && $newFrmData['top_pk'])
{
$moved_posts = 0;
$moved_threads = 0;
$visits = 0;
foreach ($tread_ids as $id)
{
$objTmpThread = new ilForumTopic($id);
$numPosts = $objTmpThread->movePosts($src_top_frm_fk, $oldFrmData['top_pk'], $dest_top_frm_fk, $newFrmData['top_pk']);
if (($last_post_string = $objTmpThread->getLastPostString()) != '')
{
$last_post_string = explode('#', $last_post_string);
$last_post_string[0] = $newFrmData['top_pk'];
$last_post_string = implode('#', $last_post_string);
$objTmpThread->setLastPostString($last_post_string);
}
$visits += $objTmpThread->getVisits();
$moved_posts += $numPosts;
++$moved_threads;
$objTmpThread->setForumId($newFrmData['top_pk']);
$objTmpThread->update();
unset($objTmpThread);
}
// update frm_data source forum
$query = "SELECT pos_thr_fk, pos_pk
FROM frm_posts
WHERE 1
AND pos_top_fk = ".$this->ilias->db->quote($oldFrmData['top_pk'])."
ORDER BY pos_date DESC
LIMIT 1";
$res = $this->ilias->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$last_post_src = $oldFrmData['top_pk'] . '#' . $row->pos_thr_fk . '#' . $row->pos_pk;
$query = "UPDATE frm_data
SET
top_num_posts = top_num_posts - ".$this->ilias->db->quote($moved_posts).",
top_num_threads = top_num_threads - ".$this->ilias->db->quote($moved_threads).",
visits = visits - ".$this->ilias->db->quote($visits).",
top_last_post = ".$this->ilias->db->quote($last_post_src)."
WHERE 1
AND top_pk = ".$this->ilias->db->quote($oldFrmData['top_pk'])." ";
$this->ilias->db->query($query);
// update frm_data destination forum
$query = "SELECT pos_thr_fk, pos_pk
FROM frm_posts
WHERE 1
AND pos_top_fk = ".$this->ilias->db->quote($newFrmData['top_pk'])."
ORDER BY pos_date DESC
LIMIT 1";
$res = $this->ilias->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$last_post_dest = $newFrmData['top_pk'] . '#' . $row->pos_thr_fk . '#' . $row->pos_pk;
$query = "UPDATE frm_data
SET
top_num_posts = top_num_posts + ".$this->ilias->db->quote($moved_posts).",
top_num_threads = top_num_threads + ".$this->ilias->db->quote($moved_threads).",
visits = visits + ".$this->ilias->db->quote($visits).",
top_last_post = ".$this->ilias->db->quote($last_post_dest)."
WHERE 1
AND top_pk = ".$this->ilias->db->quote($newFrmData['top_pk'])." ";
$this->ilias->db->query($query);
/*
// update news items
include_once("./Services/News/classes/class.ilNewsItem.php");
$objNewsItem = new ilNewsItem();
$news_items = $objNewsItem->getNewsForRefId($src_ref_id);
foreach ($news_items as $news_item)
{
$tmpObjNewsItem = new ilNewsItem($news_item['id']);
if ($tmpObjNewsItem->getContextObjId() == $src_top_frm_fk)
{
$tmpObjNewsItem->setContextObjId($dest_top_frm_fk);
$tmpObjNewsItem->update();
}
unset($tmpObjNewsItem);
}
*/
}
}
}
Here is the call graph for this function:| ilForum::postCensorship | ( | $ | message, | |
| $ | pos_pk, | |||
| $ | cens = 0 | |||
| ) |
update dataset in frm_posts with censorship info
| string | message | |
| integer | pos_pk |
Definition at line 789 of file class.ilForum.php.
References $_SESSION, ilNewsItem::getFirstNewsIdForContext(), and prepareText().
{
global $ilDB;
$q = "UPDATE frm_posts ".
"SET ".
"pos_cens_com = ".$ilDB->quote($message).",".
"pos_update = '".date("Y-m-d H:i:s")."',".
"pos_cens = ".$ilDB->quote($cens).",".
"update_user = ".$ilDB->quote($_SESSION["AccountId"])." ".
"WHERE pos_pk = ".$ilDB->quote($pos_pk)."";
$this->ilias->db->query($q);
// Change news item accordingly
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id,
"frm", $pos_pk, "pos");
if ($news_id > 0)
{
if ($cens > 0) // censor
{
$news_item = new ilNewsItem($news_id);
//$news_item->setTitle($subject);
$news_item->setContent(nl2br($this->prepareText($message, 0)));
$news_item->update();
}
else // revoke censorship
{
// get original message
$q = "SELECT * FROM frm_posts ".
"WHERE pos_pk = ".$ilDB->quote($pos_pk)."";
$set = $ilDB->query($q);
$rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
$news_item = new ilNewsItem($news_id);
//$news_item->setTitle($subject);
$news_item->setContent(nl2br($this->prepareText($rec["pos_message"], 0)));
$news_item->update();
}
}
return true;
}
Here is the call graph for this function:| ilForum::prepareText | ( | $ | text, | |
| $ | edit = 0, |
|||
| $ | quote_user = "", |
|||
| $ | type = '' | |||
| ) |
prepares given string public
| string | ||
| integer |
Definition at line 1692 of file class.ilForum.php.
References $lng, and ilUtil::insertLatexImages().
Referenced by generatePost(), getLastPost(), limitMsgString(), postCensorship(), and updatePost().
{
global $lng;
if ($type == 'export')
{
$this->replQuote1 = "<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">";
$this->replQuote2 = "<hr size=\"1\" color=\"#000000\"/></blockquote>";
}
if ($edit == 1)
{
// add login name of quoted users
$lname = ($quote_user != "")
? '="'.$quote_user.'"'
: "";
$text = "[quote$lname]".$text."[/quote]";
}
else
{
// check for quotation
$startZ = substr_count ($text, "[quote"); // also count [quote="..."]
$endZ = substr_count ($text, "[/quote]");
if ($startZ > 0 || $endZ > 0)
{
// add missing opening and closing tags
if ($startZ > $endZ)
{
$diff = $startZ - $endZ;
for ($i = 0; $i < $diff; $i++)
{
if ($type == 'export') $text .= $this->txtQuote2;
else $text .= "[/quote]";
}
}
elseif ($startZ < $endZ)
{
$diff = $endZ - $startZ;
for ($i = 0; $i < $diff; $i++)
{
if ($type == 'export') $text .= $this->txtQuote1;
else $text = "[quote]".$text;
}
}
if ($edit == 0)
{
$ws= "[ \t\r\f\v\n]*";
$text = eregi_replace("\[(quote$ws=$ws\"([^\"]*)\"$ws)\]",
$this->replQuote1.'<div class="ilForumQuoteHead">'.$lng->txt("quote")." (\\2)".'</div>', $text);
$text = str_replace("[quote]",
$this->replQuote1.'<div class="ilForumQuoteHead">'.$lng->txt("quote").'</div>', $text);
$text = str_replace("[/quote]", $this->replQuote2, $text);
}
}
}
if ($type != 'export')
{
// this removes real slashes of the content (e.g. in latex code)
//$text = stripslashes($text);
if ($edit == 0)
{
$text = ilUtil::insertLatexImages($text);
}
/* if ($edit == 2)
{
$text = stripslashes($text);
}*/
// workaround for preventing template engine
// from hiding text that is enclosed
// in curly brackets (e.g. "{a}")
$text = str_replace("{", "{", $text);
$text = str_replace("}", "}", $text);
}
return $text;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::sendForumNotifications | ( | $ | post_data | ) |
Definition at line 2077 of file class.ilForum.php.
References $_SESSION, $res, ilObjUser::_lookupLogin(), formatNotification(), formatNotificationSubject(), and ilForumProperties::getInstance().
Referenced by generatePost().
{
global $ilDB;
include_once "Services/Mail/classes/class.ilMail.php";
include_once './Services/User/classes/class.ilObjUser.php';
// GET THREAD DATA
$q = "SELECT thr_subject FROM frm_threads WHERE ";
$q .= "thr_pk = ".$ilDB->quote($post_data["pos_thr_fk"])."";
$thread_subject = $this->ilias->db->getOne($q);
$post_data["thr_subject"] = $thread_subject;
// GET AUTHOR OF NEW POST
if(ilForumProperties::getInstance(self::_lookupObjIdForForumId($post_data['pos_top_fk']))->isAnonymized())
{
$post_data['pos_usr_name'] = $post_data['pos_usr_alias'];
}
else
{
$post_data['pos_usr_name'] = ilObjUser::_lookupLogin($post_data['pos_usr_id']);
}
if($post_data['pos_usr_name'] == '')
{
$post_data['pos_usr_name'] = $this->lng->txt('forums_anonymous');
}
// GET USERS WHO WANT TO BE INFORMED ABOUT NEW POSTS
$q = "SELECT frm_notification.user_id FROM frm_notification, frm_data WHERE ";
$q .= "frm_data.top_pk = ".$ilDB->quote($post_data["pos_top_fk"])." AND ";
$q .= "frm_notification.frm_id = frm_data.top_frm_fk AND ";
$q .= "frm_notification.user_id <> ".$ilDB->quote($_SESSION["AccountId"])." ";
$q .= "GROUP BY frm_notification.user_id";
$res = $this->ilias->db->query($q);
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
// SEND NOTIFICATIONS BY E-MAIL
$message = $mail_obj->sendMail(ilObjUser::_lookupLogin($row["user_id"]),"","",
$this->formatNotificationSubject(),
$this->formatNotification($post_data),
array(),array("system"));
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::sendPostActivationNotification | ( | $ | post_data | ) |
Definition at line 2157 of file class.ilForum.php.
References ilObjUser::_lookupLogin(), formatPostActivationNotification(), formatPostActivationNotificationSubject(), and getModerators().
Referenced by generatePost().
{
global $ilDB, $ilUser;
if (is_array($moderators = $this->getModerators()))
{
// GET THREAD DATA
$q = "SELECT thr_subject FROM frm_threads WHERE ";
$q .= "thr_pk = ".$ilDB->quote($post_data["pos_thr_fk"])."";
$thread_subject = $this->ilias->db->getOne($q);
$post_data["thr_subject"] = $thread_subject;
// GET AUTHOR OF NEW POST
$post_data["pos_usr_name"] = ilObjUser::_lookupLogin($post_data["pos_usr_id"]);
$subject = $this->formatPostActivationNotificationSubject();
$message = $this->formatPostActivationNotification($post_data);
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
foreach ($moderators as $moderator)
{
$message = $mail_obj->sendMail(ilObjUser::_lookupLogin($moderator), '', '',
$subject,
$message,
array(), array("system"));
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::sendThreadNotifications | ( | $ | post_data | ) |
Definition at line 2033 of file class.ilForum.php.
References $_SESSION, $res, ilObjUser::_lookupLogin(), formatNotification(), formatNotificationSubject(), and ilForumProperties::getInstance().
Referenced by generatePost().
{
global $ilDB;
include_once "Services/Mail/classes/class.ilMail.php";
include_once './Services/User/classes/class.ilObjUser.php';
// GET THREAD DATA
$q = "SELECT thr_subject FROM frm_threads WHERE ";
$q .= "thr_pk = ".$ilDB->quote($post_data["pos_thr_fk"])."";
$thread_subject = $this->ilias->db->getOne($q);
$post_data["thr_subject"] = $thread_subject;
// GET AUTHOR OF NEW POST
if(ilForumProperties::getInstance(self::_lookupObjIdForForumId($post_data['pos_top_fk']))->isAnonymized())
{
$post_data['pos_usr_name'] = $post_data['pos_usr_alias'];
}
else
{
$post_data['pos_usr_name'] = ilObjUser::_lookupLogin($post_data['pos_usr_id']);
}
if($post_data['pos_usr_name'] == '')
{
$post_data['pos_usr_name'] = $this->lng->txt('forums_anonymous');
}
// GET USERS WHO WANT TO BE INFORMED ABOUT NEW POSTS
$q = "SELECT user_id FROM frm_notification WHERE ";
$q .= "thread_id = ".$ilDB->quote($post_data["pos_thr_fk"])." AND ";
$q .= "user_id <> ".$ilDB->quote($_SESSION["AccountId"])."";
$res = $this->ilias->db->query($q);
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
// SEND NOTIFICATIONS BY E-MAIL
$message = $mail_obj->sendMail(ilObjUser::_lookupLogin($row["user_id"]),"","",
$this->formatNotificationSubject(),
$this->formatNotification($post_data),
array(),array("system"));
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForum::setDbTable | ( | $ | dbTable | ) |
| ilForum::setForumId | ( | $ | a_obj_id | ) |
set object id which refers to ILIAS obj_id
| integer | object id public |
Definition at line 111 of file class.ilForum.php.
{
if (!isset($a_obj_id))
{
$message = get_class($this)."::setForumId(): No obj_id given!";
$this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
}
$this->id = $a_obj_id;
}
| ilForum::setForumRefId | ( | $ | a_ref_id | ) |
set reference id which refers to ILIAS obj_id
| integer | object id public |
Definition at line 127 of file class.ilForum.php.
{
if (!isset($a_ref_id))
{
$message = get_class($this)."::setForumRefId(): No ref_id given!";
$this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
}
$this->ref_id = $a_ref_id;
}
| ilForum::setImportName | ( | $ | a_import_name | ) |
Definition at line 1909 of file class.ilForum.php.
{
$this->import_name = $a_import_name;
}
| ilForum::setLanguage | ( | $ | lng | ) |
| ilForum::setOrderField | ( | $ | orderField | ) |
set database field for sorting results
| string | $orderField database field for sorting |
Definition at line 164 of file class.ilForum.php.
References $orderField.
{
if ($orderField == "")
{
die($this->className . "::setOrderField(): No orderField given.");
}
else
{
$this->orderField = $orderField;
}
}
| ilForum::setPageHits | ( | $ | pageHits | ) |
set number of max.
visible datasets
| integer | $pageHits |
Definition at line 245 of file class.ilForum.php.
References $pageHits.
| ilForum::setWhereCondition | ( | $ | whereCondition = "1" |
) |
set content of WHERE condition
| string | $whereCondition |
Definition at line 222 of file class.ilForum.php.
References $whereCondition.
Referenced by __sendMessage(), getOneDataset(), getOneThread(), getOneTopic(), moveThreads(), and updateVisits().
{
$this->whereCondition = $whereCondition;
return true;
}
Here is the caller graph for this function:| ilForum::updatePost | ( | $ | message, | |
| $ | pos_pk, | |||
| $ | notify, | |||
| $ | subject, | |||
| $ | thr_pk = 0 | |||
| ) |
update dataset in frm_posts
| string | message | |
| integer | pos_pk |
Definition at line 595 of file class.ilForum.php.
References $_SESSION, ilNewsItem::getFirstNewsIdForContext(), getFirstPostByThread(), prepareText(), and updateThread().
{
global $ilDB;
$q = "UPDATE frm_posts ".
"SET ".
"pos_message = ".$ilDB->quote($message).",".
"pos_subject = ".$ilDB->quote($subject).",".
"pos_update = '".date("Y-m-d H:i:s")."',".
"update_user = ".$ilDB->quote($_SESSION["AccountId"]).", ".
"notify = ".$ilDB->quote($notify)." ".
"WHERE pos_pk = ".$ilDB->quote($pos_pk)."";
$this->ilias->db->query($q);
if ($thr_pk > 0 &&
$pos_pk == $this->getFirstPostByThread($thr_pk))
{
$this->updateThread($thr_pk,$subject);
}
// Change news item accordingly
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id,
"frm", $pos_pk, "pos");
if ($news_id > 0)
{
$news_item = new ilNewsItem($news_id);
$news_item->setTitle($subject);
$news_item->setContent(nl2br($this->prepareText($message, 0)));
$news_item->update();
}
return true;
}
Here is the call graph for this function:| ilForum::updateThread | ( | $ | thr_pk, | |
| $ | subject | |||
| ) |
update dataset in frm_threads
| integer | thr_pk | |
| string | subject |
Definition at line 638 of file class.ilForum.php.
Referenced by updatePost().
{
global $ilDB;
$q = "UPDATE frm_threads ".
"SET ".
"thr_subject = ".$ilDB->quote($subject)." ".
"WHERE thr_pk = ".$ilDB->quote($thr_pk)."";
$this->ilias->db->query($q);
return true;
}
Here is the caller graph for this function:| ilForum::updateVisits | ( | $ | ID | ) |
update page hits of given forum- or thread-ID public
| integer |
Definition at line 1667 of file class.ilForum.php.
References $_SESSION, and setWhereCondition().
{
$checkTime = time() - (60*60);
if ($_SESSION["frm_visit_".$this->dbTable."_".$ID] < $checkTime)
{
$_SESSION["frm_visit_".$this->dbTable."_".$ID] = time();
$q = "UPDATE ".$this->dbTable." SET ";
$q .= "visits = visits + 1 ";
$q .= "WHERE ( ".$this->whereCondition." )";
$this->ilias->db->query($q);
}
$this->setWhereCondition("1");
}
Here is the call graph for this function:| ilForum::$className = "ilForum" |
Definition at line 64 of file class.ilForum.php.
| ilForum::$dbTable |
Definition at line 57 of file class.ilForum.php.
Referenced by setDbTable().
| ilForum::$id |
Definition at line 85 of file class.ilForum.php.
Referenced by moveThreads().
| ilForum::$ilias |
Definition at line 48 of file class.ilForum.php.
Referenced by ilForum().
| ilForum::$lng |
Definition at line 49 of file class.ilForum.php.
Referenced by convertDate(), fetchPostNodeData(), getUserData(), ilForum(), prepareText(), and setLanguage().
| ilForum::$orderField |
Definition at line 72 of file class.ilForum.php.
Referenced by setOrderField().
| ilForum::$pageHits = 30 |
Definition at line 82 of file class.ilForum.php.
Referenced by setPageHits().
| ilForum::$replQuote1 = '<blockquote class="ilForumQuote">' |
Definition at line 78 of file class.ilForum.php.
| ilForum::$replQuote2 = '</blockquote>' |
Definition at line 79 of file class.ilForum.php.
ilForum::$threads = array() [private] |
Definition at line 87 of file class.ilForum.php.
Referenced by _getThreads().
| ilForum::$txtQuote1 = "[quote]" |
Definition at line 76 of file class.ilForum.php.
| ilForum::$txtQuote2 = "[/quote]" |
Definition at line 77 of file class.ilForum.php.
| ilForum::$whereCondition = "1" |
Definition at line 74 of file class.ilForum.php.
Referenced by setWhereCondition().
| const ilForum::SORT_DATE = 2 |
Definition at line 41 of file class.ilForum.php.
| const ilForum::SORT_TITLE = 1 |
Definition at line 40 of file class.ilForum.php.
Referenced by ilObjForumGUI::cloneWizardPageObject().
1.7.1