CreateAnnouncementDTO
extends CreateDiscussionTopicDTO
in package
Data Transfer Object for creating announcements in Canvas LMS
This DTO extends CreateDiscussionTopicDTO and automatically sets announcement-specific defaults. Announcements are special discussion topics that serve as one-way broadcasts from instructors to students.
Table of Contents
Properties
- $allowRating : bool|null
- Whether the discussion allows rating
- $assignment : array<string, mixed>|null
- Assignment configuration for graded discussions
- $assignmentId : int|null
- Assignment ID for graded discussions
- $attachment : array<string, mixed>|null
- Attachment settings
- $delayedPostAt : string|null
- Discussion delayed post date (ISO 8601 format)
- $discussionType : string|null
- Discussion type (threaded, side_comment, flat)
- $expanded : bool|null
- Whether threaded replies should be expanded by default
- $expandedLocked : bool|null
- Whether users can choose their preferred thread expansion setting
- $gradingType : string|null
- Grading type for graded discussions
- $groupCategoryId : int|null
- Group category ID for group discussions
- $isAnnouncement : bool|null
- Whether this is an announcement
- $lockAt : string|null
- Discussion lock date (ISO 8601 format)
- $lockComment : bool|null
- If is_announcement and lock_comment are true, disable participant comments
- $locked : bool|null
- Whether the discussion is locked
- $message : string|null
- Discussion topic message/description (HTML content)
- $onlyGradersCanRate : bool|null
- Whether rating is only for graders
- $pinned : bool|null
- Whether the discussion is pinned
- $podcastEnabled : bool|null
- Whether to enable podcast feed
- $podcastHasStudentPosts : bool|null
- Whether to include student posts in podcast
- $podcastSettings : array<string, mixed>|null
- Podcast settings
- $pointsPossible : float|null
- Points possible for graded discussions
- $positionAfter : string|null
- Position after specified topic (for ordering)
- $postedAt : string|null
- Discussion posting date (ISO 8601 format)
- $published : bool|null
- Whether the discussion topic is published
- $readOnly : bool|null
- Whether the discussion is read only
- $requireInitialPost : bool|null
- Whether users must post before seeing replies
- $sortOrder : string|null
- Default sort order of the discussion (asc or desc)
- $sortOrderLocked : bool|null
- Whether users can choose their preferred sort order
- $specificSections : array<string|int, int>|null
- Specific sections the topic is assigned to
- $title : string|null
- Discussion topic title (required)
- $apiPropertyName : string
- The API property name for multipart requests
Methods
- __construct() : mixed
- Create a new announcement DTO with announcement-specific defaults
- getAllowRating() : bool|null
- Get allow rating status
- getAssignment() : array<string, mixed>|null
- Get assignment configuration
- getAssignmentId() : int|null
- Get assignment ID
- getAttachment() : array<string, mixed>|null
- Get attachment settings
- getDelayedPostAt() : string|null
- Get delayed post at date
- getDiscussionType() : string|null
- Get discussion type
- getExpanded() : bool|null
- Get expanded status
- getExpandedLocked() : bool|null
- Get expanded locked status
- getGradingType() : string|null
- Get grading type
- getGroupCategoryId() : int|null
- Get group category ID
- getIsAnnouncement() : bool|null
- Get is announcement status
- getLockAt() : string|null
- Get lock at date
- getLockComment() : bool|null
- Get lock comment status
- getLocked() : bool|null
- Get locked status
- getMessage() : string|null
- Get discussion topic message
- getOnlyGradersCanRate() : bool|null
- Get only graders can rate status
- getPinned() : bool|null
- Get pinned status
- getPodcastEnabled() : bool|null
- Get podcast enabled status
- getPodcastHasStudentPosts() : bool|null
- Get podcast has student posts status
- getPodcastSettings() : array<string, mixed>|null
- Get podcast settings
- getPointsPossible() : float|null
- Get points possible
- getPositionAfter() : string|null
- Get position after
- getPostedAt() : string|null
- Get posted at date
- getPublished() : bool|null
- Get published status
- getReadOnly() : bool|null
- Get read only status
- getRequireInitialPost() : bool|null
- Get require initial post status
- getSortOrder() : string|null
- Get sort order
- getSortOrderLocked() : bool|null
- Get sort order locked status
- getSpecificSections() : array<string|int, int>|null
- Get specific sections
- getTitle() : string|null
- Get discussion topic title
- lockComments() : self
- Lock comments on the announcement This prevents students from commenting on the announcement
- setAllowRating() : void
- Set allow rating status
- setAssignment() : void
- Set assignment configuration
- setAssignmentId() : void
- Set assignment ID
- setAttachment() : void
- Set attachment settings
- setDelayedPostAt() : void
- Set delayed post date for scheduled announcements
- setDiscussionType() : void
- Set discussion type
- setExpanded() : void
- Set expanded status
- setExpandedLocked() : void
- Set expanded locked status
- setGradingType() : void
- Set grading type
- setGroupCategoryId() : void
- Set group category ID
- setIsAnnouncement() : void
- Set is announcement status
- setLockAt() : void
- Set lock at date
- setLockComment() : void
- Set lock comment status
- setLocked() : void
- Set locked status
- setMessage() : void
- Set discussion topic message
- setOnlyGradersCanRate() : void
- Set only graders can rate status
- setPinned() : void
- Set pinned status
- setPodcastEnabled() : void
- Set podcast enabled status
- setPodcastHasStudentPosts() : void
- Set podcast has student posts status
- setPodcastSettings() : void
- Set podcast settings
- setPointsPossible() : void
- Set points possible
- setPositionAfter() : void
- Set position after
- setPostedAt() : void
- Set posted at date
- setPublished() : void
- Set published status
- setReadOnly() : void
- Set read only status
- setRequireInitialPost() : void
- Set require initial post status
- setSections() : self
- Set sections for targeted announcements Allows announcements to be sent to specific course sections only
- setSortOrder() : void
- Set sort order
- setSortOrderLocked() : void
- Set sort order locked status
- setSpecificSections() : void
- Set specific sections
- setTitle() : void
- Set discussion topic title
- toApiArray() : array<string|int, mixed>
- Convert the DTO to an array for API requests
- toArray() : array<string|int, mixed>
- Convert the DTO to an array
Properties
$allowRating
Whether the discussion allows rating
public
bool|null
$allowRating
= null
$assignment
Assignment configuration for graded discussions
public
array<string, mixed>|null
$assignment
= null
$assignmentId
Assignment ID for graded discussions
public
int|null
$assignmentId
= null
$attachment
Attachment settings
public
array<string, mixed>|null
$attachment
= null
$delayedPostAt
Discussion delayed post date (ISO 8601 format)
public
string|null
$delayedPostAt
= null
$discussionType
Discussion type (threaded, side_comment, flat)
public
string|null
$discussionType
= null
$expanded
Whether threaded replies should be expanded by default
public
bool|null
$expanded
= null
$expandedLocked
Whether users can choose their preferred thread expansion setting
public
bool|null
$expandedLocked
= null
$gradingType
Grading type for graded discussions
public
string|null
$gradingType
= null
$groupCategoryId
Group category ID for group discussions
public
int|null
$groupCategoryId
= null
$isAnnouncement
Whether this is an announcement
public
bool|null
$isAnnouncement
= null
$lockAt
Discussion lock date (ISO 8601 format)
public
string|null
$lockAt
= null
$lockComment
If is_announcement and lock_comment are true, disable participant comments
public
bool|null
$lockComment
= null
$locked
Whether the discussion is locked
public
bool|null
$locked
= null
$message
Discussion topic message/description (HTML content)
public
string|null
$message
= null
$onlyGradersCanRate
Whether rating is only for graders
public
bool|null
$onlyGradersCanRate
= null
$pinned
Whether the discussion is pinned
public
bool|null
$pinned
= null
$podcastEnabled
Whether to enable podcast feed
public
bool|null
$podcastEnabled
= null
$podcastHasStudentPosts
Whether to include student posts in podcast
public
bool|null
$podcastHasStudentPosts
= null
$podcastSettings
Podcast settings
public
array<string, mixed>|null
$podcastSettings
= null
$pointsPossible
Points possible for graded discussions
public
float|null
$pointsPossible
= null
$positionAfter
Position after specified topic (for ordering)
public
string|null
$positionAfter
= null
$postedAt
Discussion posting date (ISO 8601 format)
public
string|null
$postedAt
= null
$published
Whether the discussion topic is published
public
bool|null
$published
= null
$readOnly
Whether the discussion is read only
public
bool|null
$readOnly
= null
$requireInitialPost
Whether users must post before seeing replies
public
bool|null
$requireInitialPost
= null
$sortOrder
Default sort order of the discussion (asc or desc)
public
string|null
$sortOrder
= null
$sortOrderLocked
Whether users can choose their preferred sort order
public
bool|null
$sortOrderLocked
= null
$specificSections
Specific sections the topic is assigned to
public
array<string|int, int>|null
$specificSections
= null
$title
Discussion topic title (required)
public
string|null
$title
= null
$apiPropertyName
The API property name for multipart requests
protected
string
$apiPropertyName
= 'discussion_topic'
Methods
__construct()
Create a new announcement DTO with announcement-specific defaults
public
__construct([array<string, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string, mixed> = []
-
Announcement data
getAllowRating()
Get allow rating status
public
getAllowRating() : bool|null
Return values
bool|nullgetAssignment()
Get assignment configuration
public
getAssignment() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetAssignmentId()
Get assignment ID
public
getAssignmentId() : int|null
Return values
int|nullgetAttachment()
Get attachment settings
public
getAttachment() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetDelayedPostAt()
Get delayed post at date
public
getDelayedPostAt() : string|null
Return values
string|nullgetDiscussionType()
Get discussion type
public
getDiscussionType() : string|null
Return values
string|nullgetExpanded()
Get expanded status
public
getExpanded() : bool|null
Return values
bool|nullgetExpandedLocked()
Get expanded locked status
public
getExpandedLocked() : bool|null
Return values
bool|nullgetGradingType()
Get grading type
public
getGradingType() : string|null
Return values
string|nullgetGroupCategoryId()
Get group category ID
public
getGroupCategoryId() : int|null
Return values
int|nullgetIsAnnouncement()
Get is announcement status
public
getIsAnnouncement() : bool|null
Return values
bool|nullgetLockAt()
Get lock at date
public
getLockAt() : string|null
Return values
string|nullgetLockComment()
Get lock comment status
public
getLockComment() : bool|null
Return values
bool|nullgetLocked()
Get locked status
public
getLocked() : bool|null
Return values
bool|nullgetMessage()
Get discussion topic message
public
getMessage() : string|null
Return values
string|nullgetOnlyGradersCanRate()
Get only graders can rate status
public
getOnlyGradersCanRate() : bool|null
Return values
bool|nullgetPinned()
Get pinned status
public
getPinned() : bool|null
Return values
bool|nullgetPodcastEnabled()
Get podcast enabled status
public
getPodcastEnabled() : bool|null
Return values
bool|nullgetPodcastHasStudentPosts()
Get podcast has student posts status
public
getPodcastHasStudentPosts() : bool|null
Return values
bool|nullgetPodcastSettings()
Get podcast settings
public
getPodcastSettings() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetPointsPossible()
Get points possible
public
getPointsPossible() : float|null
Return values
float|nullgetPositionAfter()
Get position after
public
getPositionAfter() : string|null
Return values
string|nullgetPostedAt()
Get posted at date
public
getPostedAt() : string|null
Return values
string|nullgetPublished()
Get published status
public
getPublished() : bool|null
Return values
bool|nullgetReadOnly()
Get read only status
public
getReadOnly() : bool|null
Return values
bool|nullgetRequireInitialPost()
Get require initial post status
public
getRequireInitialPost() : bool|null
Return values
bool|nullgetSortOrder()
Get sort order
public
getSortOrder() : string|null
Return values
string|nullgetSortOrderLocked()
Get sort order locked status
public
getSortOrderLocked() : bool|null
Return values
bool|nullgetSpecificSections()
Get specific sections
public
getSpecificSections() : array<string|int, int>|null
Return values
array<string|int, int>|nullgetTitle()
Get discussion topic title
public
getTitle() : string|null
Return values
string|nulllockComments()
Lock comments on the announcement This prevents students from commenting on the announcement
public
lockComments([bool $lockComments = true ]) : self
Parameters
- $lockComments : bool = true
-
Whether to lock comments
Return values
selfsetAllowRating()
Set allow rating status
public
setAllowRating(bool|null $allowRating) : void
Parameters
- $allowRating : bool|null
setAssignment()
Set assignment configuration
public
setAssignment(array<string, mixed>|null $assignment) : void
Parameters
- $assignment : array<string, mixed>|null
setAssignmentId()
Set assignment ID
public
setAssignmentId(int|null $assignmentId) : void
Parameters
- $assignmentId : int|null
setAttachment()
Set attachment settings
public
setAttachment(array<string, mixed>|null $attachment) : void
Parameters
- $attachment : array<string, mixed>|null
setDelayedPostAt()
Set delayed post date for scheduled announcements
public
setDelayedPostAt(string|null $delayedPostAt) : void
Parameters
- $delayedPostAt : string|null
-
ISO 8601 formatted datetime
setDiscussionType()
Set discussion type
public
setDiscussionType(string|null $discussionType) : void
Parameters
- $discussionType : string|null
setExpanded()
Set expanded status
public
setExpanded(bool|null $expanded) : void
Parameters
- $expanded : bool|null
setExpandedLocked()
Set expanded locked status
public
setExpandedLocked(bool|null $expandedLocked) : void
Parameters
- $expandedLocked : bool|null
setGradingType()
Set grading type
public
setGradingType(string|null $gradingType) : void
Parameters
- $gradingType : string|null
setGroupCategoryId()
Set group category ID
public
setGroupCategoryId(int|null $groupCategoryId) : void
Parameters
- $groupCategoryId : int|null
setIsAnnouncement()
Set is announcement status
public
setIsAnnouncement(bool|null $isAnnouncement) : void
Parameters
- $isAnnouncement : bool|null
setLockAt()
Set lock at date
public
setLockAt(string|null $lockAt) : void
Parameters
- $lockAt : string|null
setLockComment()
Set lock comment status
public
setLockComment(bool|null $lockComment) : void
Parameters
- $lockComment : bool|null
setLocked()
Set locked status
public
setLocked(bool|null $locked) : void
Parameters
- $locked : bool|null
setMessage()
Set discussion topic message
public
setMessage(string|null $message) : void
Parameters
- $message : string|null
setOnlyGradersCanRate()
Set only graders can rate status
public
setOnlyGradersCanRate(bool|null $onlyGradersCanRate) : void
Parameters
- $onlyGradersCanRate : bool|null
setPinned()
Set pinned status
public
setPinned(bool|null $pinned) : void
Parameters
- $pinned : bool|null
setPodcastEnabled()
Set podcast enabled status
public
setPodcastEnabled(bool|null $podcastEnabled) : void
Parameters
- $podcastEnabled : bool|null
setPodcastHasStudentPosts()
Set podcast has student posts status
public
setPodcastHasStudentPosts(bool|null $podcastHasStudentPosts) : void
Parameters
- $podcastHasStudentPosts : bool|null
setPodcastSettings()
Set podcast settings
public
setPodcastSettings(array<string, mixed>|null $podcastSettings) : void
Parameters
- $podcastSettings : array<string, mixed>|null
setPointsPossible()
Set points possible
public
setPointsPossible(float|null $pointsPossible) : void
Parameters
- $pointsPossible : float|null
setPositionAfter()
Set position after
public
setPositionAfter(string|null $positionAfter) : void
Parameters
- $positionAfter : string|null
setPostedAt()
Set posted at date
public
setPostedAt(string|null $postedAt) : void
Parameters
- $postedAt : string|null
setPublished()
Set published status
public
setPublished(bool|null $published) : void
Parameters
- $published : bool|null
setReadOnly()
Set read only status
public
setReadOnly(bool|null $readOnly) : void
Parameters
- $readOnly : bool|null
setRequireInitialPost()
Set require initial post status
public
setRequireInitialPost(bool|null $requireInitialPost) : void
Parameters
- $requireInitialPost : bool|null
setSections()
Set sections for targeted announcements Allows announcements to be sent to specific course sections only
public
setSections(array<string|int, int> $sectionIds) : self
Parameters
- $sectionIds : array<string|int, int>
-
Array of section IDs
Return values
selfsetSortOrder()
Set sort order
public
setSortOrder(string|null $sortOrder) : void
Parameters
- $sortOrder : string|null
setSortOrderLocked()
Set sort order locked status
public
setSortOrderLocked(bool|null $sortOrderLocked) : void
Parameters
- $sortOrderLocked : bool|null
setSpecificSections()
Set specific sections
public
setSpecificSections(array<string|int, int>|null $specificSections) : void
Parameters
- $specificSections : array<string|int, int>|null
setTitle()
Set discussion topic title
public
setTitle(string|null $title) : void
Parameters
- $title : string|null
toApiArray()
Convert the DTO to an array for API requests
public
toApiArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toArray()
Convert the DTO to an array
public
toArray() : array<string|int, mixed>