Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Forum post renderable.

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

Defines 1 class


Class: forum_post  - X-Ref

Forum post renderable.

__construct($course, $cm, $forum, $discussion, $post, $author, $recipient, $canreply)   X-Ref
Builds a renderable forum post

param: object $course Course of the forum
param: object $cm Course Module of the forum
param: object $forum The forum of the post
param: object $discussion Discussion thread in which the post appears
param: object $post The post
param: object $author Author of the post
param: object $recipient Recipient of the email
param: bool $canreply True if the user can reply to the post

export_for_template(\renderer_base $renderer, $plaintext = false)   X-Ref
Export this data so it can be used as the context for a mustache template.

param: \mod_forum_renderer $renderer The render to be used for formatting the message and attachments
param: bool $plaintext Whethe the target is a plaintext target
return: array Data ready for use in a mustache template

export_for_template_text(\mod_forum_renderer $renderer)   X-Ref
Export this data so it can be used as the context for a mustache template.

param: \mod_forum_renderer $renderer The render to be used for formatting the message and attachments
return: array Data ready for use in a mustache template

export_for_template_html(\mod_forum_renderer $renderer)   X-Ref
Export this data so it can be used as the context for a mustache template.

param: \mod_forum_renderer $renderer The render to be used for formatting the message and attachments
return: array Data ready for use in a mustache template

export_for_template_shared(\mod_forum_renderer $renderer)   X-Ref
Export this data so it can be used as the context for a mustache template.

param: \mod_forum_renderer $renderer The render to be used for formatting the message and attachments
return: stdClass Data ready for use in a mustache template

__set($key, $value)   X-Ref
Magically sets a property against this object.

param: string $key
param: mixed $value

get_is_firstpost()   X-Ref
Whether this is the first post.

return: boolean

get_courselink()   X-Ref
Get the link to the course.

return: string

get_forumindexlink()   X-Ref
Get the link to the forum index for this course.

return: string

get_forumviewlink()   X-Ref
Get the link to the view page for this forum.

return: string

_get_discussionlink()   X-Ref
Get the link to the current discussion.

return: string

get_discussionlink()   X-Ref
Get the link to the current discussion.

return: string

get_permalink()   X-Ref
Get the link to the current post, including post anchor.

return: string

get_parentpostlink()   X-Ref
Get the link to the parent post.

return: string

get_authorlink()   X-Ref
Get the link to the author's profile page.

return: string

get_unsubscribeforumlink()   X-Ref
Get the link to unsubscribe from the forum.

return: string

get_unsubscribediscussionlink()   X-Ref
Get the link to unsubscribe from the discussion.

return: string

get_replylink()   X-Ref
Get the link to reply to the current post.

return: string

get_subject()   X-Ref
The formatted subject for the current post.

return: string

get_postanchor()   X-Ref
The plaintext anchor id for the current post.

return: string

get_courseidnumber()   X-Ref
ID number of the course that the forum is in.

return: string

get_coursefullname()   X-Ref
The full name of the course that the forum is in.

return: string

get_coursename()   X-Ref
The name of the course that the forum is in.

return: string

get_forumname()   X-Ref
The name of the forum.

return: string

get_discussionname()   X-Ref
The name of the current discussion.

return: string

get_showdiscussionname()   X-Ref
Whether to show the discussion name.
If the forum name matches the discussion name, the discussion name
is not typically displayed.

return: boolean

get_author_fullname()   X-Ref
The fullname of the post author.

return: string

get_postto()   X-Ref
The recipient of the post.

return: string

get_postdate()   X-Ref
The date of the post, formatted according to the postto user's
preferences.

return: string.

get_author_picture(\renderer_base $renderer)   X-Ref
The HTML for the author's user picture.

param: \renderer_base $renderer
return: string

get_group_picture(\renderer_base $renderer)   X-Ref
The HTML for a group picture.

param: \renderer_base $renderer
return: string