Documentation

CreateAnnouncementDTO extends CreateDiscussionTopicDTO

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

$assignment

Assignment configuration for graded discussions

public array<string, mixed>|null $assignment = null

$discussionType

Discussion type (threaded, side_comment, flat)

public string|null $discussionType = null

$expandedLocked

Whether users can choose their preferred thread expansion setting

public bool|null $expandedLocked = null

$lockComment

If is_announcement and lock_comment are true, disable participant comments

public bool|null $lockComment = null

$podcastHasStudentPosts

Whether to include student posts in podcast

public bool|null $podcastHasStudentPosts = null

$requireInitialPost

Whether users must post before seeing replies

public bool|null $requireInitialPost = 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

$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

getAssignment()

Get assignment configuration

public getAssignment() : array<string, mixed>|null
Return values
array<string, mixed>|null

getAttachment()

Get attachment settings

public getAttachment() : array<string, mixed>|null
Return values
array<string, mixed>|null

getDelayedPostAt()

Get delayed post at date

public getDelayedPostAt() : string|null
Return values
string|null

getDiscussionType()

Get discussion type

public getDiscussionType() : string|null
Return values
string|null

getExpandedLocked()

Get expanded locked status

public getExpandedLocked() : bool|null
Return values
bool|null

getGroupCategoryId()

Get group category ID

public getGroupCategoryId() : int|null
Return values
int|null

getIsAnnouncement()

Get is announcement status

public getIsAnnouncement() : bool|null
Return values
bool|null

getOnlyGradersCanRate()

Get only graders can rate status

public getOnlyGradersCanRate() : bool|null
Return values
bool|null

getPodcastEnabled()

Get podcast enabled status

public getPodcastEnabled() : bool|null
Return values
bool|null

getPodcastHasStudentPosts()

Get podcast has student posts status

public getPodcastHasStudentPosts() : bool|null
Return values
bool|null

getPodcastSettings()

Get podcast settings

public getPodcastSettings() : array<string, mixed>|null
Return values
array<string, mixed>|null

getPointsPossible()

Get points possible

public getPointsPossible() : float|null
Return values
float|null

getPositionAfter()

Get position after

public getPositionAfter() : string|null
Return values
string|null

getRequireInitialPost()

Get require initial post status

public getRequireInitialPost() : bool|null
Return values
bool|null

getSortOrderLocked()

Get sort order locked status

public getSortOrderLocked() : bool|null
Return values
bool|null

getSpecificSections()

Get specific sections

public getSpecificSections() : array<string|int, int>|null
Return values
array<string|int, int>|null

lockComments()

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
self

setAllowRating()

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
self

setSortOrder()

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>
Return values
array<string|int, mixed>

        
On this page

Search results