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.

Discussion class.

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

Defines 1 class


Class: discussion  - X-Ref

Discussion class.

__construct(int $id,int $courseid,int $forumid,string $name,int $firstpostid,int $userid,int $groupid,bool $assessed,int $timemodified,int $usermodified,int $timestart,int $timeend,bool $pinned,int $locked)   X-Ref
Constructor.

param: int $id ID
param: int $courseid Course id
param: int $forumid Forum id
param: string $name Discussion name
param: int $firstpostid Id of the first post in the discussion
param: int $userid Id of the user that created the discussion
param: int $groupid Group id if it's a group dicussion
param: bool $assessed Is the discussion assessed?
param: int $timemodified Timestamp for last modification to the discussion
param: int $usermodified Id of user that last modified the discussion
param: int $timestart Start time for the discussion
param: int $timeend End time for the discussion
param: bool $pinned Is the discussion pinned?
param: int $locked Time this discussion was locked

get_id()   X-Ref
Get the discussion id.

return: int

get_course_id()   X-Ref
Get the course id.

return: int

get_forum_id()   X-Ref
Get the forum id.

return: int

get_name()   X-Ref
Get the name of the discussion.

return: string

get_first_post_id()   X-Ref
Get the id of the fist post in the discussion.

return: int

get_user_id()   X-Ref
Get the id of the user that created the discussion.

return: int

get_group_id()   X-Ref
Get the id of the group that this discussion belongs to.

return: int

is_assessed()   X-Ref
Check if this discussion is assessed.

return: bool

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

return: int

get_user_modified()   X-Ref
Get the id of the user that last modified this discussion.

return: int

get_time_start()   X-Ref
Get the start time of this discussion. Returns zero if the discussion
has no designated start time.

return: int

get_time_end()   X-Ref
Get the end time of this discussion. Returns zero if the discussion
has no designated end time.

return: int

is_pinned()   X-Ref
Check if this discussion is pinned.

return: bool

get_locked()   X-Ref
Get the locked time of this discussion.

return: bool

is_locked()   X-Ref
Is this discussion locked based on it's locked attribute

return: bool

toggle_locked_state(int $timestamp)   X-Ref
Set the locked timestamp

param: int $timestamp The value we want to store into 'locked'

is_first_post(post_entity $post)   X-Ref
Check if the given post is the first post in this discussion.

param: post_entity $post The post to check
return: bool

has_started()   X-Ref
Check if the discussion has started yet. DEFAULTS: true if not set

return: bool

has_ended()   X-Ref
Check if the discussion has ended. DEFAULTS: false if not set

return: bool

has_group()   X-Ref
Check if the discussion belongs to a group.

return: bool

set_pinned(int $targetstate)   X-Ref
Set the pinned value for this entity

param: int $targetstate The state to change the pin to
return: bool

is_timed_discussion()   X-Ref
Check if the discussion is timed.

return: bool

is_timed_discussion_visible()   X-Ref
Check if the timed discussion is visible.

return: bool