Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Files | |
file | access.php |
Plugin capabilities. | |
file | activity.php |
Forum activities search area. | |
file | activity_base.php |
Activity base class. | |
file | assessable_uploaded.php |
The mod_forum assessable uploaded event. | |
file | author.php |
Author vault class. | |
file | author.php |
Author exporter. | |
file | author.php |
Author class. | |
file | author.php |
Author data mapper. | |
file | backup_forum_activity_task.class.php |
Defines backup_forum_activity_task class. | |
file | backup_forum_settingslib.php |
@subpackage backup-moodle2 | |
file | backup_forum_stepslib.php |
@subpackage backup-moodle2 | |
file | behat_mod_forum.php |
Steps definitions related with the forum activity. | |
file | big_search_form.php |
Big search form. | |
file | builder.php |
Builder factory. | |
file | caches.php |
Defined caches used internally by the plugin. | |
file | capability.php |
Capability manager for the forum. | |
file | cognitive_depth.php |
Cognitive depth indicator - forum. | |
file | container.php |
Container class. | |
file | course_module_instance_list_viewed.php |
The mod_forum instance list viewed event. | |
file | course_module_viewed.php |
The mod_forum course module viewed event. | |
file | course_searched.php |
The mod_forum course searched event. | |
file | coverage.php |
Coverage information for the mod_forum component. | |
file | cron_task.php |
A scheduled task for forum cron. | |
file | cron_trait.php |
The forum module cron trait. | |
file | db_table_vault.php |
Abstract class for loading records from the DB. | |
file | deprecatedlib.php |
file | discussion.php |
Discussion vault class. | |
file | discussion.php |
Discussion renderer. | |
file | discussion.php |
Discussion exporter class. | |
file | discussion.php |
Discussion class. | |
file | discussion.php |
Discussion data mapper. | |
file | discussion_created.php |
The mod_forum discussion created event. | |
file | discussion_deleted.php |
The mod_forum discussion deleted event. | |
file | discussion_list.php |
Vault class for a discussion list. | |
file | discussion_list.php |
Discussion list renderer. | |
file | discussion_moved.php |
The mod_forum discussion moved event. | |
file | discussion_pinned.php |
The mod_forum discussion pinned event. | |
file | discussion_subscription_created.php |
The mod_forum discussion_subscription created event. | |
file | discussion_subscription_deleted.php |
The mod_forum discussion_subscription deleted event. | |
file | discussion_summaries.php |
Discussion summaries exporter. | |
file | discussion_summary.php |
Discussion summary exporter class. | |
file | discussion_summary.php |
Discussion summary class. | |
file | discussion_unpinned.php |
The mod_forum discussion unpinned event. | |
file | discussion_updated.php |
The mod_forum discussion updated event. | |
file | discussion_viewed.php |
The mod_forum discussion viewed event. | |
file | entity.php |
Entity factory. | |
file | events.php |
Forum event handler definition. | |
file | existing_subscriber_selector.php |
A type of forum. | |
file | export_form.php |
This file contains the form definition for discussion export. | |
file | exported_discussion.php |
Exported discussion builder class. | |
file | exported_discussion_summaries.php |
Exported discussion summaries builder class. | |
file | exported_posts.php |
Exported post builder class. | |
file | exporter.php |
Forum Exporter factory. | |
file | externallib.php |
External forum API. | |
file | extract_context.php |
Extract context vault preprocessor. | |
file | extract_record.php |
Extract record vault preprocessor. | |
file | extract_user.php |
Extract user vault preprocessor. | |
file | forum.php |
Forum vault class. | |
file | forum.php |
Forum Exporter. | |
file | forum.php |
Forum class. | |
file | forum.php |
Forum data mapper. | |
file | forum_gradeitem.php |
Grade item storage for mod_forum. | |
file | forum_post.php |
Forum post renderable. | |
file | forum_post_email.php |
Forum post renderable for e-mail. | |
file | forumreport.php |
Subplugin info class. | |
file | generator_trait.php |
The forum module trait with additional generator helpers. | |
file | gradeitems.php |
Grade item mappings for the activity. | |
file | group.php |
Course Group exporter. | |
file | legacy_data_mapper.php |
Legacy data mapper factory. | |
file | lib.php |
mod_forum data generator | |
file | lib.php |
file | lib.php |
Provides support for the conversion of moodle1 backup to the moodle2 format. | |
file | locallib.php |
Library of functions for forum outside of the core api. | |
file | log.php |
Definition of log events. | |
file | manager.php |
Managers factory. | |
file | mod_form.php |
file | observer.php |
Event observers used in forum. | |
file | post.php |
Forum posts search area. | |
file | post.php |
Post vault class. | |
file | post.php |
Post exporter class. | |
file | post.php |
Post class. | |
file | post.php |
Post data mapper. | |
file | post_attachment.php |
Post attachment vault class. | |
file | post_created.php |
The mod_forum post created event. | |
file | post_deleted.php |
The mod_forum post deleted event. | |
file | post_form.php |
File containing the form definition to post in the forum. | |
file | post_read_receipt_collection.php |
Post read receipt collection class. | |
file | post_read_receipt_collection.php |
Post read receipt collection class. | |
file | post_updated.php |
The mod_forum post updated event. | |
file | posts.php |
Posts renderer. | |
file | posts.php |
Posts exporter class. | |
file | potential_subscriber_selector.php |
A type of forum. | |
file | provider.php |
Privacy Subsystem implementation for mod_forum. | |
file | prune_form.php |
This file provides form for splitting discussions. | |
file | quick_search_form.php |
Quick search form renderable. | |
file | readtracking_disabled.php |
The mod_forum subscription created event. | |
file | readtracking_enabled.php |
The mod_forum read tracking enabled event. | |
file | refresh_forum_post_counts.php |
Adhoc task that updates all of the existing forum_post records with no wordcount or no charcount. | |
file | renderer.php |
This file contains a custom renderer class used by the forum module. | |
file | renderer.php |
Forum post renderable. | |
file | renderer.php |
Forum post renderable. | |
file | renderer.php |
Forum post renderable. | |
file | renderer.php |
Renderer factory. | |
file | renderer_textemail.php |
Forum post renderable. | |
file | renderer_textemail.php |
Forum post renderable. | |
file | renderer_textemail.php |
Forum post renderable. | |
file | reply_handler.php |
A Handler to process replies to forum posts. | |
file | restore_forum_activity_task.class.php |
@subpackage backup-moodle2 | |
file | restore_forum_stepslib.php |
@subpackage backup-moodle2 | |
file | rsslib.php |
This file adds support to rss feeds generation. | |
file | send_user_digests.php |
This file defines an adhoc task to send notifications. | |
file | send_user_notifications.php |
This file defines an adhoc task to send notifications. | |
file | services.php |
Forum external functions and service definitions. | |
file | settings.php |
file | social_breadth.php |
Social breadth indicator - forum. | |
file | sorter.php |
Class to sort items. | |
file | subcontext_info.php |
Privacy Subsystem implementation for mod_forum. | |
file | subscriber_selector_base.php |
A type of forum. | |
file | subscribers_viewed.php |
The mod_forum subscribers list viewed event. | |
file | subscription_created.php |
The mod_forum subscription created event. | |
file | subscription_deleted.php |
The mod_forum subscription deleted event. | |
file | subscriptions.php |
Forum subscription manager. | |
file | tag.php |
Tag areas in component mod_forum. | |
file | tasks.php |
Definition of Forum scheduled tasks. | |
file | upgrade.php |
This file keeps track of upgrades to the forum module. | |
file | url.php |
A URL factory for the forum. | |
file | user_report_viewed.php |
The mod_forum user report viewed event. | |
file | vault.php |
Vault factory. | |
file | version.php |
Version information. | |
Functions | |
object | forum_add_attachment ($post, $forum, $cm, $mform=null, $unused=null) |
If successful, this function returns the name of the file. More... | |
forum_add_discussion ($discussion, $mform=null, $unused=null, $userid=null) | |
Given an object containing all the necessary data, create a new discussion and return the id. More... | |
forum_add_instance ($forum, $mform=null) | |
STANDARD FUNCTIONS ///////////////////////////////////////////////////////////. More... | |
forum_add_new_post ($post, $mform, $unused=null) | |
Add a new post in an existing discussion. More... | |
forum_can_create_attachment ($forum, $context) | |
Check if the user can create attachments in a forum. More... | |
object | forum_change_discussionid ($postid, $discussionid) |
recursively sets the discussion field to $discussionid on $postid and all its children used when pruning a post More... | |
forum_check_blocking_threshold ($thresholdwarning) | |
Throws an error if the user is no longer allowed to post due to having reached or exceeded the number of posts specified in 'Post threshold for blocking' setting. More... | |
forum_check_throttling ($forum, $cm=null) | |
Returns a warning object if a user has reached the number of posts equal to the warning/blocking setting, or false if there is no warning to show. More... | |
forum_check_updates_since (cm_info $cm, $from, $filter=array()) | |
Check if the module has any update that affects the current user since a given time. More... | |
forum_cm_info_view (cm_info $cm) | |
Adds information about unread messages, that is only required for the course view page (and similar), to the course-module object. More... | |
forum_convert_to_roles () | |
forum_count_discussion_replies ($forumid, $forumsort="", $limit=-1, $page=-1, $perpage=0, $canseeprivatereplies=false) | |
Returns an array of counts of replies to each discussion. More... | |
object | forum_count_discussions ($forum, $cm, $course) |
@global object @global object @staticvar array $cache More... | |
forum_count_replies ($post, $children=true) | |
Count the number of replies to the specified post. More... | |
forum_count_unrated_posts () | |
object | forum_count_user_posts ($forumid, $userid) |
Get all the posts for a user in a forum suitable for forum_print_post. More... | |
forum_cron () | |
Function to be run periodically according to the scheduled task. More... | |
forum_cron_minimise_user_record (stdClass $user) | |
Removes properties from user record that are not necessary for sending post notifications. More... | |
object | forum_delete_discussion ($discussion, $fulldelete, $course, $cm, $forum) |
Deletes a discussion and handles all associated cleanup. More... | |
object | forum_delete_instance ($id) |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. More... | |
object | forum_delete_post ($post, $children, $course, $cm, $forum, $skipcompletion=false) |
Deletes a single forum post. More... | |
forum_discussion_is_locked ($forum, $discussion) | |
Determine whether the specified discussion is time-locked. More... | |
forum_discussion_pin ($modcontext, $forum, $discussion) | |
Set the discussion to pinned and trigger the discussion pinned event. More... | |
forum_discussion_unpin ($modcontext, $forum, $discussion) | |
Set discussion to unpinned and trigger the discussion unpin event. More... | |
object | forum_discussion_update_last_post ($discussionid) |
Sets the last post for a given discussion. More... | |
forum_discussion_view ($modcontext, $forum, $discussion) | |
Trigger the discussion viewed event. More... | |
object | forum_discussions_user_has_posted_in ($forumid, $userid) |
@global object More... | |
forum_extend_settings_navigation (settings_navigation $settingsnav, navigation_node $forumnode) | |
Adds module specific settings to the settings block. More... | |
forum_filter_user_groups_discussions () | |
forum_forcesubscribe ($forumid, $value=1) | |
forum_get_all_discussion_posts ($discussionid, $sort, $tracking=false) | |
Gets all posts in discussion including top parent. More... | |
forum_get_child_posts () | |
object | forum_get_completion_state ($course, $cm, $userid, $type) |
Obtains the automatic completion state for this forum based on any conditions in forum settings. More... | |
forum_get_context ($forumid, $context=null) | |
Determine the current context if one was not already specified. More... | |
object | forum_get_course_forum ($courseid, $type) |
@global object More... | |
forum_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any forum type wants to add 'extra' information for the course (see resource). More... | |
moodle_database | forum_get_courses_user_posted_in ($user, $discussionsonly=false, $includecontexts=true, $limitfrom=null, $limitnum=null) |
Gets all of the courses where the provided user has posted in a forum. More... | |
forum_get_default_sort_order ($desc=true, $compare='d.timemodified', $prefix='d', $pinned=true) | |
Get the sql to use in the ORDER BY clause for forum discussions. More... | |
forum_get_discussion_neighbours ($cm, $discussion, $forum) | |
Gets the neighbours (previous and next) of a discussion. More... | |
forum_get_discussion_posts () | |
forum_get_discussion_subscription_icon ($forum, $discussionid, $returnurl=null, $includetext=false) | |
Return the markup for the discussion subscription toggling icon. More... | |
forum_get_discussion_subscription_icon_preloaders () | |
Return a pair of spans containing classes to allow the subscribe and unsubscribe icons to be pre-loaded by a browser. More... | |
object | forum_get_discussions ($cm, $forumsort="", $fullpost=true, $unused=-1, $limit=-1, $userlastmodified=false, $page=-1, $perpage=0, $groupid=-1, $updatedsince=0) |
Get all discussions in a forum. More... | |
object | forum_get_discussions_count ($cm) |
@global object @global object @uses CONEXT_MODULE @uses VISIBLEGROUPS More... | |
object | forum_get_discussions_unread ($cm) |
@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS More... | |
forum_get_email_message_id ($postid, $usertoid) | |
Create a message-id string to use in the custom headers of forum notification emails. More... | |
forum_get_extra_capabilities () | |
Returns all other caps used in module. More... | |
forum_get_file_areas ($course, $cm, $context) | |
forum_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) | |
object | forum_get_firstpost_from_discussion ($discussionid) |
Given a discussion id, return the first post from the discussion. More... | |
forum_get_forcesubscribed ($forum) | |
forum_get_forum_types () | |
Returns array of forum types chooseable on the forum editing form. More... | |
forum_get_forum_types_all () | |
Returns array of all forum layout modes. More... | |
moodle_database | forum_get_forums_user_posted_in ($user, array $courseids=null, $discussionsonly=false, $limitfrom=null, $limitnum=null) |
Gets all of the forums a user has posted in for one or more courses. More... | |
forum_get_layout_modes (bool $useexperimentalui=false) | |
Returns array of forum layout modes. More... | |
forum_get_open_modes () | |
forum_get_optional_subscribed_forums () | |
forum_get_post_actions () | |
List the actions that correspond to a post of this module. More... | |
object | forum_get_post_from_log ($log) |
Given a log entry, return the forum post details for it. More... | |
object | forum_get_post_full ($postid) |
Gets a post with all info ready for forum_print_post Most of these joins are just to get the forum id. More... | |
moodle_database | forum_get_posts_by_user ($user, array $courses, $musthaveaccess=false, $discussionsonly=false, $limitfrom=0, $limitnum=50) |
Returns posts made by the selected user in the requested courses. More... | |
forum_get_potential_subscribers () | |
forum_get_ratings () | |
object | forum_get_readable_forums ($userid, $courseid=0) |
An array of forum objects that the user is allowed to read/search through. More... | |
object | forum_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) |
Returns all forum posts since a given time in specified forum. More... | |
forum_get_subscribe_link ($forum, $context, $messages=array(), $cantaccessagroup=false, $unused1=true, $backtoindex=false, $unused2=null) | |
Generate and return the subscribe or unsubscribe link for a forum. More... | |
forum_get_subscribed_forums () | |
forum_get_subscriptionmode_options () | |
List the options for forum subscription modes. More... | |
forum_get_tracking_link () | |
forum_get_user_digest_options ($user=null) | |
Retrieve the list of available user digest options. More... | |
forum_get_user_discussions () | |
forum_get_user_grades ($forum, $userid=0) | |
Return grade for given user or all users. More... | |
object | forum_get_user_involved_discussions ($forumid, $userid) |
Get all the discussions user participated in. More... | |
forum_get_user_maildigest_bulk ($digests, $user, $forumid) | |
Determine the maildigest setting for the specified user against the specified forum. More... | |
object | forum_get_user_posted_time ($did, $userid) |
Returns creation time of the first user's post in given discussion $DB. More... | |
object | forum_get_user_posts ($forumid, $userid) |
Get all the posts for a user in a forum suitable for forum_print_post. More... | |
forum_get_view_actions () | |
List the actions that correspond to a view of this module. More... | |
object | forum_go_back_to ($default) |
forum_grade_item_delete ($forum) | |
Delete grade item for given forum. More... | |
forum_grade_item_update ($forum, $ratings=null, $forumgrades=null) | |
Create/update grade items for given forum. More... | |
forum_grading_areas_list () | |
Lists all gradable areas for the advanced grading methods gramework. More... | |
forum_instance_created ($context, $forum) | |
Handle changes following the creation of a forum instance. More... | |
forum_is_author_hidden ($post, $forum) | |
Checks whether the author's name and picture for a given post should be hidden or not. More... | |
forum_is_cutoff_date_reached ($forum) | |
Determine whether the specified forum's cutoff date is reached. More... | |
forum_is_due_date_reached ($forum) | |
Determine whether the specified forum's due date is reached. More... | |
forum_is_forcesubscribed ($forum) | |
Determine whether the forum is force subscribed. More... | |
forum_is_subscribed () | |
forum_is_user_group_discussion (cm_info $cm, $discussiongroupid) | |
Returns whether the discussion group is visible by the current user or not. More... | |
forum_make_mail_html ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress=null) | |
Builds and returns the body of the email notification in html format. More... | |
forum_make_mail_post ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $ownpost=false, $reply=false, $link=false, $rate=false, $footer="") | |
Given the data about a posting, builds up the HTML to display it and returns the HTML in a string. More... | |
forum_make_mail_text ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare=false, $replyaddress=null) | |
Builds and returns the body of the email notification in plain text. More... | |
object | forum_move_attachments ($discussion, $forumfrom, $forumto) |
Given a discussion object that is being moved to $forumto, this function checks all posts in that discussion for attachments, and if any are found, these are moved to the new forum directory. More... | |
forum_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
forum_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) | |
forum_post_is_visible_privately ($post, $cm) | |
Check whether the forum post is a private reply visible to this user. More... | |
forum_post_nesting_cache () | |
Return a static array of posts that are open. More... | |
forum_post_subscription ($fromform, $forum, $discussion) | |
Given a new post, subscribes or unsubscribes as appropriate. More... | |
object | forum_print_attachments ($post, $cm, $type) |
Returns attachments as formated text/html optionally with separate images. More... | |
forum_print_discussion ($course, $cm, $forum, $discussion, $post, $mode, $canreply=NULL, $canrate=false) | |
Prints a forum discussion. More... | |
object | forum_print_discussion_header (&$post, $forum, $group=-1, $datestring="", $cantrack=true, $forumtracked=true, $canviewparticipants=true, $modcontext=null, $canviewhiddentimedposts=false) |
This function prints the overview of a discussion in the forum listing. More... | |
forum_print_latest_discussions ($course, $forum, $maxdiscussions=-1, $displayformat='plain', $sort='', $currentgroup=-1, $groupmode=-1, $page=-1, $perpage=100, $cm=null) | |
Prints the discussion view screen for a forum. More... | |
forum_print_mode_form ($id, $mode, $forumtype='') | |
Print the drop down that allows the user to select how they want to have the discussion displayed. More... | |
forum_print_overview () | |
object | forum_print_post ($post, $discussion, $forum, &$cm, $course, $ownpost=false, $reply=false, $link=false, $footer="", $highlight="", $postisread=null, $dummyifcantsee=true, $istracked=null, $return=false) |
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. More... | |
forum_print_post_end ($post, $return=false) | |
End a forum post container. More... | |
forum_print_post_start ($post, $return=false) | |
Start a forum post container. More... | |
object | forum_print_posts_flat ($course, &$cm, $forum, $discussion, $post, $mode, $reply, $forumtracked, $posts) |
@global object @uses FORUM_MODE_FLATNEWEST More... | |
object | forum_print_posts_nested ($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $posts) |
object | forum_print_posts_threaded ($course, &$cm, $forum, $discussion, $parent, $depth, $reply, $forumtracked, $posts) |
object | forum_print_recent_activity ($course, $viewfullnames, $timestart) |
Given a course and a date, prints a summary of all the new messages posted in the course since that date. More... | |
forum_print_recent_mod_activity ($activity, $courseid, $detail, $modnames, $viewfullnames) | |
Outputs the forum post indicated by $activity. More... | |
forum_rating_permissions ($contextid, $component, $ratingarea) | |
Return rating related permissions. More... | |
forum_rating_validate ($params) | |
Validates a submitted rating. More... | |
forum_reset_course_form_defaults ($course) | |
Course reset form defaults. More... | |
forum_reset_course_form_definition (&$mform) | |
Called by course/reset.php. More... | |
object | forum_reset_gradebook ($courseid, $type='') |
Removes all grades from gradebook. More... | |
object | forum_reset_userdata ($data) |
This function is used by the reset_course_userdata function in moodlelib. More... | |
forum_rss_delete_file ($forum) | |
Given a forum object, deletes all cached RSS files associated with it. More... | |
forum_rss_feed_contents ($forum, $sql, $params, $context) | |
This function return the XML rss contents about the forum It returns false if something is wrong. More... | |
forum_rss_feed_discussions_sql ($forum, $cm, $newsince=0) | |
Generates the SQL query used to get the Discussion details from the forum table of the database. More... | |
forum_rss_feed_posts_sql ($forum, $cm, $newsince=0) | |
Generates the SQL query used to get the Post details from the forum table of the database. More... | |
forum_rss_get_feed ($context, $args) | |
Returns the path to the cached rss feed contents. More... | |
forum_rss_get_group_sql ($cm, $groupmode, $currentgroup, $modcontext=null) | |
Retrieve the correct SQL snippet for group-only forums. More... | |
forum_rss_get_sql ($forum, $cm, $time=0) | |
Determines which type of SQL query is required, one for posts or one for discussions, and returns the appropriate query. More... | |
forum_rss_newstuff ($forum, $cm, $time) | |
If there is new stuff in the forum since $time this returns true Otherwise it returns false. More... | |
forum_scale_used () | |
forum_scale_used_anywhere (int $scaleid) | |
Checks if scale is being used by any instance of forum. More... | |
object | forum_search_form ($course, $search='') |
object | forum_search_posts ($searchterms, $courseid=0, $limitfrom=0, $limitnum=50, &$totalcount, $extrasql='') |
Returns a list of posts found using an array of search terms. More... | |
object | forum_set_return () |
@global object | |
forum_set_user_maildigest ($forum, $maildigest, $user=null) | |
Set the per-forum maildigest option for the specified user. More... | |
forum_shorten_post ($message) | |
forum_should_end_post_nesting ($id) | |
Return true when all the opens are nested with a close. More... | |
forum_should_start_post_nesting ($id) | |
Return true for the first time this post was started. More... | |
forum_subscribe () | |
forum_subscribed_users () | |
forum_supports ($feature) | |
Indicates API features that the forum supports. More... | |
object | forum_tp_add_read_record ($userid, $postid) |
Mark post as read. More... | |
object | forum_tp_can_track_forums ($forum=false, $user=false) |
Determine if a user can track forums and optionally a particular forum. More... | |
object | forum_tp_clean_read_records () |
Clean old records from the forum_read table. More... | |
forum_tp_count_discussion_read_records () | |
forum_tp_count_discussion_unread_posts () | |
forum_tp_count_forum_posts () | |
forum_tp_count_forum_read_records () | |
object | forum_tp_count_forum_unread_posts ($cm, $course, $resetreadcache=false) |
Returns the count of records for the provided user and forum and [optionally] group. More... | |
object | forum_tp_delete_read_records ($userid=-1, $postid=-1, $discussionid=-1, $forumid=-1) |
Deletes read records for the specified index. More... | |
object | forum_tp_get_course_unread_posts ($userid, $courseid) |
Returns the count of records for the provided user and course. More... | |
forum_tp_get_discussion_read_records () | |
forum_tp_get_read_records () | |
object | forum_tp_get_untracked_forums ($userid, $courseid) |
Get a list of forums not tracked by the user. More... | |
object | forum_tp_is_post_old ($post, $time=null) |
object | forum_tp_is_post_read ($userid, $post) |
object | forum_tp_is_tracked ($forum, $user=false) |
Tells whether a specific forum is tracked by the user. More... | |
object | forum_tp_mark_discussion_read ($user, $discussionid) |
Marks a whole discussion as read, for a given user. More... | |
object | forum_tp_mark_forum_read ($user, $forumid, $groupid=false) |
Marks a whole forum as read, for a given user. More... | |
forum_tp_mark_post_read ($userid, $post, $unused=null) | |
If its an old post, do nothing. More... | |
object | forum_tp_mark_posts_read ($user, $postids) |
Mark posts as read. More... | |
object | forum_tp_start_tracking ($forumid, $userid=false) |
@global object More... | |
object | forum_tp_stop_tracking ($forumid, $userid=false) |
@global object More... | |
forum_trigger_content_uploaded_event ($post, $cm, $name) | |
Sends post content to plagiarism plugin. More... | |
forum_trigger_post_updated_event ($post, $discussion, $context, $forum) | |
Trigger post updated event. More... | |
forum_unsubscribe () | |
forum_update_calendar ($forum, $cmid) | |
Update the calendar entries for this forum activity. More... | |
forum_update_grades ($forum, $userid=0) | |
Update activity grades. More... | |
object | forum_update_instance ($forum, $mform) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data. More... | |
forum_update_post ($newpost, $mform, $unused=null) | |
Update a post. More... | |
object | forum_update_subscriptions_button ($courseid, $forumid) |
Prints the editing button on subscribers page. More... | |
object | forum_user_can_post ($forum, $discussion, $user=NULL, $cm=NULL, $course=NULL, $context=NULL) |
This function checks whether the user can reply to posts in a forum discussion. More... | |
object | forum_user_can_post_discussion ($forum, $currentgroup=null, $unused=-1, $cm=NULL, $context=NULL) |
forum_user_can_reply_privately (\context_module $context, stdClass $parent) | |
Check whether the user can reply privately to the parent post. More... | |
object | forum_user_can_see_discussion ($forum, $discussion, $context, $user=NULL) |
@global object @uses DEBUG_DEVELOPER More... | |
forum_user_can_see_group_discussion ($discussion, $cm, $context) | |
Check to ensure a user can view a group discussion. More... | |
forum_user_can_see_post ($forum, $discussion, $post, $user=null, $cm=null, $checkdeleted=true) | |
Check whether a user can see the specified post. More... | |
forum_user_can_see_timed_discussion ($discussion, $user, $context) | |
Check to ensure a user can view a timed discussion. More... | |
forum_user_can_view_post () | |
object | forum_user_complete ($course, $user, $mod, $forum) |
@global object More... | |
forum_user_enrolled () | |
object | forum_user_has_posted ($forumid, $did, $userid) |
@global object More... | |
forum_user_has_posted_discussion ($forumid, $userid, $groupid=null) | |
Returns true if user created new discussion already. More... | |
forum_user_outline ($course, $user, $mod, $forum) | |
forum_view ($forum, $course, $cm, $context) | |
Mark the activity completed (if required) and trigger the course_module_viewed event. More... | |
mod_forum_core_calendar_event_action_shows_item_count (calendar_event $event, $itemcount=0) | |
Callback function that determines whether an action event should be showing its item count based on the event type and the item count. More... | |
mod_forum_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $forum) | |
This function will update the forum module according to the event that has been modified. More... | |
mod_forum_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $forum) | |
This function calculates the minimum and maximum cutoff values for the timestart of the given event. More... | |
mod_forum_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0) | |
This function receives a calendar event and returns the action associated with it, or null if there is none. More... | |
mod_forum_count_all_discussions (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) | |
Get a count of all discussions in a forum. More... | |
mod_forum_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. More... | |
mod_forum_get_discussion_summaries (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid, ?int $sortorder, ?int $pageno=0, ?int $pagesize=0) | |
Fetch the data used to display the discussions on the current page. More... | |
mod_forum_get_fontawesome_icon_map () | |
Get icon mapping for font-awesome. More... | |
mod_forum_get_groups_from_groupid (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) | |
Get the list of groups to show based on the current user and requested groupid. More... | |
mod_forum_get_tagged_posts ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0) | |
Returns forum posts tagged with a specified tag. More... | |
mod_forum_inplace_editable ($itemtype, $itemid, $newvalue) | |
Manage inplace editable saves. More... | |
mod_forum_myprofile_navigation (core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) | |
Add nodes to myprofile page. More... | |
mod_forum_rating_can_see_item_ratings ($params) | |
Can the current user see ratings for a given itemid? More... | |
mod_forum_user_preferences () | |
Return a list of all the user preferences used by mod_forum. More... | |
xmldb_forum_upgrade ($oldversion) | |
Variables | |
$capabilities | |
global | mod_forum\local\entities::$CFG |
global | mod_forum\local\factories::$CFG |
global | $DB |
$definitions | |
$functions | |
$handlers | |
$logs | |
$messageproviders | |
$observers | |
$tagareas | |
$tasks | |
$plugin | component = 'mod_forum' |
const | FORUM_CHOOSESUBSCRIBE 0 |
const | FORUM_DISALLOWSUBSCRIBE 3 |
const | FORUM_DISCUSSION_PINNED 1 |
const | FORUM_DISCUSSION_UNPINNED 0 |
const | FORUM_EVENT_TYPE_DUE 'due' |
const | FORUM_FORCESUBSCRIBE 1 |
const | FORUM_INITIALSUBSCRIBE 2 |
const | FORUM_MAILED_ERROR 2 |
const | FORUM_MAILED_PENDING 0 |
const | FORUM_MAILED_SUCCESS 1 |
const | FORUM_MODE_FLATNEWEST -1 |
const | FORUM_MODE_FLATOLDEST 1 |
Include required files. More... | |
const | FORUM_MODE_NESTED 3 |
const | FORUM_MODE_NESTED_V2 4 |
const | FORUM_MODE_THREADED 2 |
const | FORUM_POSTS_ALL_USER_GROUPS (!defined('FORUM_CRON_USER_CACHE')) -2 |
FORUM_POSTS_ALL_USER_GROUPS - All the posts in groups where the user is enrolled. | |
const | FORUM_TRACKING_FORCED 2 |
FORUM_TRACKING_FORCED - Tracking is on, regardless of user setting. More... | |
const | FORUM_TRACKING_OFF 0 |
FORUM_TRACKING_OFF - Tracking is not available for this forum. | |
const | FORUM_TRACKING_ON 2 |
FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED. More... | |
const | FORUM_TRACKING_OPTIONAL 1 |
FORUM_TRACKING_OPTIONAL - Tracking is based on user preference. | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
$plugin | requires = 2019111200 |
$plugin | version = 2019111802 |
object forum_add_attachment | ( | $post, | |
$forum, | |||
$cm, | |||
$mform = null , |
|||
$unused = null |
|||
) |
If successful, this function returns the name of the file.
object | $post | is a full post record, including course and forum |
object | $forum | |
object | $cm | |
mixed | $mform | |
string | $unused |
bool |
forum_add_discussion | ( | $discussion, | |
$mform = null , |
|||
$unused = null , |
|||
$userid = null |
|||
) |
Given an object containing all the necessary data, create a new discussion and return the id.
object | $post | |
mixed | $mform | |
string | $unused | |
int | $userid |
object |
forum_add_instance | ( | $forum, | |
$mform = null |
|||
) |
STANDARD FUNCTIONS ///////////////////////////////////////////////////////////.
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.
stdClass | $forum | add forum instance |
mod_forum_mod_form | $mform |
int | intance id |
forum_add_new_post | ( | $post, | |
$mform, | |||
$unused = null |
|||
) |
Add a new post in an existing discussion.
stdClass | $post | The post data |
mixed | $mform | The submitted form |
string | $unused |
int |
forum_can_create_attachment | ( | $forum, | |
$context | |||
) |
Check if the user can create attachments in a forum.
stdClass | $forum | forum object |
stdClass | $context | context object |
bool | true if the user can create attachments, false otherwise |
object forum_change_discussionid | ( | $postid, | |
$discussionid | |||
) |
recursively sets the discussion field to $discussionid on $postid and all its children used when pruning a post
int | $postid | |
int | $discussionid |
bool |
forum_check_blocking_threshold | ( | $thresholdwarning | ) |
Throws an error if the user is no longer allowed to post due to having reached or exceeded the number of posts specified in 'Post threshold for blocking' setting.
stdClass | $thresholdwarning | the warning information returned from the function forum_check_throttling. |
forum_check_throttling | ( | $forum, | |
$cm = null |
|||
) |
Returns a warning object if a user has reached the number of posts equal to the warning/blocking setting, or false if there is no warning to show.
int | stdClass | $forum | the forum id or the forum object |
stdClass | $cm | the course module |
stdClass|bool | returns an object with the warning information, else returns false if no warning is required. |
forum_check_updates_since | ( | cm_info | $cm, |
$from, | |||
$filter = array() |
|||
) |
Check if the module has any update that affects the current user since a given time.
cm_info | $cm | course module data |
int | $from | the time to check updates from |
array | $filter | if we need to check only specific updates |
stdClass | an object with the different type of areas indicating if they were updated or not |
forum_cm_info_view | ( | cm_info | $cm | ) |
Adds information about unread messages, that is only required for the course view page (and similar), to the course-module object.
cm_info | $cm | Course-module object |
forum_convert_to_roles | ( | ) |
forum_count_discussion_replies | ( | $forumid, | |
$forumsort = "" , |
|||
$limit = -1 , |
|||
$page = -1 , |
|||
$perpage = 0 , |
|||
$canseeprivatereplies = false |
|||
) |
Returns an array of counts of replies to each discussion.
int | $forumid | |
string | $forumsort | |
int | $limit | |
int | $page | |
int | $perpage | |
boolean | $canseeprivatereplies | Whether the current user can see private replies. |
array |
object forum_count_discussions | ( | $forum, | |
$cm, | |||
$course | |||
) |
@global object @global object @staticvar array $cache
object | $forum | |
object | $cm | |
object | $course |
mixed |
forum_count_replies | ( | $post, | |
$children = true |
|||
) |
Count the number of replies to the specified post.
object | $post | |
bool | $children |
int |
forum_count_unrated_posts | ( | ) |
object forum_count_user_posts | ( | $forumid, | |
$userid | |||
) |
Get all the posts for a user in a forum suitable for forum_print_post.
@global object
int | $forumid | |
int | $userid |
array | of counts or false |
forum_cron | ( | ) |
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_cron_minimise_user_record | ( | stdClass | $user | ) |
Removes properties from user record that are not necessary for sending post notifications.
stdClass | $user |
void,$user | parameter is modified |
object forum_delete_discussion | ( | $discussion, | |
$fulldelete, | |||
$course, | |||
$cm, | |||
$forum | |||
) |
Deletes a discussion and handles all associated cleanup.
object | $discussion | Discussion to delete |
bool | $fulldelete | True when deleting entire forum |
object | $course | Course |
object | $cm | Course-module |
object | $forum | Forum |
bool |
object forum_delete_instance | ( | $id | ) |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
int | $id | forum instance id |
bool | success |
object forum_delete_post | ( | $post, | |
$children, | |||
$course, | |||
$cm, | |||
$forum, | |||
$skipcompletion = false |
|||
) |
Deletes a single forum post.
object | $post | Forum post object |
mixed | $children | Whether to delete children. If false, returns false if there are any children (without deleting the post). If true, recursively deletes all children. If set to special value 'ignore', deletes post regardless of children (this is for use only when deleting all posts in a disussion). |
object | $course | Course |
object | $cm | Course-module |
object | $forum | Forum |
bool | $skipcompletion | True to skip updating completion state if it would otherwise be updated, i.e. when deleting entire forum anyway. |
bool |
forum_discussion_is_locked | ( | $forum, | |
$discussion | |||
) |
Determine whether the specified discussion is time-locked.
stdClass | $forum | The forum that the discussion belongs to |
stdClass | $discussion | The discussion to test |
bool |
forum_discussion_pin | ( | $modcontext, | |
$forum, | |||
$discussion | |||
) |
Set the discussion to pinned and trigger the discussion pinned event.
stdClass | $modcontext | module context object |
stdClass | $forum | forum object |
stdClass | $discussion | discussion object |
forum_discussion_unpin | ( | $modcontext, | |
$forum, | |||
$discussion | |||
) |
Set discussion to unpinned and trigger the discussion unpin event.
stdClass | $modcontext | module context object |
stdClass | $forum | forum object |
stdClass | $discussion | discussion object |
object forum_discussion_update_last_post | ( | $discussionid | ) |
Sets the last post for a given discussion.
@global object
into | $discussionid |
bool|int |
forum_discussion_view | ( | $modcontext, | |
$forum, | |||
$discussion | |||
) |
Trigger the discussion viewed event.
stdClass | $modcontext | module context object |
stdClass | $forum | forum object |
stdClass | $discussion | discussion object |
object forum_discussions_user_has_posted_in | ( | $forumid, | |
$userid | |||
) |
@global object
int | $forumid | |
int | $userid |
array |
forum_extend_settings_navigation | ( | settings_navigation | $settingsnav, |
navigation_node | $forumnode | ||
) |
Adds module specific settings to the settings block.
settings_navigation | $settings | The settings navigation object |
navigation_node | $forumnode | The node to add module settings to |
forum_filter_user_groups_discussions | ( | ) |
forum_forcesubscribe | ( | $forumid, | |
$value = 1 |
|||
) |
forum_get_all_discussion_posts | ( | $discussionid, | |
$sort, | |||
$tracking = false |
|||
) |
Gets all posts in discussion including top parent.
int | $discussionid | The Discussion to fetch. |
string | $sort | The sorting to apply. |
bool | $tracking | Whether the user tracks this forum. |
array | The posts in the discussion. |
forum_get_child_posts | ( | ) |
object forum_get_completion_state | ( | $course, | |
$cm, | |||
$userid, | |||
$type | |||
) |
Obtains the automatic completion state for this forum based on any conditions in forum settings.
@global object
object | $course | Course |
object | $cm | Course-module |
int | $userid | User ID |
bool | $type | Type of comparison (or/and; can be used as return value if no conditions) |
bool | True if completed, false if not. (If no conditions, then return value depends on comparison type) |
forum_get_context | ( | $forumid, | |
$context = null |
|||
) |
Determine the current context if one was not already specified.
If a context of type context_module is specified, it is immediately returned and not checked.
int | $forumid | The ID of the forum |
context_module | $context | The current context. |
context_module | The context determined |
object forum_get_course_forum | ( | $courseid, | |
$type | |||
) |
@global object
int | $courseid | |
string | $type |
forum_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any forum type wants to add 'extra' information for the course (see resource).
Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info | An object on information that the courses will know about (most noticeably, an icon). |
moodle_database forum_get_courses_user_posted_in | ( | $user, | |
$discussionsonly = false , |
|||
$includecontexts = true , |
|||
$limitfrom = null , |
|||
$limitnum = null |
|||
) |
Gets all of the courses where the provided user has posted in a forum.
$DB The database connection
stdClass | $user | The user who's posts we are looking for |
bool | $discussionsonly | If true only look for discussions started by the user |
bool | $includecontexts | If set to trye contexts for the courses will be preloaded |
int | $limitfrom | The offset of records to return |
int | $limitnum | The number of records to return |
array | An array of courses |
forum_get_default_sort_order | ( | $desc = true , |
|
$compare = 'd.timemodified' , |
|||
$prefix = 'd' , |
|||
$pinned = true |
|||
) |
Get the sql to use in the ORDER BY clause for forum discussions.
This has the ordering take timed discussion windows into account.
bool | $desc | True for DESC, False for ASC. |
string | $compare | The field in the SQL to compare to normally sort by. |
string | $prefix | The prefix being used for the discussion table. |
bool | $pinned | sort pinned posts to the top |
string |
forum_get_discussion_neighbours | ( | $cm, | |
$discussion, | |||
$forum | |||
) |
Gets the neighbours (previous and next) of a discussion.
The calculation is based on the timemodified when time modified or time created is identical It will revert to using the ID to sort consistently. This is better tha skipping a discussion.
For blog-style forums, the calculation is based on the original creation time of the blog post.
Please note that this does not check whether or not the discussion passed is accessible by the user, it simply uses it as a reference to find the neighbours. On the other hand, the returned neighbours are checked and are accessible to the current user.
object | $cm | The CM record. |
object | $discussion | The discussion record. |
object | $forum | The forum instance record. |
array | That always contains the keys 'prev' and 'next'. When there is a result they contain the record with minimal information such as 'id' and 'name'. When the neighbour is not found the value is false. |
forum_get_discussion_posts | ( | ) |
forum_get_discussion_subscription_icon | ( | $forum, | |
$discussionid, | |||
$returnurl = null , |
|||
$includetext = false |
|||
) |
Return the markup for the discussion subscription toggling icon.
stdClass | $forum | The forum object. |
int | $discussionid | The discussion to create an icon for. |
string | The generated markup. |
forum_get_discussion_subscription_icon_preloaders | ( | ) |
Return a pair of spans containing classes to allow the subscribe and unsubscribe icons to be pre-loaded by a browser.
string | The generated markup |
object forum_get_discussions | ( | $cm, | |
$forumsort = "" , |
|||
$fullpost = true , |
|||
$unused = -1 , |
|||
$limit = -1 , |
|||
$userlastmodified = false , |
|||
$page = -1 , |
|||
$perpage = 0 , |
|||
$groupid = -1 , |
|||
$updatedsince = 0 |
|||
) |
Get all discussions in a forum.
@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS
object | $cm | |
string | $forumsort | |
bool | $fullpost | |
int | $unused | |
int | $limit | |
bool | $userlastmodified | |
int | $page | |
int | $perpage | |
int | $groupid | if groups enabled, get discussions for this group overriding the current group. Use FORUM_POSTS_ALL_USER_GROUPS for all the user groups |
int | $updatedsince | retrieve only discussions updated since the given time |
array |
object forum_get_discussions_count | ( | $cm | ) |
@global object @global object @uses CONEXT_MODULE @uses VISIBLEGROUPS
object | $cm |
array |
object forum_get_discussions_unread | ( | $cm | ) |
@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS
object | $cm |
array |
forum_get_email_message_id | ( | $postid, | |
$usertoid | |||
) |
Create a message-id string to use in the custom headers of forum notification emails.
message-id is used by email clients to identify emails and to nest conversations
int | $postid | The ID of the forum post we are notifying the user about |
int | $usertoid | The ID of the user being notified |
string | A unique message-id |
forum_get_extra_capabilities | ( | ) |
Returns all other caps used in module.
array |
object forum_get_firstpost_from_discussion | ( | $discussionid | ) |
Given a discussion id, return the first post from the discussion.
@global object
int | $dicsussionid |
array |
forum_get_forcesubscribed | ( | $forum | ) |
forum_get_forum_types | ( | ) |
Returns array of forum types chooseable on the forum editing form.
array |
forum_get_forum_types_all | ( | ) |
Returns array of all forum layout modes.
array |
moodle_database forum_get_forums_user_posted_in | ( | $user, | |
array | $courseids = null , |
||
$discussionsonly = false , |
|||
$limitfrom = null , |
|||
$limitnum = null |
|||
) |
Gets all of the forums a user has posted in for one or more courses.
$DB
stdClass | $user | |
array | $courseids | An array of courseids to search or if not provided all courses the user has posted within |
bool | $discussionsonly | If true then only forums where the user has started a discussion will be returned. |
int | $limitfrom | The offset of records to return |
int | $limitnum | The number of records to return |
array | An array of forums the user has posted within in the provided courses |
forum_get_layout_modes | ( | bool | $useexperimentalui = false | ) |
Returns array of forum layout modes.
bool | $useexperimentalui | use experimental layout modes or not |
array |
forum_get_open_modes | ( | ) |
forum_get_optional_subscribed_forums | ( | ) |
forum_get_post_actions | ( | ) |
List the actions that correspond to a post of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.
array |
object forum_get_post_from_log | ( | $log | ) |
Given a log entry, return the forum post details for it.
@global object
object | $log |
array|null |
object forum_get_post_full | ( | $postid | ) |
Gets a post with all info ready for forum_print_post Most of these joins are just to get the forum id.
@global object
int | $postid |
mixed | array of posts or false |
moodle_database forum_get_posts_by_user | ( | $user, | |
array | $courses, | ||
$musthaveaccess = false , |
|||
$discussionsonly = false , |
|||
$limitfrom = 0 , |
|||
$limitnum = 50 |
|||
) |
Returns posts made by the selected user in the requested courses.
This method can be used to return all of the posts made by the requested user within the given courses. For each course the access of the current user and requested user is checked and then for each post access to the post and forum is checked as well.
This function is safe to use with usercapabilities.
$DB
stdClass | $user | The user whose posts we want to get |
array | $courses | The courses to search |
bool | $musthaveaccess | If set to true errors will be thrown if the user cannot access one or more of the courses to search |
bool | $discussionsonly | If set to true only discussion starting posts will be returned. |
int | $limitfrom | The offset of records to return |
int | $limitnum | The number of records to return |
stdClass | An object the following properties ->totalcount: the total number of posts made by the requested user that the current user can see. ->courses: An array of courses the current user can see that the requested user has posted in. ->forums: An array of forums relating to the posts returned in the property below. ->posts: An array containing the posts to show for this request. |
forum_get_potential_subscribers | ( | ) |
forum_get_ratings | ( | ) |
object forum_get_readable_forums | ( | $userid, | |
$courseid = 0 |
|||
) |
An array of forum objects that the user is allowed to read/search through.
@global object @global object
int | $userid | |
int | $courseid | if 0, we look for forums throughout the whole site. |
array | of forum objects, or false if no matches Forum objects have the following attributes: id, type, course, cmid, cmvisible, cmgroupmode, accessallgroups, viewhiddentimedposts |
object forum_get_recent_mod_activity | ( | & | $activities, |
& | $index, | ||
$timestart, | |||
$courseid, | |||
$cmid, | |||
$userid = 0 , |
|||
$groupid = 0 |
|||
) |
Returns all forum posts since a given time in specified forum.
@global object @global object @global object
forum_get_subscribe_link | ( | $forum, | |
$context, | |||
$messages = array() , |
|||
$cantaccessagroup = false , |
|||
$unused1 = true , |
|||
$backtoindex = false , |
|||
$unused2 = null |
|||
) |
Generate and return the subscribe or unsubscribe link for a forum.
object | $forum | the forum. Fields used are $forum->id and $forum->forcesubscribe. |
object | $context | the context object for this forum. |
array | $messages | text used for the link in its various states (subscribed, unsubscribed, forcesubscribed or cantsubscribe). Any strings not passed in are taken from the $defaultmessages array at the top of the function. |
bool | $cantaccessagroup | |
bool | $unused1 | |
bool | $backtoindex | |
array | $unused2 |
string |
forum_get_subscribed_forums | ( | ) |
forum_get_subscriptionmode_options | ( | ) |
List the options for forum subscription modes.
This is used by the settings page and by the mod_form page.
array |
forum_get_tracking_link | ( | ) |
forum_get_user_digest_options | ( | $user = null | ) |
Retrieve the list of available user digest options.
stdClass | $user | The user object. This defaults to the global $USER object. |
array | The mapping of values to digest options. |
forum_get_user_discussions | ( | ) |
forum_get_user_grades | ( | $forum, | |
$userid = 0 |
|||
) |
Return grade for given user or all users.
object | $forum | |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none |
object forum_get_user_involved_discussions | ( | $forumid, | |
$userid | |||
) |
Get all the discussions user participated in.
@global object @uses CONTEXT_MODULE
int | $forumid | |
int | $userid |
array | Array or false |
forum_get_user_maildigest_bulk | ( | $digests, | |
$user, | |||
$forumid | |||
) |
Determine the maildigest setting for the specified user against the specified forum.
Array | $digests | An array of forums and user digest settings. |
stdClass | $user | The user object containing the id and maildigest default. |
int | $forumid | The ID of the forum to check. |
int | The calculated maildigest setting for this user and forum. |
object forum_get_user_posted_time | ( | $did, | |
$userid | |||
) |
Returns creation time of the first user's post in given discussion $DB.
int | $did | Discussion id |
int | $userid | User id |
int|bool | post creation time stamp or return false |
object forum_get_user_posts | ( | $forumid, | |
$userid | |||
) |
Get all the posts for a user in a forum suitable for forum_print_post.
@global object @uses CONTEXT_MODULE
array |
forum_get_view_actions | ( | ) |
List the actions that correspond to a view of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.
array |
object forum_go_back_to | ( | $default | ) |
string | moodle_url | $default |
string |
forum_grade_item_delete | ( | $forum | ) |
Delete grade item for given forum.
stdClass | $forum | Forum object |
forum_grade_item_update | ( | $forum, | |
$ratings = null , |
|||
$forumgrades = null |
|||
) |
Create/update grade items for given forum.
stdClass | $forum | Forum object with extra cmidnumber |
mixed | $grades | Optional array/object of grade(s); 'reset' means reset grades in gradebook |
forum_grading_areas_list | ( | ) |
Lists all gradable areas for the advanced grading methods gramework.
array('string'=>'string') | An array with area names as keys and descriptions as values |
forum_instance_created | ( | $context, | |
$forum | |||
) |
Handle changes following the creation of a forum instance.
This function is typically called by the course_module_created observer.
object | $context | the forum context |
stdClass | $forum | The forum object |
void |
forum_is_author_hidden | ( | $post, | |
$forum | |||
) |
Checks whether the author's name and picture for a given post should be hidden or not.
object | $post | The forum post. |
object | $forum | The forum object. |
bool |
coding_exception |
forum_is_cutoff_date_reached | ( | $forum | ) |
Determine whether the specified forum's cutoff date is reached.
stdClass | $forum | The forum |
bool |
forum_is_due_date_reached | ( | $forum | ) |
Determine whether the specified forum's due date is reached.
stdClass | $forum | The forum |
bool |
forum_is_forcesubscribed | ( | $forum | ) |
Determine whether the forum is force subscribed.
forum_is_subscribed | ( | ) |
forum_is_user_group_discussion | ( | cm_info | $cm, |
$discussiongroupid | |||
) |
Returns whether the discussion group is visible by the current user or not.
cm_info | $cm | The discussion course module |
int | $discussiongroupid | The discussion groupid |
bool |
forum_make_mail_html | ( | $course, | |
$cm, | |||
$forum, | |||
$discussion, | |||
$post, | |||
$userfrom, | |||
$userto, | |||
$replyaddress = null |
|||
) |
Builds and returns the body of the email notification in html format.
object | $course | |
object | $cm | |
object | $forum | |
object | $discussion | |
object | $post | |
object | $userfrom | |
object | $userto | |
string | $replyaddress | The inbound address that a user can reply to the generated e-mail with. [Since 2.8]. |
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 = "" |
|||
) |
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.
object | $course | |
object | $cm | |
object | $forum | |
object | $discussion | |
object | $post | |
object | $userfrom | |
object | $userto | |
bool | $ownpost | |
bool | $reply | |
bool | $link | |
bool | $rate | |
string | $footer |
string |
forum_make_mail_text | ( | $course, | |
$cm, | |||
$forum, | |||
$discussion, | |||
$post, | |||
$userfrom, | |||
$userto, | |||
$bare = false , |
|||
$replyaddress = null |
|||
) |
Builds and returns the body of the email notification in plain text.
@uses CONTEXT_MODULE
object | $course | |
object | $cm | |
object | $forum | |
object | $discussion | |
object | $post | |
object | $userfrom | |
object | $userto | |
boolean | $bare | |
string | $replyaddress | The inbound address that a user can reply to the generated e-mail with. [Since 2.8]. |
string | The email body in plain text format. |
object forum_move_attachments | ( | $discussion, | |
$forumfrom, | |||
$forumto | |||
) |
Given a discussion object that is being moved to $forumto, this function checks all posts in that discussion for attachments, and if any are found, these are moved to the new forum directory.
object | $discussion | |
int | $forumfrom | source forum id |
int | $forumto | target forum id |
bool | success |
forum_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext | |||
) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
forum_post_is_visible_privately | ( | $post, | |
$cm | |||
) |
Check whether the forum post is a private reply visible to this user.
stdClass | $post | The post to check. |
cm_info | $cm | The context module instance. |
bool | Whether the post is visible in terms of private reply configuration. |
forum_post_nesting_cache | ( | ) |
forum_post_subscription | ( | $fromform, | |
$forum, | |||
$discussion | |||
) |
Given a new post, subscribes or unsubscribes as appropriate.
Returns some text which describes what happened.
object | $fromform | The submitted form |
stdClass | $forum | The forum record |
stdClass | $discussion | The forum discussion record |
string |
object forum_print_attachments | ( | $post, | |
$cm, | |||
$type | |||
) |
Returns attachments as formated text/html optionally with separate images.
@global object @global object
object | $post | |
object | $cm | |
string | $type | html/text/separateimages |
mixed | string or array of (html text withouth images and image HTML) |
forum_print_discussion | ( | $course, | |
$cm, | |||
$forum, | |||
$discussion, | |||
$post, | |||
$mode, | |||
$canreply = NULL , |
|||
$canrate = false |
|||
) |
Prints a forum discussion.
@uses CONTEXT_MODULE @uses FORUM_MODE_FLATNEWEST @uses FORUM_MODE_FLATOLDEST @uses FORUM_MODE_THREADED @uses FORUM_MODE_NESTED
stdClass | $course | |
stdClass | $cm | |
stdClass | $forum | |
stdClass | $discussion | |
stdClass | $post | |
int | $mode | |
mixed | $canreply | |
bool | $canrate |
object forum_print_discussion_header | ( | & | $post, |
$forum, | |||
$group = -1 , |
|||
$datestring = "" , |
|||
$cantrack = true , |
|||
$forumtracked = true , |
|||
$canviewparticipants = true , |
|||
$modcontext = null , |
|||
$canviewhiddentimedposts = false |
|||
) |
This function prints the overview of a discussion in the forum listing.
It needs some discussion information and some post information, these happen to be combined for efficiency in the $post parameter by the function that calls this one: forum_print_latest_discussions()
@global object
object | $post | The post object (passed by reference for speed). |
object | $forum | The forum object. |
int | $group | Current group. |
string | $datestring | Format to use for the dates. |
boolean | $cantrack | Is tracking enabled for this forum. |
boolean | $forumtracked | Is the user tracking this forum. |
boolean | $canviewparticipants | True if user has the viewparticipants permission for this course |
boolean | $canviewhiddentimedposts | True if user has the viewhiddentimedposts permission for this forum |
forum_print_latest_discussions | ( | $course, | |
$forum, | |||
$maxdiscussions = -1 , |
|||
$displayformat = 'plain' , |
|||
$sort = '' , |
|||
$currentgroup = -1 , |
|||
$groupmode = -1 , |
|||
$page = -1 , |
|||
$perpage = 100 , |
|||
$cm = null |
|||
) |
Prints the discussion view screen for a forum.
object | $course | The current course object. |
object | $forum | Forum to be printed. |
int | $maxdiscussions | |
string | $displayformat | The display format to use (optional). |
string | $sort | Sort arguments for database query (optional). |
int | $currentgroup | |
int | $groupmode | Group mode of the forum (optional). |
int | $page | Page mode, page to display (optional). |
int | $perpage | The maximum number of discussions per page(optional) |
stdClass | $cm |
forum_print_mode_form | ( | $id, | |
$mode, | |||
$forumtype = '' |
|||
) |
Print the drop down that allows the user to select how they want to have the discussion displayed.
int | $id | forum id if $forumtype is 'single', discussion id for any other forum type |
mixed | $mode | forum layout mode |
string | $forumtype | optional |
forum_print_overview | ( | ) |
object forum_print_post | ( | $post, | |
$discussion, | |||
$forum, | |||
& | $cm, | ||
$course, | |||
$ownpost = false , |
|||
$reply = false , |
|||
$link = false , |
|||
$footer = "" , |
|||
$highlight = "" , |
|||
$postisread = null , |
|||
$dummyifcantsee = true , |
|||
$istracked = null , |
|||
$return = false |
|||
) |
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.
@global object @uses FORUM_MODE_THREADED @uses PORTFOLIO_FORMAT_PLAINHTML @uses PORTFOLIO_FORMAT_FILE @uses PORTFOLIO_FORMAT_RICHHTML @uses PORTFOLIO_ADD_TEXT_LINK @uses CONTEXT_MODULE
object | $post | The post to print. |
object | $discussion | |
object | $forum | |
object | $cm | |
object | $course | |
boolean | $ownpost | Whether this post belongs to the current user. |
boolean | $reply | Whether to print a 'reply' link at the bottom of the message. |
boolean | $link | Just print a shortened version of the post as a link to the full post. |
string | $footer | Extra stuff to print after the message. |
string | $highlight | Space-separated list of terms to highlight. |
int | $post_read | true, false or -99. If we already know whether this user has read this post, pass that in, otherwise, pass in -99, and this function will work it out. |
boolean | $dummyifcantsee | When forum_user_can_see_post says that the current user can't see this post, if this argument is true (the default) then print a dummy 'you can't see this post' post. If false, don't output anything at all. |
bool | null | $istracked |
void |
forum_print_post_end | ( | $post, | |
$return = false |
|||
) |
End a forum post container.
object | $post | The post to print. |
bool | $return | Return the string or print it |
string |
forum_print_post_start | ( | $post, | |
$return = false |
|||
) |
Start a forum post container.
object | $post | The post to print. |
bool | $return | Return the string or print it |
string |
object forum_print_posts_flat | ( | $course, | |
& | $cm, | ||
$forum, | |||
$discussion, | |||
$post, | |||
$mode, | |||
$reply, | |||
$forumtracked, | |||
$posts | |||
) |
@global object @uses FORUM_MODE_FLATNEWEST
object | $course | |
object | $cm | |
object | $forum | |
object | $discussion | |
object | $post | |
object | $mode | |
bool | $reply | |
bool | $forumtracked | |
array | $posts |
void |
object forum_print_posts_nested | ( | $course, | |
& | $cm, | ||
$forum, | |||
$discussion, | |||
$parent, | |||
$reply, | |||
$forumtracked, | |||
$posts | |||
) |
object forum_print_posts_threaded | ( | $course, | |
& | $cm, | ||
$forum, | |||
$discussion, | |||
$parent, | |||
$depth, | |||
$reply, | |||
$forumtracked, | |||
$posts | |||
) |
@global object @uses CONTEXT_MODULE
void |
object forum_print_recent_activity | ( | $course, | |
$viewfullnames, | |||
$timestart | |||
) |
Given a course and a date, prints a summary of all the new messages posted in the course since that date.
@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS
object | $course | |
bool | $viewfullnames | capability |
int | $timestart |
bool | success |
forum_print_recent_mod_activity | ( | $activity, | |
$courseid, | |||
$detail, | |||
$modnames, | |||
$viewfullnames | |||
) |
Outputs the forum post indicated by $activity.
object | $activity | the activity object the forum resides in |
int | $courseid | the id of the course the forum resides in |
bool | $detail | not used, but required for compatibilty with other modules |
int | $modnames | not used, but required for compatibilty with other modules |
bool | $viewfullnames | not used, but required for compatibilty with other modules |
forum_rating_permissions | ( | $contextid, | |
$component, | |||
$ratingarea | |||
) |
Return rating related permissions.
string | $options | the context id |
array | an associative array of the user's rating permissions |
forum_rating_validate | ( | $params | ) |
Validates a submitted rating.
array | $params | submitted data context => object the context in which the rated items exists [required] component => The component for this module - should always be mod_forum [required] ratingarea => object the context in which the rated items exists [required] |
itemid => int the ID of the object being rated [required] scaleid => int the scale from which the user can select a rating. Used for bounds checking. [required] rating => int the submitted rating [required] rateduserid => int the id of the user whose items have been rated. NOT the user who submitted the ratings. 0 to update all. [required] aggregation => int the aggregation method to apply when calculating grades ie RATING_AGGREGATE_AVERAGE [required]
boolean | true if the rating is valid. Will throw rating_exception if not |
forum_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
array |
forum_reset_course_form_definition | ( | & | $mform | ) |
Called by course/reset.php.
$mform | form passed by reference |
object forum_reset_gradebook | ( | $courseid, | |
$type = '' |
|||
) |
Removes all grades from gradebook.
@global object
int | $courseid | |
string | $type | optional |
object forum_reset_userdata | ( | $data | ) |
This function is used by the reset_course_userdata function in moodlelib.
This function will remove all posts from the specified forum and clean up any related data.
@global object
$data | the data submitted from the reset course. |
array | status array |
forum_rss_delete_file | ( | $forum | ) |
Given a forum object, deletes all cached RSS files associated with it.
stdClass | $forum |
forum_rss_feed_contents | ( | $forum, | |
$sql, | |||
$params, | |||
$context | |||
) |
This function return the XML rss contents about the forum It returns false if something is wrong.
stdClass | $forum | the forum object |
string | $sql | the SQL used to retrieve the contents from the database |
array | $params | the SQL parameters used |
object | $context | the context this forum relates to |
bool|string | false if the contents is empty, otherwise the contents of the feed is returned |
@Todo MDL-31129 implement post attachment handling
forum_rss_feed_discussions_sql | ( | $forum, | |
$cm, | |||
$newsince = 0 |
|||
) |
Generates the SQL query used to get the Discussion details from the forum table of the database.
stdClass | $forum | the forum object |
stdClass | $cm | Course Module object |
int | $newsince | check for items since this epoch timestamp |
string | the SQL query to be used to get the Discussion details from the forum table of the database |
forum_rss_feed_posts_sql | ( | $forum, | |
$cm, | |||
$newsince = 0 |
|||
) |
Generates the SQL query used to get the Post details from the forum table of the database.
stdClass | $forum | the forum object |
stdClass | $cm | Course Module object |
int | $newsince | check for items since this epoch timestamp |
string | the SQL query to be used to get the Post details from the forum table of the database |
forum_rss_get_feed | ( | $context, | |
$args | |||
) |
Returns the path to the cached rss feed contents.
Creates/updates the cache if necessary.
stdClass | $context | the context |
array | $args | the arguments received in the url |
string | the full path to the cached RSS feed directory. Null if there is a problem. |
forum_rss_get_group_sql | ( | $cm, | |
$groupmode, | |||
$currentgroup, | |||
$modcontext = null |
|||
) |
Retrieve the correct SQL snippet for group-only forums.
stdClass | $cm | Course Module object |
int | $groupmode | the mode in which the forum's groups are operating |
bool | $currentgroup | true if the user is from the a group enabled on the forum |
stdClass | $modcontext | The context instance of the forum module |
string | SQL Query for group details of the forum |
forum_rss_get_sql | ( | $forum, | |
$cm, | |||
$time = 0 |
|||
) |
Determines which type of SQL query is required, one for posts or one for discussions, and returns the appropriate query.
stdClass | $forum | the forum object |
stdClass | $cm | Course Module object |
int | $time | check for items since this epoch timestamp |
string | the SQL query to be used to get the Discussion/Post details from the forum table of the database |
forum_rss_newstuff | ( | $forum, | |
$cm, | |||
$time | |||
) |
If there is new stuff in the forum since $time this returns true Otherwise it returns false.
stdClass | $forum | the forum object |
stdClass | $cm | Course Module object |
int | $time | check for items since this epoch timestamp |
bool | True for new items |
forum_scale_used | ( | ) |
forum_scale_used_anywhere | ( | int | $scaleid | ) |
Checks if scale is being used by any instance of forum.
This is used to find out if scale used anywhere.
$scaleid | int |
boolean | True if the scale is used by any forum |
object forum_search_form | ( | $course, | |
$search = '' |
|||
) |
object | $course | |
string | $search |
string |
object forum_search_posts | ( | $searchterms, | |
$courseid = 0 , |
|||
$limitfrom = 0 , |
|||
$limitnum = 50 , |
|||
& | $totalcount, | ||
$extrasql = '' |
|||
) |
Returns a list of posts found using an array of search terms.
@global object @global object
array | $searchterms | array of search terms, e.g. word +word -word |
int | $courseid | if 0, we search through the whole site |
int | $limitfrom | |
int | $limitnum | |
int | &$totalcount | |
string | $extrasql |
array|bool | Array of posts found or false |
forum_set_user_maildigest | ( | $forum, | |
$maildigest, | |||
$user = null |
|||
) |
Set the per-forum maildigest option for the specified user.
stdClass | $forum | The forum to set the option for. |
int | $maildigest | The maildigest option. |
stdClass | $user | The user object. This defaults to the global $USER object. |
invalid_digest_setting | thrown if an invalid maildigest option is provided. |
forum_shorten_post | ( | $message | ) |
forum_should_end_post_nesting | ( | $id | ) |
Return true when all the opens are nested with a close.
int | $id | The id of the post to end |
bool |
forum_should_start_post_nesting | ( | $id | ) |
Return true for the first time this post was started.
int | $id | The id of the post to start |
bool |
forum_subscribe | ( | ) |
forum_subscribed_users | ( | ) |
forum_supports | ( | $feature | ) |
Indicates API features that the forum supports.
@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES
string | $feature |
mixed | True if yes (some features may use other values) |
object forum_tp_add_read_record | ( | $userid, | |
$postid | |||
) |
Mark post as read.
@global object
int | $userid | |
int | $postid |
object forum_tp_can_track_forums | ( | $forum = false , |
|
$user = false |
|||
) |
Determine if a user can track forums and optionally a particular forum.
Checks the site settings, the user settings and the forum settings (if requested).
@global object @global object
mixed | $forum | The forum object to test, or the int id (optional). |
mixed | $userid | The user object to check for (optional). |
boolean |
object forum_tp_clean_read_records | ( | ) |
Clean old records from the forum_read table.
@global object
void |
forum_tp_count_discussion_read_records | ( | ) |
forum_tp_count_discussion_unread_posts | ( | ) |
forum_tp_count_forum_posts | ( | ) |
forum_tp_count_forum_read_records | ( | ) |
object forum_tp_count_forum_unread_posts | ( | $cm, | |
$course, | |||
$resetreadcache = false |
|||
) |
Returns the count of records for the provided user and forum and [optionally] group.
@global object @global object
object | $cm | |
object | $course | |
bool | $resetreadcache | optional, true to reset the function static $readcache var |
int |
object forum_tp_delete_read_records | ( | $userid = -1 , |
|
$postid = -1 , |
|||
$discussionid = -1 , |
|||
$forumid = -1 |
|||
) |
Deletes read records for the specified index.
At least one parameter must be specified.
int | $userid | |
int | $postid | |
int | $discussionid | |
int | $forumid |
bool |
object forum_tp_get_course_unread_posts | ( | $userid, | |
$courseid | |||
) |
Returns the count of records for the provided user and course.
Please note that group access is ignored!
@global object
int | $userid | |
int | $courseid |
array |
forum_tp_get_discussion_read_records | ( | ) |
forum_tp_get_read_records | ( | ) |
object forum_tp_get_untracked_forums | ( | $userid, | |
$courseid | |||
) |
Get a list of forums not tracked by the user.
@global object
int | $userid | The id of the user to use. |
int | $courseid | The id of the course being checked. |
mixed | An array indexed by forum id, or false. |
object forum_tp_is_post_old | ( | $post, | |
$time = null |
|||
) |
object | $post | |
int | $time | Defautls to time() |
object forum_tp_is_post_read | ( | $userid, | |
$post | |||
) |
int | $userid | |
object | $post |
object forum_tp_is_tracked | ( | $forum, | |
$user = false |
|||
) |
Tells whether a specific forum is tracked by the user.
A user can optionally be specified. If not specified, the current user is assumed.
@global object @global object
mixed | $forum | If int, the id of the forum being checked; if object, the forum object |
int | $userid | The id of the user being checked (optional). |
boolean |
object forum_tp_mark_discussion_read | ( | $user, | |
$discussionid | |||
) |
Marks a whole discussion as read, for a given user.
@global object
object | $user | |
int | $discussionid |
bool |
object forum_tp_mark_forum_read | ( | $user, | |
$forumid, | |||
$groupid = false |
|||
) |
Marks a whole forum as read, for a given user.
@global object
object | $user | |
int | $forumid | |
int | bool | $groupid |
bool |
forum_tp_mark_post_read | ( | $userid, | |
$post, | |||
$unused = null |
|||
) |
If its an old post, do nothing.
If the record exists, the maintenance will clear it up later.
int | $userid | The ID of the user to mark posts read for. |
object | $post | The post record for the post to mark as read. |
mixed | $unused |
bool |
object forum_tp_mark_posts_read | ( | $user, | |
$postids | |||
) |
Mark posts as read.
@global object
object | $user | object |
array | $postids | array of post ids |
boolean | success |
object forum_tp_start_tracking | ( | $forumid, | |
$userid = false |
|||
) |
@global object
int | $forumid | |
int | $userid |
object forum_tp_stop_tracking | ( | $forumid, | |
$userid = false |
|||
) |
@global object
int | $forumid | |
int | $userid |
forum_trigger_content_uploaded_event | ( | $post, | |
$cm, | |||
$name | |||
) |
Sends post content to plagiarism plugin.
object | $post | Forum post object |
object | $cm | Course-module |
string | $name |
bool |
forum_trigger_post_updated_event | ( | $post, | |
$discussion, | |||
$context, | |||
$forum | |||
) |
Trigger post updated event.
object | $post | forum post object |
object | $discussion | discussion object |
object | $context | forum context object |
object | $forum | forum object |
void |
forum_unsubscribe | ( | ) |
forum_update_calendar | ( | $forum, | |
$cmid | |||
) |
Update the calendar entries for this forum activity.
stdClass | $forum | the row from the database table forum. |
int | $cmid | The coursemodule id |
bool |
forum_update_grades | ( | $forum, | |
$userid = 0 |
|||
) |
Update activity grades.
object | $forum | |
int | $userid | specific user only, 0 means all |
object forum_update_instance | ( | $forum, | |
$mform | |||
) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.
object | $forum | forum instance (with magic quotes) |
bool | success |
forum_update_post | ( | $newpost, | |
$mform, | |||
$unused = null |
|||
) |
Update a post.
stdClass | $newpost | The post to update |
mixed | $mform | The submitted form |
string | $unused |
bool |
object forum_update_subscriptions_button | ( | $courseid, | |
$forumid | |||
) |
Prints the editing button on subscribers page.
@global object
int | $courseid | |
int | $forumid |
string |
object forum_user_can_post | ( | $forum, | |
$discussion, | |||
$user = NULL , |
|||
$cm = NULL , |
|||
$course = NULL , |
|||
$context = NULL |
|||
) |
This function checks whether the user can reply to posts in a forum discussion.
Use forum_user_can_post_discussion() to check whether the user can start discussions.
@global object @uses DEBUG_DEVELOPER @uses CONTEXT_MODULE @uses VISIBLEGROUPS
object | $forum | forum object |
object | $discussion | |
object | $user | |
object | $cm | |
object | $course | |
object | $context |
bool |
object forum_user_can_post_discussion | ( | $forum, | |
$currentgroup = null , |
|||
$unused = -1 , |
|||
$cm = NULL , |
|||
$context = NULL |
|||
) |
object | $forum | |
object | $currentgroup | |
int | $unused | |
object | $cm | |
object | $context |
bool |
forum_user_can_reply_privately | ( | \context_module | $context, |
stdClass | $parent | ||
) |
Check whether the user can reply privately to the parent post.
context_module | $context | |
stdClass | $parent |
bool |
object forum_user_can_see_discussion | ( | $forum, | |
$discussion, | |||
$context, | |||
$user = NULL |
|||
) |
@global object @uses DEBUG_DEVELOPER
object | $forum | |
object | $discussion | |
object | $context | |
object | $user |
bool |
forum_user_can_see_group_discussion | ( | $discussion, | |
$cm, | |||
$context | |||
) |
Check to ensure a user can view a group discussion.
object | $discussion | |
object | $cm | |
object | $context |
boolean | returns true if they can view post, false otherwise |
forum_user_can_see_post | ( | $forum, | |
$discussion, | |||
$post, | |||
$user = null , |
|||
$cm = null , |
|||
$checkdeleted = true |
|||
) |
Check whether a user can see the specified post.
stdClass | $forum | The forum to chcek |
stdClass | $discussion | The discussion the post is in |
stdClass | $post | The post in question |
stdClass | $user | The user to test - if not specified, the current user is checked. |
stdClass | $cm | The Course Module that the forum is in (required). |
bool | $checkdeleted | Whether to check the deleted flag on the post. |
bool |
forum_user_can_see_timed_discussion | ( | $discussion, | |
$user, | |||
$context | |||
) |
Check to ensure a user can view a timed discussion.
object | $discussion | |
object | $user | |
object | $context |
boolean | returns true if they can view post, false otherwise |
forum_user_can_view_post | ( | ) |
object forum_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$forum | |||
) |
@global object
object | $coure | |
object | $user | |
object | $mod | |
object | $forum |
forum_user_enrolled | ( | ) |
object forum_user_has_posted | ( | $forumid, | |
$did, | |||
$userid | |||
) |
@global object
int | $forumid | |
int | $did | |
int | $userid |
bool |
forum_user_has_posted_discussion | ( | $forumid, | |
$userid, | |||
$groupid = null |
|||
) |
Returns true if user created new discussion already.
int | $forumid | The forum to check for postings |
int | $userid | The user to check for postings |
int | $groupid | The group to restrict the check to |
bool |
forum_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$forum | |||
) |
object | $course | |
object | $user | |
object | $mod | TODO this is not used in this function, refactor |
object | $forum |
object | A standard object with 2 variables: info (number of posts for this user) and time (last modified) |
forum_view | ( | $forum, | |
$course, | |||
$cm, | |||
$context | |||
) |
Mark the activity completed (if required) and trigger the course_module_viewed event.
stdClass | $forum | forum object |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
mod_forum_core_calendar_event_action_shows_item_count | ( | calendar_event | $event, |
$itemcount = 0 |
|||
) |
Callback function that determines whether an action event should be showing its item count based on the event type and the item count.
calendar_event | $event | The calendar event. |
int | $itemcount | The item count associated with the action event. |
bool |
mod_forum_core_calendar_event_timestart_updated | ( | \calendar_event | $event, |
stdClass | $forum | ||
) |
This function will update the forum module according to the event that has been modified.
It will set the timeclose value of the forum instance according to the type of event provided.
moodle_exception |
calendar_event | $event | |
stdClass | $forum | The module instance to get the range from |
mod_forum_core_calendar_get_valid_event_timestart_range | ( | \calendar_event | $event, |
stdClass | $forum | ||
) |
This function calculates the minimum and maximum cutoff values for the timestart of the given event.
It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.
If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.
A minimum and maximum cutoff return value will look like: [ [1505704373, 'The date must be after this date'], [1506741172, 'The date must be before this date'] ]
calendar_event | $event | The calendar event to get the time range for |
stdClass | $forum | The module instance to get the range from |
array | Returns an array with min and max date. |
mod_forum_core_calendar_provide_event_action | ( | calendar_event | $event, |
core_calendar\action_factory | $factory, | ||
int | $userid = 0 |
||
) |
This function receives a calendar event and returns the action associated with it, or null if there is none.
This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar |
mod_forum_count_all_discussions | ( | \mod_forum\local\entities\forum | $forum, |
stdClass | $user, | ||
?int | $groupid | ||
) |
Get a count of all discussions in a forum.
mod_forum\local\entities\forum | $forum | The forum entity |
stdClass | $user | The user to render for |
int | $groupid | The group to render |
int | The number of discussions in a forum |
mod_forum_get_completion_active_rule_descriptions | ( | $cm | ) |
Callback which returns human-readable strings describing the active completion custom rules for the module instance.
cm_info | stdClass | $cm | object with fields ->completion and ->customdata['customcompletionrules'] |
array::$descriptions | the array of descriptions for the custom rules. |
mod_forum_get_discussion_summaries | ( | \mod_forum\local\entities\forum | $forum, |
stdClass | $user, | ||
?int | $groupid, | ||
?int | $sortorder, | ||
?int | $pageno = 0 , |
||
?int | $pagesize = 0 |
||
) |
Fetch the data used to display the discussions on the current page.
mod_forum\local\entities\forum | $forum | The forum entity |
stdClass | $user | The user to render for |
int[] | null | $groupid | The group to render |
int | null | $sortorder | The sort order to use when selecting the discussions in the list |
int | null | $pageno | The zero-indexed page number to use |
int | null | $pagesize | The number of discussions to show on the page |
array | The data to use for display |
mod_forum_get_fontawesome_icon_map | ( | ) |
Get icon mapping for font-awesome.
array |
mod_forum_get_groups_from_groupid | ( | \mod_forum\local\entities\forum | $forum, |
stdClass | $user, | ||
?int | $groupid | ||
) |
Get the list of groups to show based on the current user and requested groupid.
mod_forum\local\entities\forum | $forum | The forum entity |
stdClass | $user | The user viewing |
int | $groupid | The groupid requested |
array | The list of groups to show |
mod_forum_get_tagged_posts | ( | $tag, | |
$exclusivemode = false , |
|||
$fromctx = 0 , |
|||
$ctx = 0 , |
|||
$rec = 1 , |
|||
$page = 0 |
|||
) |
Returns forum posts tagged with a specified tag.
This is a callback used by the tag area mod_forum/forum_posts to search for forum posts tagged with a specific tag.
core_tag_tag | $tag | |
bool | $exclusivemode | if set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger |
int | $fromctx | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $ctx | context id where to search for records |
bool | $rec | search in subcontexts as well |
int | $page | 0-based number of page being displayed |
core_tag |
mod_forum_inplace_editable | ( | $itemtype, | |
$itemid, | |||
$newvalue | |||
) |
Manage inplace editable saves.
string | $itemtype | The type of item. |
int | $itemid | The ID of the item. |
mixed | $newvalue | The new value |
string |
mod_forum_myprofile_navigation | ( | core_user\output\myprofile\tree | $tree, |
$user, | |||
$iscurrentuser, | |||
$course | |||
) |
Add nodes to myprofile page.
core_user\output\myprofile\tree | $tree | Tree object |
stdClass | $user | user object |
bool | $iscurrentuser | |
stdClass | $course | Course object |
bool |
mod_forum_rating_can_see_item_ratings | ( | $params | ) |
Can the current user see ratings for a given itemid?
array | $params | submitted data contextid => int contextid [required] component => The component for this module - should always be mod_forum [required] ratingarea => object the context in which the rated items exists [required] itemid => int the ID of the object being rated [required] scaleid => int scale id [optional] |
bool |
coding_exception | |
rating_exception |
mod_forum_user_preferences | ( | ) |
Return a list of all the user preferences used by mod_forum.
array |
$definitions |
$handlers |
$logs |
$messageproviders |
$observers |
$tagareas |
$tasks |
const FORUM_MODE_FLATOLDEST 1 |
Include required files.
CONSTANTS ///////////////////////////////////////////////////////////
const FORUM_TRACKING_FORCED 2 |
FORUM_TRACKING_FORCED - Tracking is on, regardless of user setting.
Treated as FORUM_TRACKING_OPTIONAL if $CFG->forum_allowforcedreadtracking is off.
const FORUM_TRACKING_ON 2 |
FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED.