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 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Forum class.

Copyright: 2019 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 672 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: forum  - X-Ref

Forum class.

__construct(context $context,stdClass $coursemodule,stdClass $course,int $effectivegroupmode,int $id,int $courseid,string $type,string $name,string $intro,int $introformat,int $assessed,int $assesstimestart,int $assesstimefinish,int $scale,int $gradeforum,bool $gradeforumnotify,int $maxbytes,int $maxattachments,int $forcesubscribe,int $trackingtype,int $rsstype,int $rssarticles,int $timemodified,int $warnafter,int $blockafter,int $blockperiod,int $completiondiscussions,int $completionreplies,int $completionposts,bool $displaywordcount,int $lockdiscussionafter,int $duedate,int $cutoffdate)   X-Ref
Constructor

param: context $context The forum module context
param: stdClass $coursemodule The forum course module record
param: stdClass $course The forum course record
param: int $effectivegroupmode The effective group mode
param: int $id ID
param: int $courseid Id of the course this forum is in
param: string $type The forum type, e.g. single, qanda, etc
param: string $name Name of the forum
param: string $intro Intro text
param: int $introformat Format of the intro text
param: int $assessed The forum rating aggregate
param: int $assesstimestart Timestamp to begin assessment
param: int $assesstimefinish Timestamp to end assessment
param: int $scale The rating scale
param: int $gradeforum The holistic grade
param: bool $gradeforumnotify Default for whether to notify students when grade holistically
param: int $maxbytes Maximum attachment size
param: int $maxattachments Maximum number of attachments
param: int $forcesubscribe Does the forum force users to subscribe?
param: int $trackingtype Tracking type
param: int $rsstype RSS type
param: int $rssarticles RSS articles
param: int $timemodified Timestamp when the forum was last modified
param: int $warnafter Warn after
param: int $blockafter Block after
param: int $blockperiod Block period
param: int $completiondiscussions Completion discussions
param: int $completionreplies Completion replies
param: int $completionposts Completion posts
param: bool $displaywordcount Should display word counts in posts
param: int $lockdiscussionafter Timestamp after which discussions should be locked
param: int $duedate Timestamp that represents the due date for forum posts
param: int $cutoffdate Timestamp after which forum posts will no longer be accepted

get_context()   X-Ref
Get the forum module context.

return: context

get_course_module_record()   X-Ref
Get the forum course module record

return: stdClass

get_effective_group_mode()   X-Ref
Get the effective group mode.

return: int

is_in_group_mode()   X-Ref
Check if the forum is set to group mode.

return: bool

get_course_record()   X-Ref
Get the course record.

return: stdClass

get_id()   X-Ref
Get the forum id.

return: int

get_course_id()   X-Ref
Get the id of the course that the forum belongs to.

return: int

get_type()   X-Ref
Get the forum type.

return: string

get_name()   X-Ref
Get the forum name.

return: string

get_intro()   X-Ref
Get the forum intro text.

return: string

get_intro_format()   X-Ref
Get the forum intro text format.

return: int

get_rating_aggregate()   X-Ref
Get the rating aggregate.

return: int

has_rating_aggregate()   X-Ref
Does the forum have a rating aggregate?

return: bool

get_assess_time_start()   X-Ref
Get the timestamp for when the assessment period begins.

return: int

get_assess_time_finish()   X-Ref
Get the timestamp for when the assessment period ends.

return: int

get_scale()   X-Ref
Get the rating scale.

return: int

get_grade_for_forum()   X-Ref
Get the grade for the forum when grading holistically.

return: int

is_grading_enabled()   X-Ref
Whether grading is enabled for this item.

return: bool

should_notify_students_default_when_grade_for_forum()   X-Ref
Get the default for whether the students should be notified when grading holistically.

return: bool

get_max_bytes()   X-Ref
Get the maximum bytes.

return: int

get_max_attachments()   X-Ref
Get the maximum number of attachments.

return: int

get_subscription_mode()   X-Ref
Get the subscription mode.

return: int

is_subscription_optional()   X-Ref
Is the subscription mode set to optional.

return: bool

is_subscription_forced()   X-Ref
Is the subscription mode set to forced.

return: bool

is_subscription_automatic()   X-Ref
Is the subscription mode set to automatic.

return: bool

is_subscription_disabled()   X-Ref
Is the subscription mode set to disabled.

return: bool

get_tracking_type()   X-Ref
Get the tracking type.

return: int

get_rss_type()   X-Ref
Get the RSS type.

return: int

get_rss_articles()   X-Ref
Get the RSS articles.

return: int

get_time_modified()   X-Ref
Get the timestamp for when the forum was last modified.

return: int

get_warn_after()   X-Ref
Get warn after.

return: int

get_block_after()   X-Ref
Get block after.

return: int

get_block_period()   X-Ref
Get the block period.

return: int

has_blocking_enabled()   X-Ref
Does the forum have blocking enabled?

return: bool

get_completion_discussions()   X-Ref
Get the completion discussions.

return: int

get_completion_replies()   X-Ref
Get the completion replies.

return: int

get_completion_posts()   X-Ref
Get the completion posts.

return: int

should_display_word_count()   X-Ref
Should the word counts be shown in the posts?

return: bool

get_lock_discussions_after()   X-Ref
Get the timestamp after which the discussion should be locked.

return: int

has_lock_discussions_after()   X-Ref
Does the forum have a discussion locking timestamp?

return: bool

is_discussion_time_locked(discussion_entity $discussion)   X-Ref
Check whether the discussion is locked based on forum's time based locking criteria

param: discussion_entity $discussion
return: bool

get_cutoff_date()   X-Ref
Get the cutoff date.

return: int

has_cutoff_date()   X-Ref
Does the forum have a cutoff date?

return: bool

is_cutoff_date_reached()   X-Ref
Is the cutoff date for the forum reached?

return: bool

get_due_date()   X-Ref
Get the due date.

return: int

has_due_date()   X-Ref
Does the forum have a due date?

return: bool

is_due_date_reached()   X-Ref
Is the due date for the forum reached?

return: bool

is_discussion_locked(discussion_entity $discussion)   X-Ref
Is the discussion locked? - Takes into account both discussion settings AND forum's criteria

param: discussion_entity $discussion The discussion to check
return: bool