Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

(no description)

Copyright: 2014 Andrew Robert Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1759 lines (65 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 47 functions


Functions that are not part of a class:

forum_count_unrated_posts()   X-Ref


forum_tp_count_discussion_read_records()   X-Ref


forum_get_user_discussions()   X-Ref


forum_tp_count_forum_posts()   X-Ref


forum_tp_count_forum_read_records()   X-Ref


forum_get_open_modes()   X-Ref


forum_get_child_posts()   X-Ref


forum_get_discussion_posts()   X-Ref


forum_get_ratings()   X-Ref


forum_get_tracking_link()   X-Ref


forum_tp_count_discussion_unread_posts()   X-Ref


forum_convert_to_roles()   X-Ref


forum_tp_get_read_records()   X-Ref


forum_tp_get_discussion_read_records()   X-Ref


forum_user_enrolled()   X-Ref


forum_user_can_view_post()   X-Ref


forum_shorten_post($message)   X-Ref


forum_is_subscribed()   X-Ref


forum_subscribe()   X-Ref


forum_unsubscribe()   X-Ref


forum_subscribed_users()   X-Ref


forum_is_forcesubscribed($forum)   X-Ref
Determine whether the forum is force subscribed.


forum_forcesubscribe($forumid, $value = 1)   X-Ref


forum_get_forcesubscribed($forum)   X-Ref


forum_get_subscribed_forums()   X-Ref


forum_get_optional_subscribed_forums()   X-Ref


forum_get_potential_subscribers()   X-Ref


forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare = false, $replyaddress = null)   X-Ref
Builds and returns the body of the email notification in plain text.

param: object $course
param: object $cm
param: object $forum
param: object $discussion
param: object $post
param: object $userfrom
param: object $userto
param: boolean $bare
param: string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8].
return: string The email body in plain text format.

forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress = null)   X-Ref
Builds and returns the body of the email notification in html format.

param: object $course
param: object $cm
param: object $forum
param: object $discussion
param: object $post
param: object $userfrom
param: object $userto
param: string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8].
return: string The email text in HTML format

forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfrom, $userto,$ownpost=false, $reply=false, $link=false, $rate=false, $footer="")   X-Ref
Given the data about a posting, builds up the HTML to display it and
returns the HTML in a string.  This is designed for sending via HTML email.

param: object $course
param: object $cm
param: object $forum
param: object $discussion
param: object $post
param: object $userfrom
param: object $userto
param: bool $ownpost
param: bool $reply
param: bool $link
param: bool $rate
param: string $footer
return: string

forum_cron_minimise_user_record(stdClass $user)   X-Ref
Removes properties from user record that are not necessary for sending post notifications.

param: stdClass $user
return: void, $user parameter is modified

forum_cron()   X-Ref
Function to be run periodically according to the scheduled task.

Finds all posts that have yet to be mailed out, and mails them out to all subscribers as well as other maintance
tasks.


forum_print_discussion($course, $cm, $forum, $discussion, $post, $mode, $canreply=NULL, $canrate=false)   X-Ref
Prints a forum discussion

param: stdClass $course
param: stdClass $cm
param: stdClass $forum
param: stdClass $discussion
param: stdClass $post
param: int $mode
param: mixed $canreply
param: bool $canrate

forum_post_nesting_cache()   X-Ref
Return a static array of posts that are open.

return: array

forum_should_start_post_nesting($id)   X-Ref
Return true for the first time this post was started

param: int $id The id of the post to start
return: bool

forum_should_end_post_nesting($id)   X-Ref
Return true when all the opens are nested with a close.

param: int $id The id of the post to end
return: bool

forum_print_post_start($post, $return = false)   X-Ref
Start a forum post container

param: object $post The post to print.
param: bool $return Return the string or print it
return: string

forum_print_post_end($post, $return = false)   X-Ref
End a forum post container

param: object $post The post to print.
param: bool $return Return the string or print it
return: string

forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=false, $reply=false, $link=false,$footer="", $highlight="", $postisread=null, $dummyifcantsee=true, $istracked=null, $return=false)   X-Ref
Print a forum post
This function should always be surrounded with calls to forum_print_post_start
and forum_print_post_end to create the surrounding container for the post.
Replies can be nested before forum_print_post_end and should reflect the structure of
thread.

param: object $post The post to print.
param: object $discussion
param: object $forum
param: object $cm
param: object $course
param: boolean $ownpost Whether this post belongs to the current user.
param: boolean $reply Whether to print a 'reply' link at the bottom of the message.
param: boolean $link Just print a shortened version of the post as a link to the full post.
param: string $footer Extra stuff to print after the message.
param: string $highlight Space-separated list of terms to highlight.
param: int $post_read true, false or -99. If we already know whether this user
param: boolean $dummyifcantsee When forum_user_can_see_post says that
param: bool|null $istracked
return: void

forum_print_posts_flat($course, &$cm, $forum, $discussion, $post, $mode, $reply, $forumtracked, $posts)   X-Ref

param: object $course
param: object $cm
param: object $forum
param: object $discussion
param: object $post
param: object $mode
param: bool $reply
param: bool $forumtracked
param: array $posts
return: void

forum_print_posts_threaded($course, &$cm, $forum, $discussion, $parent, $depth, $reply, $forumtracked, $posts)   X-Ref

return: void

forum_print_posts_nested($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $posts)   X-Ref

return: void

forum_print_latest_discussions($course, $forum, $maxdiscussions = -1, $displayformat = 'plain', $sort = '',$currentgroup = -1, $groupmode = -1, $page = -1, $perpage = 100, $cm = null)   X-Ref
Prints the discussion view screen for a forum.

param: object $course The current course object.
param: object $forum Forum to be printed.
param: int $maxdiscussions
param: string $displayformat The display format to use (optional).
param: string $sort Sort arguments for database query (optional).
param: int $currentgroup
param: int $groupmode Group mode of the forum (optional).
param: int $page Page mode, page to display (optional).
param: int $perpage The maximum number of discussions per page(optional)
param: stdClass $cm

forum_count_replies($post, $children = true)   X-Ref
Count the number of replies to the specified post.

param: object $post
param: bool $children
return: int

forum_scale_used()   X-Ref


forum_get_user_grades($forum, $userid = 0)   X-Ref
Return grade for given user or all users.

param: object $forum
param: int $userid optional user id, 0 means all users
return: array array of grades, false if none

forum_get_completion_state($course, $cm, $userid, $type)   X-Ref
Obtains the automatic completion state for this forum based on any conditions
in forum settings.

param: object $course Course
param: object $cm Course-module
param: int $userid User ID
param: bool $type Type of comparison (or/and; can be used as return value if no conditions)
return: bool True if completed, false if not. (If no conditions, then return