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 ($topic, $thread, $user, $message, $parent_pos, $notify, $anonymize, $subject, $date="") | |
generate new dataset in frm_posts | |
generateThread ($topic, $user, $subject, $message, $notify, $notify_posts, $anonymize, $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 | |
postCensorship ($message, $pos_pk, $cens=0) | |
update dataset in frm_posts with censorship info | |
deletePost ($post) | |
delete post and sub-posts | |
getThreadList ($topic) | |
get all threads of given forum | |
getPostList ($topic, $thread) | |
get all posts of given 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 | |
checkEditRight ($post_id) | |
checks edit-right for given post-ID | |
countUserArticles ($user) | |
get number of articles from given 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) | |
create a new post-tree | |
insertPostNode ($a_node_id, $a_parent_id, $tree_id) | |
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 | |
getFirstPostByThread ($a_thread_id) | |
Get first post of thread. | |
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) | |
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) | |
enableNotification ($user_id, $thread_id) | |
Enable a user's notification about new posts in a thread. | |
disableNotification ($user_id, $thread_id) | |
Disable a user's notification about new posts in a thread. | |
isNotificationEnabled ($user_id, $thread_id) | |
Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (result == 0). | |
sendNotifications ($post_data) | |
formatNotificationSubject () | |
formatNotification ($post_data, $cron=0) | |
isAnonymized () | |
Data Fields | |
$ilias | |
$lng | |
$dbTable | |
$className = "ilForum" | |
$orderField | |
$whereCondition = "1" | |
$txtQuote1 = "[quote]" | |
$txtQuote2 = "[/quote]" | |
$replQuote1 = '<blockquote class="ilForumQuote">' | |
$replQuote2 = '</blockquote>' | |
$pageHits = 30 | |
$id | |
$anonymized |
Definition at line 34 of file class.ilForum.php.
ilForum::__deletePostFiles | ( | $ | a_ids | ) |
Definition at line 1504 of file class.ilForum.php.
References $file, $files, and getForumId().
Referenced by deletePost().
{ if(!is_array($a_ids)) { return false; } include_once "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; }
ilForum::__formatMessage | ( | $ | thread_data, | |
$ | post_data = array() | |||
) |
Definition at line 1564 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 .= 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"]); return $message; }
ilForum::__formatSubject | ( | $ | thread_data | ) |
Definition at line 1559 of file class.ilForum.php.
Referenced by __sendMessage().
{ return $this->lng->txt("forums_notification_subject"); }
ilForum::__sendMessage | ( | $ | a_parent_pos, | |
$ | post_data = array() | |||
) |
Definition at line 1527 of file class.ilForum.php.
References $_SESSION, $tmp_user, __formatMessage(), __formatSubject(), getOnePost(), getOneThread(), and setWhereCondition().
Referenced by generatePost().
{ global $ilUser; $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 "./classes/class.ilMail.php"; include_once "./classes/class.ilObjUser.php"; $tmp_user =& new ilObjUser($parent_data["pos_usr_id"]); // NONSENSE $this->setWhereCondition("thr_pk='".$parent_data["pos_thr_fk"]."'"); $thread_data = $this->getOneThread(); #var_dump("<pre>",$thread_data,"<pre>"); #var_dump("<pre>",$parent_data,"<pre>"); $tmp_mail_obj = new ilMail($_SESSION["AccountId"]); $message = $tmp_mail_obj->sendMail($tmp_user->getLogin(),"","", $this->__formatSubject($thread_data), $this->__formatMessage($thread_data, $post_data), array(),array("normal")); unset($tmp_user); unset($tmp_mail_obj); } }
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 897 of file class.ilForum.php.
References $rbacreview, and $role_id.
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); if ($roleObj->getTitle() == "il_frm_moderator_".$a_ref_id) { return $rbacreview->assignedUsers($roleObj->getId()); } } return array(); }
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 925 of file class.ilForum.php.
References _getModerators().
{ return in_array($a_usr_id, ilForum::_getModerators($a_ref_id)); }
ilForum::_lookupForumData | ( | $ | a_obj_id | ) |
lookup forum data
Definition at line 324 of file class.ilForum.php.
References $query, and $result.
Referenced by ilObjForumListGUI::getProperties().
{ 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(stripslashes($result["top_name"])); $result["top_description"] = nl2br(stripslashes($result["top_description"])); return $result; }
ilForum::_lookupPostMessage | ( | $ | a_id | ) |
ilForum::addPostTree | ( | $ | a_tree_id, | |
$ | a_node_id = -1 | |||
) |
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 1032 of file class.ilForum.php.
References $query.
Referenced by generatePost().
{ 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 ". "('".$a_tree_id."','".$a_node_id."', 0, 1, 2, 1, '".date("Y-m-d H:i:s")."')"; $this->ilias->db->query($query); return true; }
ilForum::checkEditRight | ( | $ | post_id | ) |
checks edit-right for given post-ID
integer | $post_id: post-ID |
Definition at line 937 of file class.ilForum.php.
References $q, $rbacsystem, and $res.
{ global $rbacsystem; // is online-user the author of the post? $q = "SELECT * FROM frm_posts WHERE "; $q .= "pos_usr_id ='".$_SESSION["AccountId"]."' "; $q .= "AND pos_pk ='".$post_id."'"; $res = $this->ilias->db->query($q); // if not, is he authorised to edit? if ($res->numRows() > 0) { return true; } elseif ($rbacsystem->checkAccess("delete_post", $this->getForumRefId())) { return true; } else { return false; } }
ilForum::convertDate | ( | $ | date | ) |
converts the date format
string | $date |
Definition at line 1013 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); }
ilForum::countUserArticles | ( | $ | user | ) |
get number of articles from given user-ID
integer | $user: user-ID |
Definition at line 970 of file class.ilForum.php.
ilForum::deletePost | ( | $ | post | ) |
delete post and sub-posts
integer | $post: ID public |
Definition at line 631 of file class.ilForum.php.
References $q, $query, $query2, $query3, $query4, $query5, __deletePostFiles(), ilObjForum::_deleteAccessEntries(), ilObjForum::_deleteReadEntries(), deletePostTree(), and getPostNode().
{ include_once "./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 './classes/class.ilObjForum.php'; ilObjForum::_deleteAccessEntries($p_node['tree']); // delete thread $dead_thr = $p_node["tree"]; $query = "DELETE FROM frm_threads ". "WHERE thr_pk = '".$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 = '".$this->id."'"; $this->ilias->db->query($query2); // delete all posts of this thread $query3 = "DELETE FROM frm_posts ". "WHERE pos_thr_fk = '".$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 = '".$del_id[$i]."'"; $this->ilias->db->query($query); } // update num_posts in frm_threads $query2 = "UPDATE frm_threads ". "SET ". "thr_num_posts = thr_num_posts - $dead_pos ". "WHERE thr_pk = '".$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 = '".$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 = '".$lastPost_thr."' ". "WHERE thr_pk = '".$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 - $dead_pos ". "WHERE top_frm_fk = '".$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 ='".$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 = '".$lastPost_top."' ". "WHERE top_frm_fk = '".$this->id."'"; $this->ilias->db->query($query5); return $dead_thr; }
ilForum::deletePostTree | ( | $ | a_node | ) |
delete node and the whole subtree under this node public
array | node_data of a node |
Definition at line 1323 of file class.ilForum.php.
References $query, $res, $result, and $row.
Referenced by deletePost().
{ // GET LEFT AND RIGHT VALUES $query = "SELECT * FROM frm_posts_tree ". "WHERE thr_fk = '".$a_node["tree"]."' ". "AND pos_fk = '".$a_node["pos_pk"]."' ". "AND parent_pos = '".$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 '".$a_node["lft"]."' AND '".$a_node["rgt"]." '". "AND thr_fk = '".$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 '".$a_node["lft"]."' AND '".$a_node["rgt"]." '". "AND thr_fk = '".$a_node["tree"]."'"; $this->ilias->db->query($query); // close gaps $query = "UPDATE frm_posts_tree SET ". "lft = CASE ". "WHEN lft > '".$a_node["lft"]." '". "THEN lft - '".$diff." '". "ELSE lft ". "END, ". "rgt = CASE ". "WHEN rgt > '".$a_node["lft"]." '". "THEN rgt - '".$diff." '". "ELSE rgt ". "END ". "WHERE thr_fk = '".$a_node["tree"]."'"; $this->ilias->db->query($query); return $del_id; }
ilForum::disableNotification | ( | $ | user_id, | |
$ | thread_id | |||
) |
Disable 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 1645 of file class.ilForum.php.
ilForum::enableNotification | ( | $ | 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 1625 of file class.ilForum.php.
References $q, $user_id, and isNotificationEnabled().
{ if (!$this->isNotificationEnabled($user_id, $thread_id)) { $q = "INSERT INTO frm_notification (user_id, thread_id) VALUES ("; $q .= "'" . $user_id . "', "; $q .= "'" . $thread_id . "')"; $this->ilias->db->query($q); } return true; }
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 1254 of file class.ilForum.php.
References $data, $lng, $tmp_user, and ilObject::_exists().
Referenced by getFirstPostNode(), getPostChilds(), getPostNode(), and getPostTree().
{ global $lng; require_once("./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, "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 ); // why this line? data should be stored without slashes in db //$data["message"] = stripslashes($data["message"]); return $data ? $data : array(); }
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 307 of file class.ilForum.php.
References $query.
ilForum::formatNotification | ( | $ | post_data, | |
$ | cron = 0 | |||
) |
Definition at line 1711 of file class.ilForum.php.
Referenced by sendNotifications().
{ if ($cron == 1) { $message = sprintf($this->lng->txt("forums_notification_intro"), $this->ilias->ini->readVariable("client","name"), ILIAS_HTTP_PATH)."\n\n"; } else { $message = sprintf($this->lng->txt("forums_notification_intro"), $this->ilias->ini->readVariable("client","name"), "http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]))."\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"), ILIAS_HTTP_PATH."/goto.php?target=frm_".$post_data["ref_id"]."_".$post_data["pos_thr_fk"]); } else { $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"]); } return $message; }
ilForum::formatNotificationSubject | ( | ) |
Definition at line 1706 of file class.ilForum.php.
Referenced by sendNotifications().
{ return $this->lng->txt("forums_notification_subject"); }
ilForum::generatePost | ( | $ | topic, | |
$ | thread, | |||
$ | user, | |||
$ | message, | |||
$ | parent_pos, | |||
$ | notify, | |||
$ | anonymize, | |||
$ | subject, | |||
$ | date = "" | |||
) |
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 415 of file class.ilForum.php.
References $q, $result, $user, __sendMessage(), addPostTree(), getForumRefId(), getImportName(), ilObjectFactory::getInstanceByRefId(), insertPostNode(), ilUtil::prepareDBString(), and sendNotifications().
Referenced by generateThread().
{ $date = $date ? $date : date("Y-m-d H:i:s"); if ($anonymize == 1) { $user = 0; } $pos_data = array( "pos_top_fk" => $topic, "pos_thr_fk" => $thread, "pos_usr_id" => $user, "pos_message"=> strip_tags(addslashes($message)), "pos_subject" => addslashes($subject), "pos_date" => $date ); // insert new post into frm_posts $q = "INSERT INTO frm_posts "; $q .= "(pos_top_fk,pos_thr_fk,pos_usr_id,pos_message,pos_subject,pos_date,notify,import_name) "; $q .= "VALUES "; $q .= "('".$pos_data["pos_top_fk"]."','".$pos_data["pos_thr_fk"]."','".$pos_data["pos_usr_id"]."','"; $q .= $pos_data["pos_message"]."','".$pos_data["pos_subject"]."','".$pos_data["pos_date"]."','".$notify."','"; $q .= ilUtil::prepareDBString($this->getImportName())."')"; //echo "<br>2:".htmlentities($pos_data["pos_message"]); $result = $this->ilias->db->query($q); // get last insert id and return it $lastInsert = $this->ilias->db->getLastInsertId(); $pos_data["pos_pk"] = $lastInsert; // entry in tree-table if ($parent_pos == 0) { $this->addPostTree($thread, $lastInsert); } else { $this->insertPostNode($lastInsert,$parent_pos,$thread); } // string last post $lastPost = $topic."#".$thread."#".$lastInsert; // update thread $q = "UPDATE frm_threads SET thr_num_posts = thr_num_posts + 1, "; $q .= "thr_last_post = '".$lastPost. "' "; $q .= "WHERE thr_pk = '" . $thread . "'"; $result = $this->ilias->db->query($q); // update topic $q = "UPDATE frm_data SET top_num_posts = top_num_posts + 1, "; $q .= "top_last_post = '" .$lastPost. "' "; $q .= "WHERE top_pk = '" . $topic . "'"; $result = $this->ilias->db->query($q); // MARK READ $forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId()); $forum_obj->markPostRead($user,$thread,$lastInsert); $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->sendNotifications($pos_data); } return $lastInsert; }
ilForum::generateThread | ( | $ | topic, | |
$ | user, | |||
$ | subject, | |||
$ | message, | |||
$ | notify, | |||
$ | notify_posts, | |||
$ | anonymize, | |||
$ | 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 502 of file class.ilForum.php.
References $q, $result, $user, generatePost(), getForumRefId(), getImportName(), ilObjectFactory::getInstanceByRefId(), and ilUtil::prepareDBString().
{ $date = $date ? $date : date("Y-m-d H:i:s"); if ($anonymize == 1) { $user = 0; } $thr_data = array( "thr_top_fk" => $topic, "thr_usr_id" => $user, "thr_subject" => addslashes($subject), "thr_date" => $date ); // insert new thread into frm_threads $q = "INSERT INTO frm_threads "; $q .= "(thr_top_fk,thr_usr_id,thr_subject,thr_date,thr_update,import_name) "; $q .= "VALUES "; $q .= "('".$thr_data["thr_top_fk"]."','".$thr_data["thr_usr_id"]."','". $thr_data["thr_subject"]."','".$thr_data["thr_date"]."','".$thr_data["thr_date"]."','". ilUtil::prepareDBString($this->getImportName())."')"; $result = $this->ilias->db->query($q); // get last insert id and return it $lastInsert = $this->ilias->db->getLastInsertId(); // update topic $q = "UPDATE frm_data SET top_num_threads = top_num_threads + 1 "; $q .= "WHERE top_pk = '" . $topic . "'"; $result = $this->ilias->db->query($q); if ($notify_posts == 1) { // User wants to be notified about any posts in his/her new thread $q = "INSERT INTO frm_notification "; $q .= "(user_id, thread_id) "; $q .= "VALUES "; $q .= "('".$user."','".$lastInsert."')"; $result = $this->ilias->db->query($q); } // MARK READ $forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId()); return $this->generatePost($topic, $lastInsert, $user, $message, 0, $notify, $anonymize, $subject, $date); }
ilForum::getDbTable | ( | ) |
get name of database table
Definition at line 204 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 1196 of file class.ilForum.php.
References $query, $res, and $row.
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; }
ilForum::getFirstPostNode | ( | $ | tree_id | ) |
get data of the first node from frm_posts_tree and frm_posts public
integer | tree id |
Definition at line 1216 of file class.ilForum.php.
References $query, $res, $row, and fetchPostNodeData().
{ $query = "SELECT * FROM frm_posts, frm_posts_tree ". "WHERE pos_pk = pos_fk ". "AND parent_pos = 0 ". "AND thr_fk = '".$tree_id."'"; $res = $this->ilias->db->query($query); $row = $res->fetchRow(DB_FETCHMODE_OBJECT); return $this->fetchPostNodeData($row); }
ilForum::getForumId | ( | ) |
get forum id public
Definition at line 136 of file class.ilForum.php.
Referenced by __deletePostFiles(), and isAnonymized().
{
return $this->id;
}
ilForum::getForumPath | ( | $ | a_ref_id | ) |
builds a string to show the forum-context
integer | ref_id |
Definition at line 986 of file class.ilForum.php.
References $tree.
{ 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 146 of file class.ilForum.php.
Referenced by __formatMessage(), generatePost(), generateThread(), and getModerators().
{
return $this->ref_id;
}
ilForum::getImportName | ( | ) |
Definition at line 1609 of file class.ilForum.php.
Referenced by generatePost(), and generateThread().
{
return $this->import_name;
}
ilForum::getLastPost | ( | $ | lastPost | ) |
get content of given ID's
string | $lastPost: ID's, separated with # |
Definition at line 830 of file class.ilForum.php.
References $q, $result, convertDate(), and prepareText().
{ $LP = explode("#", $lastPost); $q = "SELECT DISTINCT frm_posts.* FROM frm_posts WHERE "; //$q = "SELECT DISTINCT frm_posts.*, usr_data.login FROM frm_posts, usr_data WHERE "; $q .= "pos_top_fk = '".$LP[0]."' AND "; $q .= "pos_thr_fk = '".$LP[1]."' AND "; $q .= "pos_pk = '".$LP[2]."'"; //$q .= "pos_usr_id = usr_id"; $result = $this->ilias->db->getRow($q, DB_FETCHMODE_ASSOC); // limit the message-size $result["pos_message"] = $this->prepareText($result["pos_message"],2); if (strpos($result["pos_message"], $this->txtQuote2) > 0) { $viewPos = strrpos($result["pos_message"], $this->txtQuote2) + strlen($this->txtQuote2); $result["pos_message"] = substr($result["pos_message"], $viewPos); } if (strlen($result["pos_message"]) > 40) $result["pos_message"] = substr($result["pos_message"], 0, 37)."..."; $result["pos_message"] = stripslashes($result["pos_message"]); // convert date $result["pos_date"] = $this->convertDate($result["pos_date"]); return $result; }
ilForum::getModeratorFromPost | ( | $ | pos_pk | ) |
get one post-dataset
integer | post id |
Definition at line 1493 of file class.ilForum.php.
ilForum::getModerators | ( | ) |
get all users assigned to local role il_frm_moderator_<frm_ref_id>
Definition at line 883 of file class.ilForum.php.
References $rbacreview, _getModerators(), and getForumRefId().
{ global $rbacreview; return ilObjForum::_getModerators($this->getForumRefId()); }
ilForum::getOneDataset | ( | ) |
get one dataset from set Table and set WhereCondition
Definition at line 269 of file class.ilForum.php.
References $q, $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; }
ilForum::getOnePost | ( | $ | post | ) |
get one post-dataset
integer | post id |
Definition at line 361 of file class.ilForum.php.
References $q, $result, and convertDate().
Referenced by __sendMessage().
{ $q = "SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data WHERE "; $q .= "pos_pk = '".$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(stripslashes($result["pos_message"])); return $result; }
ilForum::getOneThread | ( | ) |
get one thread-dataset by WhereCondition
Definition at line 342 of file class.ilForum.php.
References $query, $result, and 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(stripslashes($result["thr_subject"])); return $result; }
ilForum::getOneTopic | ( | ) |
get one topic-dataset by WhereCondition
Definition at line 289 of file class.ilForum.php.
References $query, $result, and setWhereCondition().
{ $query = "SELECT * FROM frm_data WHERE ( ".$this->whereCondition." )"; $result = $this->ilias->db->getRow($query, DB_FETCHMODE_ASSOC); $this->setWhereCondition("1"); $result["top_name"] = trim(stripslashes($result["top_name"])); $result["top_description"] = nl2br(stripslashes($result["top_description"])); return $result; }
ilForum::getOrderField | ( | ) |
get name of orderField
Definition at line 175 of file class.ilForum.php.
{
return $this->orderField;
}
ilForum::getPageHits | ( | ) |
get number of max.
visible datasets
Definition at line 257 of file class.ilForum.php.
{
return $this->pageHits;
}
ilForum::getPostById | ( | $ | a_id | ) |
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 1154 of file class.ilForum.php.
References $q, $row, and fetchPostNodeData().
{ // 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 = '".$a_node_id."' ". "AND frm_posts_tree.thr_fk = '".$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; } }
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 1098 of file class.ilForum.php.
Referenced by insertPostNode().
{ if ($tree_id) { $query = "SELECT depth FROM frm_posts_tree ". "WHERE pos_fk = '".$a_node_id."' ". "AND thr_fk = '".$tree_id."'"; $res = $this->ilias->db->getRow($query); return $res->depth; } else { return 0; } }
ilForum::getPostList | ( | $ | topic, | |
$ | thread | |||
) |
get all posts of given thread
integer | topic: forum-ID | |
integer | thread: thread-ID |
Definition at line 807 of file class.ilForum.php.
{ $q = "SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data WHERE "; $q .= "pos_top_fk ='".$topic."' AND "; $q .= "pos_thr_fk ='".$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 1305 of file class.ilForum.php.
ilForum::getPostNode | ( | $ | post_id | ) |
get data of given node from frm_posts_tree and frm_posts public
integer | post_id |
Definition at line 1236 of file class.ilForum.php.
References $query, $res, $row, and fetchPostNodeData().
Referenced by deletePost().
{ $query = "SELECT * FROM frm_posts, frm_posts_tree ". "WHERE pos_pk = pos_fk ". "AND pos_pk = '".$post_id."'"; $res = $this->ilias->db->query($query); $row = $res->fetchRow(DB_FETCHMODE_OBJECT); return $this->fetchPostNodeData($row); }
ilForum::getPostTree | ( | $ | a_node | ) |
get all nodes in the subtree under specified node
public
array | node_data |
Definition at line 1123 of file class.ilForum.php.
References $query, $res, $row, and fetchPostNodeData().
{ $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 '".$a_node["lft"]."' AND '".$a_node["rgt"]."' ". "AND thr_fk = '".$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; }
ilForum::getThreadList | ( | $ | topic | ) |
get all threads of given forum
integer | topic: forum-ID |
Definition at line 777 of file class.ilForum.php.
{ $query = "SELECT frm_threads.* FROM frm_threads WHERE ". "thr_top_fk = '".$topic."' "; // DOES NOT WORK WITH UNKNOWN IMPORTED USERS // //$q = "SELECT frm_threads.*, usr_data.lastname FROM frm_threads, usr_data WHERE "; //$q .= "thr_top_fk ='".$topic."' AND "; //$q .= "thr_usr_id = usr_id"; // if ($this->orderField != "") { $query .= " ORDER BY ".$this->orderField; } $res = $this->ilias->db->query($query); return $res; }
ilForum::getUser | ( | $ | a_user_id | ) |
get content of given user-ID
integer | $a_user_id: user-ID |
Definition at line 870 of file class.ilForum.php.
{ $userObj = new ilObjUser($a_user_id); return $userObj; }
ilForum::getUserData | ( | $ | a_id, | |
$ | a_import_name = 0 | |||
) |
Definition at line 1582 of file class.ilForum.php.
References $lng, $query, $res, $row, ilObject::_exists(), and ilObjectFactory::getInstanceByObjId().
{ global $lng; if($a_id && ilObject::_exists($a_id) && ilObjectFactory::getInstanceByObjId($a_id,false)) { $query = "SELECT * FROM usr_data WHERE usr_id = '".$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["login"] = $row->login; $tmp_array["firstname"] = $row->firstname; $tmp_array["lastname"] = $row->lastname; } 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" => ""); } }
ilForum::getWhereCondition | ( | ) |
get content of whereCondition
Definition at line 227 of file class.ilForum.php.
{
return $this->whereCondition;
}
ilForum::ilForum | ( | ) |
ilForum::insertPostNode | ( | $ | a_node_id, | |
$ | a_parent_id, | |||
$ | tree_id | |||
) |
insert node under parent node public
integer | node_id | |
integer | tree_id | |
integer | parent_id (optional) |
Definition at line 1054 of file class.ilForum.php.
References $left, $lft, $query, $res, $rgt, and getPostDepth().
Referenced by generatePost().
{ // get left value $query = "SELECT * FROM frm_posts_tree ". "WHERE pos_fk = '".$a_parent_id."' ". "AND thr_fk = '".$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 > ".$left." ". "THEN lft + 2 ". "ELSE lft ". "END, ". "rgt = CASE ". "WHEN rgt > ".$left." ". "THEN rgt + 2 ". "ELSE rgt ". "END ". "WHERE thr_fk = '".$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 ". "('".$tree_id."','".$a_node_id."','".$a_parent_id."','".$lft."','".$rgt."','".$depth."','".date("Y-m-d H:i:s")."')"; $this->ilias->db->query($query); }
ilForum::isAnonymized | ( | ) |
Definition at line 1748 of file class.ilForum.php.
References $q, and getForumId().
{ $q = "SELECT anonymized FROM frm_settings WHERE "; $q .= "obj_id = '" . $this->getForumId() . "'"; return $this->ilias->db->getOne($q); }
ilForum::isNotificationEnabled | ( | $ | 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 1662 of file class.ilForum.php.
Referenced by enableNotification().
{ $q = "SELECT COUNT(*) FROM frm_notification WHERE "; $q .= "user_id = '" . $user_id . "' AND "; $q .= "thread_id = '". $thread_id . "'"; return $this->ilias->db->getOne($q); }
ilForum::postCensorship | ( | $ | message, | |
$ | pos_pk, | |||
$ | cens = 0 | |||
) |
update dataset in frm_posts with censorship info
string | message | |
integer | pos_pk |
Definition at line 611 of file class.ilForum.php.
References $q.
ilForum::prepareText | ( | $ | text, | |
$ | edit = 0 | |||
) |
prepares given string public
string | ||
integer |
Definition at line 1407 of file class.ilForum.php.
References $lng, and ilUtil::insertLatexImages().
Referenced by getLastPost().
{ global $lng; if ($edit == 1) { //$text = ereg_replace("\[quote\].*\[\/quote\]", "", $text); //$text = str_replace($this->txtQuote1, "", $text); //$text = str_replace($this->txtQuote2, "", $text); $text = $this->txtQuote1.$text.$this->txtQuote2; } else { // check for quotation $startZ = substr_count ($text, $this->txtQuote1); $endZ = substr_count ($text, $this->txtQuote2); if ($startZ > 0 || $endZ > 0) { if ($startZ > $endZ) { $diff = $startZ - $endZ; for ($i = 0; $i < $diff; $i++) { $text .= $this->txtQuote2; } } elseif ($startZ < $endZ) { $diff = $endZ - $startZ; for ($i = 0; $i < $diff; $i++) { $text = $this->txtQuote1.$text; } } // only one txtQuote can exist... /* if ($startZ > 1) { $start_firstPos = strpos($text, $this->txtQuote1); $text_s2 = str_replace($this->txtQuote1, "", substr($text, ($start_firstPos+strlen($this->txtQuote1)))); $text_s1 = substr($text, 0, ($start_firstPos+strlen($this->txtQuote1))); $text = $text_s1.$text_s2; } if ($endZ > 1) { $end_firstPos = strrpos($text, $this->txtQuote2); $text_e1 = str_replace($this->txtQuote2, "", substr($text, 0, $end_firstPos)); $text_e2 = substr($text, $end_firstPos); $text = $text_e1.$text_e2; }*/ if ($edit == 0) { $text = str_replace($this->txtQuote1, $this->replQuote1.'<div class="ilForumQuoteHead">'.$lng->txt("quote").'</div>', $text); $text = str_replace($this->txtQuote2, $this->replQuote2, $text); } } } // this removes real slashes of the content (e.g. in latex code) //$text = stripslashes($text); if ($edit == 0) { $text = ilUtil::insertLatexImages($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; }
ilForum::sendNotifications | ( | $ | post_data | ) |
Definition at line 1670 of file class.ilForum.php.
References $_SESSION, $q, $res, $row, ilObjUser::_lookupLogin(), formatNotification(), and formatNotificationSubject().
Referenced by generatePost().
{ include_once "./classes/class.ilMail.php"; include_once "./classes/class.ilObjUser.php"; // GET THREAD DATA $q = "SELECT thr_subject FROM frm_threads WHERE "; $q .= "thr_pk = '" . $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"]); // GET USERS WHO WANT TO BE INFORMED ABOUT NEW POSTS $q = "SELECT user_id FROM frm_notification WHERE "; $q .= "thread_id = '" . $post_data["pos_thr_fk"] . "' AND "; $q .= "user_id <> '" . $_SESSION["AccountId"] . "'"; $res = $this->ilias->db->query($q); if (!DB::isError($res) && is_object($res) && $res->numRows() > 0) { while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { // SEND NOTIFICATIONS BY E-MAIL $tmp_mail_obj = new ilMail($_SESSION["AccountId"]); $message = $tmp_mail_obj->sendMail(ilObjUser::_lookupLogin($row["user_id"]),"","", $this->formatNotificationSubject(), $this->formatNotification($post_data), array(),array("normal")); unset($tmp_mail_obj); } } }
ilForum::setDbTable | ( | $ | dbTable | ) |
ilForum::setForumId | ( | $ | a_obj_id | ) |
set object id which refers to ILIAS obj_id
integer | object id public |
Definition at line 104 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 120 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 1613 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 157 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 238 of file class.ilForum.php.
References $pageHits.
ilForum::setWhereCondition | ( | $ | whereCondition = "1" |
) |
set content of WHERE condition
string | $whereCondition |
Definition at line 215 of file class.ilForum.php.
References $whereCondition.
Referenced by __sendMessage(), getOneDataset(), getOneThread(), getOneTopic(), and updateVisits().
{ $this->whereCondition = $whereCondition; return true; }
ilForum::updatePost | ( | $ | message, | |
$ | pos_pk, | |||
$ | notify, | |||
$ | subject, | |||
$ | thr_pk = 0 | |||
) |
update dataset in frm_posts
string | message | |
integer | pos_pk |
Definition at line 561 of file class.ilForum.php.
References $q, getFirstPostByThread(), and updateThread().
{ $q = "UPDATE frm_posts ". "SET ". "pos_message = '".addslashes($message)."',". "pos_subject = '".addslashes($subject)."',". "pos_update = '".date("Y-m-d H:i:s")."',". "update_user = '".$_SESSION["AccountId"]."', ". "notify = '".$notify."' ". "WHERE pos_pk = '".$pos_pk."'"; $this->ilias->db->query($q); if ($thr_pk > 0 && $pos_pk == $this->getFirstPostByThread($thr_pk)) { $this->updateThread($thr_pk,$subject); } return true; }
ilForum::updateThread | ( | $ | thr_pk, | |
$ | subject | |||
) |
update dataset in frm_threads
integer | thr_pk | |
string | subject |
Definition at line 590 of file class.ilForum.php.
References $q.
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; }
ilForum::updateVisits | ( | $ | ID | ) |
update page hits of given forum- or thread-ID public
integer |
Definition at line 1382 of file class.ilForum.php.
References $_SESSION, $q, 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"); }
ilForum::$anonymized |
Definition at line 80 of file class.ilForum.php.
ilForum::$className = "ilForum" |
Definition at line 57 of file class.ilForum.php.
ilForum::$dbTable |
Definition at line 50 of file class.ilForum.php.
Referenced by setDbTable().
ilForum::$id |
Definition at line 78 of file class.ilForum.php.
ilForum::$ilias |
Definition at line 41 of file class.ilForum.php.
Referenced by ilForum().
ilForum::$lng |
Definition at line 42 of file class.ilForum.php.
Referenced by convertDate(), fetchPostNodeData(), getUserData(), ilForum(), prepareText(), and setLanguage().
ilForum::$orderField |
Definition at line 65 of file class.ilForum.php.
Referenced by setOrderField().
ilForum::$pageHits = 30 |
Definition at line 75 of file class.ilForum.php.
Referenced by setPageHits().
ilForum::$replQuote1 = '<blockquote class="ilForumQuote">' |
Definition at line 71 of file class.ilForum.php.
ilForum::$replQuote2 = '</blockquote>' |
Definition at line 72 of file class.ilForum.php.
ilForum::$txtQuote1 = "[quote]" |
Definition at line 69 of file class.ilForum.php.
ilForum::$txtQuote2 = "[/quote]" |
Definition at line 70 of file class.ilForum.php.
ilForum::$whereCondition = "1" |
Definition at line 67 of file class.ilForum.php.
Referenced by setWhereCondition().