CreateCourseDTO
extends AbstractBaseDto
in package
implements
DTOInterface
Abstract base class for Data Transfer Objects (DTOs).
Provides common functionality for all DTO classes including data population, array transformation for Canvas API multipart format, and date/time handling. DTOs are used to format and validate data before sending to the Canvas API.
Table of Contents
Interfaces
Properties
- $allowStudentForumAttachments : bool
- If true, students can attach files to forum posts.
- $allowStudentWikiEdits : bool
- If true, students will be able to modify the course wiki.
- $allowWikiComments : bool
- If true, course members will be able to comment on wiki pages.
- $applyAssignmentGroupWeights : bool
- Set to true to weight final grade based on assignment groups percentages.
- $courseCode : string
- The course code for the course.
- $courseFormat : string|null
- Optional. Specifies the format of the course. (Should be ‘on_campus’, ‘online’, or ‘blended’)
- $defaultView : string
- The type of page that users will see when they first visit the course - ‘feed’ Recent Activity Dashboard - ‘modules’ Course Modules/Sections Page - ‘assignments’ Course Assignments List - ‘syllabus’ Course Syllabus Page - other types may be added in the future Allowed values: feed, wiki, modules, syllabus, assignments
- $enableSisReactivation : bool
- When true, will first try to re-activate a deleted course with matching sis_course_id if possible.
- $endAt : DateTime|null
- Course end date in ISO8601 format, e.g. 2011-01-01T01:00Z.
- $enrollMe : bool
- Set to true to enroll the current user as the teacher.
- $gradePassbackSetting : string|null
- Optional. The grade_passback_setting for the course. Only ‘nightly_sync’, ‘disabled’, and ” are allowed.
- $gradingStandardId : int|null
- The grading standard id to set for the course.
- $hideFinalGrades : bool
- If this option is set to true, the totals in student grades summary will be hidden.
- $integrationId : string|null
- The unique Integration identifier.
- $isPublic : bool
- Set to true if course is public to both authenticated and unauthenticated users.
- $isPublicToAuthUsers : bool
- Set to true if course is public only to authenticated users.
- $license : string
- The name of the licensing. Should be one of the following abbreviations (a descriptive name is included in parenthesis for reference): - ‘private’ (Private Copyrighted) - ‘cc_by_nc_nd’ (CC Attribution Non-Commercial No Derivatives) - ‘cc_by_nc_sa’ (CC Attribution Non-Commercial Share Alike) - ‘cc_by_nc’ (CC Attribution Non-Commercial) - ‘cc_by_nd’ (CC Attribution No Derivatives) - ‘cc_by_sa’ (CC Attribution Share Alike) - ‘cc_by’ (CC Attribution) - ‘public_domain’ (Public Domain).
- $name : string
- The name of the course. If omitted, the course will be named “Unnamed Course.”
- $offer : bool
- If this option is set to true, the course will be available to students immediately.
- $openEnrollment : bool
- Set to true if the course is open enrollment.
- $postManually : bool
- Default is false. When true, all grades in the course must be posted manually, and will not be automatically posted. When false, all grades in the course will be automatically posted.
- $publicDescription : string|null
- A publicly visible description of the course.
- $publicSyllabus : bool
- Set to true to make the course syllabus public.
- $publicSyllabusToAuth : bool
- Set to true to make the course syllabus public for authenticated users.
- $restrictEnrollmentsToCourseDates : bool
- Set to true to restrict user enrollments to the start and end dates of the course.
- $selfEnrollment : bool
- Set to true if the course is self enrollment.
- $sisCourseId : string|null
- The unique SIS identifier.
- $startAt : DateTime|null
- Course start date in ISO8601 format, e.g. 2011-01-01T01:00Z.
- $syllabusBody : string|null
- The syllabus body for the course.
- $termId : int|null
- The unique ID of the term to create to course in.
- $timeZone : string
- The time zone for the course. Allowed time zones are IANA time zones or friendlier Ruby on Rails time zones.
- $apiPropertyName : string
- The name of the property in the API
Methods
- __construct() : mixed
- BaseDto constructor.
- getCourseCode() : string
- getCourseFormat() : string|null
- getDefaultView() : string
- getEndAt() : DateTime|null
- getGradePassbackSetting() : string|null
- getGradingStandardId() : int|null
- getIntegrationId() : string|null
- getLicense() : string
- getName() : string
- getPublicDescription() : string|null
- getSisCourseId() : string|null
- getStartAt() : DateTime|null
- getSyllabusBody() : string|null
- getTermId() : int|null
- getTimeZone() : string
- isAllowStudentForumAttachments() : bool
- isAllowStudentWikiEdits() : bool
- isAllowWikiComments() : bool
- isApplyAssignmentGroupWeights() : bool
- isEnableSisReactivation() : bool
- isEnrollMe() : bool
- isHideFinalGrades() : bool
- isOffer() : bool
- isOpenEnrollment() : bool
- isPostManually() : bool
- isPublic() : bool
- isPublicSyllabus() : bool
- isPublicSyllabusToAuth() : bool
- isPublicToAuthUsers() : bool
- isRestrictEnrollmentsToCourseDates() : bool
- isSelfEnrollment() : bool
- setAllowStudentForumAttachments() : void
- setAllowStudentWikiEdits() : void
- setAllowWikiComments() : void
- setApplyAssignmentGroupWeights() : void
- setCourseCode() : void
- setCourseFormat() : void
- setDefaultView() : void
- setEnableSisReactivation() : void
- setEndAt() : void
- setEnrollMe() : void
- setGradePassbackSetting() : void
- setGradingStandardId() : void
- setHideFinalGrades() : void
- setIntegrationId() : void
- setIsPublic() : void
- setIsPublicToAuthUsers() : void
- setLicense() : void
- setName() : void
- setOffer() : void
- setOpenEnrollment() : void
- setPostManually() : void
- setPublicDescription() : void
- setPublicSyllabus() : void
- setPublicSyllabusToAuth() : void
- setRestrictEnrollmentsToCourseDates() : void
- setSelfEnrollment() : void
- setSisCourseId() : void
- setStartAt() : void
- setSyllabusBody() : void
- setTermId() : void
- setTimeZone() : void
- 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
$allowStudentForumAttachments
If true, students can attach files to forum posts.
public
bool
$allowStudentForumAttachments
= false
$allowStudentWikiEdits
If true, students will be able to modify the course wiki.
public
bool
$allowStudentWikiEdits
= false
$allowWikiComments
If true, course members will be able to comment on wiki pages.
public
bool
$allowWikiComments
= false
$applyAssignmentGroupWeights
Set to true to weight final grade based on assignment groups percentages.
public
bool
$applyAssignmentGroupWeights
= false
$courseCode
The course code for the course.
public
string
$courseCode
= ''
$courseFormat
Optional. Specifies the format of the course. (Should be ‘on_campus’, ‘online’, or ‘blended’)
public
string|null
$courseFormat
= null
$defaultView
The type of page that users will see when they first visit the course - ‘feed’ Recent Activity Dashboard - ‘modules’ Course Modules/Sections Page - ‘assignments’ Course Assignments List - ‘syllabus’ Course Syllabus Page - other types may be added in the future Allowed values: feed, wiki, modules, syllabus, assignments
public
string
$defaultView
= 'syllabus'
$enableSisReactivation
When true, will first try to re-activate a deleted course with matching sis_course_id if possible.
public
bool
$enableSisReactivation
= false
$endAt
Course end date in ISO8601 format, e.g. 2011-01-01T01:00Z.
public
DateTime|null
$endAt
= null
This value is ignored unless ‘restrict_enrollments_to_course_dates’ is set to true.
$enrollMe
Set to true to enroll the current user as the teacher.
public
bool
$enrollMe
= false
$gradePassbackSetting
Optional. The grade_passback_setting for the course. Only ‘nightly_sync’, ‘disabled’, and ” are allowed.
public
string|null
$gradePassbackSetting
= null
$gradingStandardId
The grading standard id to set for the course.
public
int|null
$gradingStandardId
= null
If no value is provided for this argument the current grading_standard will be un-set from this course.
$hideFinalGrades
If this option is set to true, the totals in student grades summary will be hidden.
public
bool
$hideFinalGrades
= false
$integrationId
The unique Integration identifier.
public
string|null
$integrationId
= null
$isPublic
Set to true if course is public to both authenticated and unauthenticated users.
public
bool
$isPublic
= false
$isPublicToAuthUsers
Set to true if course is public only to authenticated users.
public
bool
$isPublicToAuthUsers
= false
$license
The name of the licensing. Should be one of the following abbreviations (a descriptive name is included in parenthesis for reference): - ‘private’ (Private Copyrighted) - ‘cc_by_nc_nd’ (CC Attribution Non-Commercial No Derivatives) - ‘cc_by_nc_sa’ (CC Attribution Non-Commercial Share Alike) - ‘cc_by_nc’ (CC Attribution Non-Commercial) - ‘cc_by_nd’ (CC Attribution No Derivatives) - ‘cc_by_sa’ (CC Attribution Share Alike) - ‘cc_by’ (CC Attribution) - ‘public_domain’ (Public Domain).
public
string
$license
= 'private'
$name
The name of the course. If omitted, the course will be named “Unnamed Course.”
public
string
$name
= 'Unnamed Course'
$offer
If this option is set to true, the course will be available to students immediately.
public
bool
$offer
= false
$openEnrollment
Set to true if the course is open enrollment.
public
bool
$openEnrollment
= false
$postManually
Default is false. When true, all grades in the course must be posted manually, and will not be automatically posted. When false, all grades in the course will be automatically posted.
public
bool
$postManually
= false
$publicDescription
A publicly visible description of the course.
public
string|null
$publicDescription
= null
$publicSyllabus
Set to true to make the course syllabus public.
public
bool
$publicSyllabus
= false
$publicSyllabusToAuth
Set to true to make the course syllabus public for authenticated users.
public
bool
$publicSyllabusToAuth
= false
$restrictEnrollmentsToCourseDates
Set to true to restrict user enrollments to the start and end dates of the course.
public
bool
$restrictEnrollmentsToCourseDates
= false
This value must be set to true in order to specify a course start date and/or end date.
$selfEnrollment
Set to true if the course is self enrollment.
public
bool
$selfEnrollment
= false
$sisCourseId
The unique SIS identifier.
public
string|null
$sisCourseId
= null
$startAt
Course start date in ISO8601 format, e.g. 2011-01-01T01:00Z.
public
DateTime|null
$startAt
= null
This value is ignored unless ‘restrict_enrollments_to_course_dates’ is set to true.
$syllabusBody
The syllabus body for the course.
public
string|null
$syllabusBody
= null
$termId
The unique ID of the term to create to course in.
public
int|null
$termId
= null
$timeZone
The time zone for the course. Allowed time zones are IANA time zones or friendlier Ruby on Rails time zones.
public
string
$timeZone
= 'UTC'
$apiPropertyName
The name of the property in the API
protected
string
$apiPropertyName
= ''
Methods
__construct()
BaseDto constructor.
public
__construct(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
Tags
getCourseCode()
public
getCourseCode() : string
Return values
stringgetCourseFormat()
public
getCourseFormat() : string|null
Return values
string|nullgetDefaultView()
public
getDefaultView() : string
Return values
stringgetEndAt()
public
getEndAt() : DateTime|null
Return values
DateTime|nullgetGradePassbackSetting()
public
getGradePassbackSetting() : string|null
Return values
string|nullgetGradingStandardId()
public
getGradingStandardId() : int|null
Return values
int|nullgetIntegrationId()
public
getIntegrationId() : string|null
Return values
string|nullgetLicense()
public
getLicense() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetPublicDescription()
public
getPublicDescription() : string|null
Return values
string|nullgetSisCourseId()
public
getSisCourseId() : string|null
Return values
string|nullgetStartAt()
public
getStartAt() : DateTime|null
Return values
DateTime|nullgetSyllabusBody()
public
getSyllabusBody() : string|null
Return values
string|nullgetTermId()
public
getTermId() : int|null
Return values
int|nullgetTimeZone()
public
getTimeZone() : string
Return values
stringisAllowStudentForumAttachments()
public
isAllowStudentForumAttachments() : bool
Return values
boolisAllowStudentWikiEdits()
public
isAllowStudentWikiEdits() : bool
Return values
boolisAllowWikiComments()
public
isAllowWikiComments() : bool
Return values
boolisApplyAssignmentGroupWeights()
public
isApplyAssignmentGroupWeights() : bool
Return values
boolisEnableSisReactivation()
public
isEnableSisReactivation() : bool
Return values
boolisEnrollMe()
public
isEnrollMe() : bool
Return values
boolisHideFinalGrades()
public
isHideFinalGrades() : bool
Return values
boolisOffer()
public
isOffer() : bool
Return values
boolisOpenEnrollment()
public
isOpenEnrollment() : bool
Return values
boolisPostManually()
public
isPostManually() : bool
Return values
boolisPublic()
public
isPublic() : bool
Return values
boolisPublicSyllabus()
public
isPublicSyllabus() : bool
Return values
boolisPublicSyllabusToAuth()
public
isPublicSyllabusToAuth() : bool
Return values
boolisPublicToAuthUsers()
public
isPublicToAuthUsers() : bool
Return values
boolisRestrictEnrollmentsToCourseDates()
public
isRestrictEnrollmentsToCourseDates() : bool
Return values
boolisSelfEnrollment()
public
isSelfEnrollment() : bool
Return values
boolsetAllowStudentForumAttachments()
public
setAllowStudentForumAttachments(bool $allowStudentForumAttachments) : void
Parameters
- $allowStudentForumAttachments : bool
setAllowStudentWikiEdits()
public
setAllowStudentWikiEdits(bool $allowStudentWikiEdits) : void
Parameters
- $allowStudentWikiEdits : bool
setAllowWikiComments()
public
setAllowWikiComments(bool $allowWikiComments) : void
Parameters
- $allowWikiComments : bool
setApplyAssignmentGroupWeights()
public
setApplyAssignmentGroupWeights(bool $applyAssignmentGroupWeights) : void
Parameters
- $applyAssignmentGroupWeights : bool
setCourseCode()
public
setCourseCode(string $courseCode) : void
Parameters
- $courseCode : string
setCourseFormat()
public
setCourseFormat(string|null $courseFormat) : void
Parameters
- $courseFormat : string|null
setDefaultView()
public
setDefaultView(string $defaultView) : void
Parameters
- $defaultView : string
setEnableSisReactivation()
public
setEnableSisReactivation(bool $enableSisReactivation) : void
Parameters
- $enableSisReactivation : bool
setEndAt()
public
setEndAt(DateTime|null $endAt) : void
Parameters
- $endAt : DateTime|null
setEnrollMe()
public
setEnrollMe(bool $enrollMe) : void
Parameters
- $enrollMe : bool
setGradePassbackSetting()
public
setGradePassbackSetting(string|null $gradePassbackSetting) : void
Parameters
- $gradePassbackSetting : string|null
setGradingStandardId()
public
setGradingStandardId(int|null $gradingStandardId) : void
Parameters
- $gradingStandardId : int|null
setHideFinalGrades()
public
setHideFinalGrades(bool $hideFinalGrades) : void
Parameters
- $hideFinalGrades : bool
setIntegrationId()
public
setIntegrationId(string|null $integrationId) : void
Parameters
- $integrationId : string|null
setIsPublic()
public
setIsPublic(bool $isPublic) : void
Parameters
- $isPublic : bool
setIsPublicToAuthUsers()
public
setIsPublicToAuthUsers(bool $isPublicToAuthUsers) : void
Parameters
- $isPublicToAuthUsers : bool
setLicense()
public
setLicense(string $license) : void
Parameters
- $license : string
setName()
public
setName(string $name) : void
Parameters
- $name : string
setOffer()
public
setOffer(bool $offer) : void
Parameters
- $offer : bool
setOpenEnrollment()
public
setOpenEnrollment(bool $openEnrollment) : void
Parameters
- $openEnrollment : bool
setPostManually()
public
setPostManually(bool $postManually) : void
Parameters
- $postManually : bool
setPublicDescription()
public
setPublicDescription(string|null $publicDescription) : void
Parameters
- $publicDescription : string|null
setPublicSyllabus()
public
setPublicSyllabus(bool $publicSyllabus) : void
Parameters
- $publicSyllabus : bool
setPublicSyllabusToAuth()
public
setPublicSyllabusToAuth(bool $publicSyllabusToAuth) : void
Parameters
- $publicSyllabusToAuth : bool
setRestrictEnrollmentsToCourseDates()
public
setRestrictEnrollmentsToCourseDates(bool $restrictEnrollmentsToCourseDates) : void
Parameters
- $restrictEnrollmentsToCourseDates : bool
setSelfEnrollment()
public
setSelfEnrollment(bool $selfEnrollment) : void
Parameters
- $selfEnrollment : bool
setSisCourseId()
public
setSisCourseId(string|null $sisCourseId) : void
Parameters
- $sisCourseId : string|null
setStartAt()
public
setStartAt(DateTime|null $startAt) : void
Parameters
- $startAt : DateTime|null
setSyllabusBody()
public
setSyllabusBody(string|null $syllabusBody) : void
Parameters
- $syllabusBody : string|null
setTermId()
public
setTermId(int|null $termId) : void
Parameters
- $termId : int|null
setTimeZone()
public
setTimeZone(string $timeZone) : void
Parameters
- $timeZone : string
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>