Procedural File: forumfunction.inc.php
Source Location: /main/forum/forumfunction.inc.php
Page Details:
These files are a complete rework of the forum. The database structure is
based on phpBB but all the code is rewritten. A lot of new functionalities are added: - new view option: nested view
- quoting a message
Tags:
Includes:
approve_post [line 2346]
void approve_post(
$post_id $post_id, $action $action)
|
|
This function approves a post = change
Tags:
Parameters
| $post_id |
$post_id |
the id of the post that will be deleted |
| $action |
$action |
make the post visible or invisible |
change_lock_status [line 794]
string, change_lock_status(
$content $content, $id $id, $action $action)
|
|
This function changes the lock status in the database
Tags:
Parameters
| $content |
$content |
what is it that we want to (un)lock: forum category, forum, thread, post |
| $id |
$id |
the id of the content we want to (un)lock |
| $action |
$action |
do we lock (=>locked value in db = 1) or unlock (=> locked value in db = 0) |
change_visibility [line 767]
void change_visibility(
$content $content, $id $id, $target_visibility $target_visibility)
|
|
This function changes the visibility in the database (item_property)
Tags:
Parameters
| $content |
$content |
what is it that we want to make (in)visible: forum category, forum, thread, post |
| $id |
$id |
the id of the content we want to make invisible |
| $target_visibility |
$target_visibility |
what is the current status of the visibility (0 = invisible, 1 = visible) |
check_if_last_post_of_thread [line 597]
an check_if_last_post_of_thread(
$thread_id $thread_id)
|
|
This function gets the all information of the last (=most recent) post of the thread This can be done by sorting the posts that have the field thread_id=$thread_id and sort them by post_date
Tags:
Parameters
| $thread_id |
$thread_id |
the id of the thread we want to know the last post of. |
class_visible_invisible [line 971]
string class_visible_invisible(
boolean $current_visibility_status)
|
|
This function returns a piece of html code that make the links grey (=invisible for the student)
Tags:
Parameters
| boolean |
$current_visibility_status |
0/1: 0 = invisible, 1 = visible |
count_number_of_forums_in_category [line 1545]
int count_number_of_forums_in_category(
$cat_id $cat_id)
|
|
This function counts the number of forums inside a given category
Tags:
Parameters
| $cat_id |
$cat_id |
the id of the forum category |
delete_attachment [line 3012]
void delete_attachment(
post $id)
|
|
Delete the all the attachments from the DB and the file according to the post's id
Tags:
Parameters
delete_forum_forumcategory_thread [line 518]
void delete_forum_forumcategory_thread(
$content $content, $id $id)
|
|
This function deletes a forum or a forum category This function currently does not delete the forums inside the category, nor the threads and replies inside these forums. For the moment this is the easiest method and it has the advantage that it allows to recover fora that were acidently deleted when the forum category got deleted.
Tags:
Parameters
| $content |
$content |
= what we are deleting (a forum or a forum category) |
| $id |
$id |
The id of the forum category that has to be deleted. |
delete_post [line 555]
void delete_post(
$post_id $post_id)
|
|
This function deletes a forum post. This separate function is needed because forum posts do not appear in the item_property table (yet) and because deleting a post also has consequence on the posts that have this post as parent_id (they are also deleted). an alternative would be to store the posts also in item_property and mark this post as deleted (visibility = 2). We also have to decrease the number of replies in the thread table
Tags:
Parameters
| $post_id |
$post_id |
the id of the post that will be deleted |
display_forum_search_results [line 2876]
void display_forum_search_results(
$search_term)
|
|
Display the search results
Tags:
Parameters
display_lock_unlock_icon [line 666]
void display_lock_unlock_icon(
$content $content, $id $id, $current_visibility_status $current_lock_status, [ $additional_url_parameters = ''])
|
|
This function takes care of the display of the lock icon
Tags:
Parameters
| $content |
$content |
what is it that we want to (un)lock: forum category, forum, thread, post |
| $id |
$id |
the id of the content we want to (un)lock |
| $current_visibility_status |
$current_lock_status |
what is the current status of the visibility (0 = invisible, 1 = visible) |
| |
$additional_url_parameters |
|
display_up_down_icon [line 708]
void display_up_down_icon(
$content $content, $id $id, $list $list)
|
|
This function takes care of the display of the up and down icon
Tags:
Parameters
| $content |
$content |
what is it that we want to make (in)visible: forum category, forum, thread, post |
| $id |
$id |
is the id of the item we want to display the icons for |
| $list |
$list |
is an array of all the items. All items in this list should have an up and down icon except for the first (no up icon) and the last (no down icon) The key of this $list array is the id of the item. |
display_user_image [line 2131]
string display_user_image(
int $user_id, str $name)
|
|
This function displays the user image from the profile, with a link to the user's details.
Tags:
Parameters
| int |
$user_id |
User's database ID |
| str |
$name |
User's name |
display_user_link [line 2111]
void display_user_link(
$user_id, $name)
|
|
This function displays the firstname and lastname of the user as a link to the user tool.
Tags:
Parameters
display_visible_invisible_icon [line 626]
void display_visible_invisible_icon(
$content $content, $id $id, $current_visibility_status $current_visibility_status, [ $additional_url_parameters = ''])
|
|
This function takes care of the display of the visibility icon
Tags:
Parameters
| $content |
$content |
what is it that we want to make (in)visible: forum category, forum, thread, post |
| $id |
$id |
the id of the content we want to make invisible |
| $current_visibility_status |
$current_visibility_status |
what is the current status of the visibility (0 = invisible, 1 = visible) |
| |
$additional_url_parameters |
|
forum_not_allowed_here [line 2199]
void forum_not_allowed_here(
)
|
|
This function is called when the user is not allowed in this forum/thread/...
Tags:
forum_search [line 2840]
Display the search form for the forum and display the search results
Tags:
get_attachment [line 2993]
array get_attachment(
the $post_id)
|
|
Show a list with all the attachments according to the post's id
Tags:
Parameters
get_forumcategory_information [line 1520]
array get_forumcategory_information(
$forum_id $cat_id)
|
|
This function retrieves all the information of a given forumcategory id
Tags:
Parameters
| $forum_id |
$cat_id |
integer that indicates the forum |
get_forums [line 1079]
an get_forums(
[ $id = ''])
|
|
Retrieve all the forums (regardless of their category) or of only one. The forums are sorted according to the forum_order. Since it does not take the forum category into account there probably will be two or more forums that have forum_order=1, ...
Tags:
Parameters
get_forums_in_category [line 1042]
an get_forums_in_category(
integer $cat_id)
|
|
This function retrieves all the fora in a given forum category
Tags:
Parameters
| integer |
$cat_id |
the id of the forum category |
get_forums_of_group [line 3041]
array get_forums_of_group(
integer $group_id)
|
|
This function gets all the forum information of the all the forum of the group
Tags:
Parameters
| integer |
$group_id |
the id of the group we need the fora of (see forum.forum_of_group) |
get_forum_categories [line 989]
an get_forum_categories(
[$id $id = ''])
|
|
Retrieve all the information off the forum categories (or one specific) for the current course. The categories are sorted according to their sorting order (cat_order
Tags:
Parameters
| $id |
$id |
default ''. When an id is passed we only find the information about that specific forum category. If no id is passed we get all the forum categories. |
get_forum_information [line 1496]
array get_forum_information(
$forum_id $forum_id)
|
|
This function retrieves all the information of a given forum_id
Tags:
Parameters
| $forum_id |
$forum_id |
integer that indicates the forum |
get_last_post_information [line 1255]
array get_last_post_information(
$forum_id $forum_id, [$show_invisibles $show_invisibles = false])
|
|
This functions gets all the last post information of a certain forum
Tags:
Parameters
| $forum_id |
$forum_id |
the id of the forum we want to know the last post information of. |
| $show_invisibles |
$show_invisibles |
|
get_notifications [line 3211]
void get_notifications(
string $content, integer $id)
|
|
This function retrieves all the email adresses of the users who wanted to be notified about a new post in a certain forum or thread
Tags:
Parameters
| string |
$content |
does the user want to be notified about a forum or about a thread |
| integer |
$id |
the id of the forum or thread |
get_notifications_of_user [line 3319]
void get_notifications_of_user(
[integer $user_id = 0], [boolean $force = false])
|
|
Get all the notification subscriptions of the user = which forums and which threads does the user wants to be informed of when a new post is added to this thread
Tags:
Parameters
| integer |
$user_id |
the user_id of a user (default = 0 => the current user) |
| boolean |
$force |
force get the notification subscriptions (even if the information is already in the session |
get_posts [line 1378]
an get_posts(
$thread_id)
|
|
Retrieve all posts of a given thread
Tags:
Parameters
get_post_information [line 1449]
array get_post_information(
$forum_id $post_id)
|
|
This function retrieves all the information of a post
Tags:
Parameters
| $forum_id |
$post_id |
integer that indicates the forum |
get_post_topics_of_forum [line 2270]
void get_post_topics_of_forum(
$forum_id)
|
|
With this function we find the number of posts and topics in a given forum.
Tags:
Parameters
get_threads [line 1312]
an get_threads(
$forum_id)
|
|
Retrieve all the threads of a given forum
Tags:
Parameters
get_thread_information [line 1470]
array get_thread_information(
$forum_id $thread_id)
|
|
This function retrieves all the information of a thread
Tags:
Parameters
| $forum_id |
$thread_id |
integer that indicates the forum |
get_unaproved_messages [line 2379]
void get_unaproved_messages(
$forum_id $forum_id)
|
|
This function retrieves all the unapproved messages for a given forum This is needed to display the icon that there are unapproved messages in that thread (only the courseadmin can see this)
Tags:
Parameters
| $forum_id |
$forum_id |
the forum where we want to know the unapproved messages of |
get_whats_new [line 2217]
This function is used to find all the information about what's new in the forum tool
Tags:
handle_forum_and_forumcategories [line 86]
void handle_forum_and_forumcategories(
)
|
|
This function handles all the forum and forumcategories actions. This is a wrapper for the forum and forum categories. All this code code could go into the section where this function is called but this make the code there cleaner.
Tags:
handle_mail_cue [line 2472]
void handle_mail_cue(
$content, $id)
|
|
This function is called whenever something is made visible because there might be new posts and the user might have indicated that (s)he wanted to be informed about the new posts by mail.
Tags:
Parameters
icon [line 1422]
void icon(
$image_url $image_url, [$alt $alt = ''], [$title $title = ''])
|
|
This function return the html syntax for the image
Tags:
Parameters
| $image_url |
$image_url |
The url of the image (absolute or relative) |
| $alt |
$alt |
The alt text (when the images cannot be displayed). http://www.w3.org/TR/html4/struct/objects.html#adef-alt |
| $title |
$title |
The title of the image. Most browsers display this as 'tool tip'. http://www.w3.org/TR/html4/struct/global.html#adef-title |
increase_thread_view [line 2161]
void increase_thread_view(
$thread_id)
|
|
The thread view counter gets increased every time someone looks at the thread
Tags:
Parameters
move_post_form [line 2649]
This function displays the form for moving a post message to a different (already existing) or a new thread.
Tags:
move_thread_form [line 2590]
This function displays the form for moving a thread to a different (already existing) forum
Tags:
move_up_down [line 864]
void move_up_down(
$content $content, $direction $direction, $id $id)
|
|
This function moves a forum or a forum category up or down
Tags:
Parameters
| $content |
$content |
what is it that we want to make (in)visible: forum category, forum, thread, post |
| $direction |
$direction |
do we want to move it up or down. |
| $id |
$id |
the id of the content we want to make invisible |
prepare4display [line 2799]
mixed prepare4display(
[mixed $input = ''])
|
|
Prepares a string or an array of strings for display by stripping slashes
Tags:
Parameters
| mixed |
$input |
String or array of strings |
search_link [line 2965]
Return the link to the forum search page
Tags:
send_mail [line 2554]
void send_mail(
[ $user_info = array()], [ $thread_information = array()])
|
|
This function sends the mails for the mail notification
Tags:
Parameters
| |
$user_info |
|
| |
$thread_information |
|
send_notifications [line 3254]
unknown send_notifications(
[integer $forum_id = 0], [integer $thread_id = 0], [integer $post_id = 0])
|
|
Get all the users who need to receive a notification of a new post (those subscribed to the forum or the thread)
Tags:
Parameters
| integer |
$forum_id |
the id of the forum |
| integer |
$thread_id |
the id of the thread |
| integer |
$post_id |
the id of the post |
send_notification_mails [line 2405]
void send_notification_mails(
$thread_id, $reply_info)
|
|
This function sends the notification mails to everybody who stated that they wanted to be informed when a new post was added to a given thread.
Tags:
Parameters
set_notification [line 3155]
void set_notification(
string $content, integer $id, [ $add_only = false])
|
|
This function stores which users have to be notified of which forums or threads
Tags:
Parameters
| string |
$content |
does the user want to be notified about a forum or about a thread |
| integer |
$id |
the id of the forum or thread |
| |
$add_only |
|
show_add_forumcategory_form [line 145]
void show_add_forumcategory_form(
[ $inputvalues = array()])
|
|
This function displays the form that is used to add a forum category.
Tags:
Parameters
show_add_forum_form [line 181]
void show_add_forum_form(
[ $inputvalues = array()])
|
|
This function displays the form that is used to add a forum category.
Tags:
Parameters
show_add_post_form [line 1732]
void show_add_post_form(
[$action $action = ''], [ $id = ''], [ $form_values = ''])
|
|
This function displays the form that is used to add a post. This can be a new thread or a reply.
Tags:
Parameters
| $action |
$action |
is the parameter that determines if we are - newthread: adding a new thread (both empty) => No I-frame
- replythread: Replying to a thread ($action = replythread) => I-frame with the complete thread (if enabled)
4. quote: Quoting a message ($action= quotemessage) => I-frame with the complete thread (if enabled). The message will be in the reply. (I first thought not to put an I-frame here) |
| |
$id |
|
| |
$form_values |
|
show_edit_forumcategory_form [line 354]
void show_edit_forumcategory_form(
[ $inputvalues = array()])
|
|
This function displays the form that is used to edit a forum category. This is more or less a copy from the show_add_forumcategory_form function with the only difference that is uses some default values. I tried to have both in one function but this gave problems with the handle_forum_and_forumcategories function (storing was done twice)
Tags:
Parameters
show_edit_post_form [line 1979]
void show_edit_post_form(
array $current_post, array $current_thread, array $current_forum, [array $form_values = ''])
|
|
This function displays the form that is used to edit a post. This can be a new thread or a reply.
Tags:
Parameters
| array |
$current_post |
contains all the information about the current post |
| array |
$current_thread |
contains all the information about the current thread |
| array |
$current_forum |
contains all info about the current forum (to check if attachments are allowed) |
| array |
$form_values |
contains the default values to fill the form |
store_edit_post [line 2064]
void store_edit_post(
$values)
|
|
This function stores the edit of a post in the forum_post table.
Tags:
Parameters
store_forum [line 442]
void store_forum(
$values)
|
|
This function stores the forum in the database. The new forum is added to the end.
Tags:
Parameters
store_forumcategory [line 399]
void store_forumcategory(
$values)
|
|
This function stores the forum category in the database. The new category is added to the end.
Tags:
Parameters
store_move_post [line 2698]
void store_move_post(
$values)
|
|
Tags:
Parameters
store_move_thread [line 2771]
void store_move_thread(
$values)
|
|
Tags:
Parameters
store_reply [line 1843]
void store_reply(
$values)
|
|
This function stores a reply in the forum_post table. It also updates the forum_threads table (thread_replies +1 , thread_last_post, thread_date)
Tags:
Parameters
store_thread [line 1565]
void store_thread(
$values)
|
|
This function stores a new thread. This is done through an entry in the forum_thread table AND in the forum_post table because. The threads are also stored in the item_property table. (forum posts are not (yet))
Tags:
Parameters
update_thread [line 2178]
void update_thread(
$thread_id, $last_post_id, $post_date)
|
|
The relies counter gets increased every time somebody replies to the thread
Tags:
Parameters
| |
$thread_id |
|
| |
$last_post_id |
|
| |
$post_date |
|
|