Documentation

CreateQuizDTO extends AbstractBaseDto
in package
implements DTOInterface

Data Transfer Object for creating quizzes in Canvas LMS

This DTO handles the creation of new quizzes with all the necessary fields supported by the Canvas API.

Table of Contents

Interfaces

DTOInterface

Properties

$accessCode  : string|null
Access code/password for the quiz
$allowedAttempts  : int|null
Number of allowed attempts (-1 for unlimited)
$assignmentGroupId  : int|null
Assignment group ID for graded quizzes
$description  : string|null
Quiz description (HTML content)
$dueAt  : string|null
Quiz due date (ISO 8601 format)
$hideResults  : string|null
When to hide quiz results (null, always, until_after_last_attempt)
$ipFilter  : string|null
IP address filter/restriction
$lockAt  : string|null
Quiz lock date (ISO 8601 format)
$lockdownBrowserMonitorData  : string|null
Lockdown browser monitor data
$oneQuestionAtATime  : bool|null
Whether to display one question at a time
$pointsPossible  : float|null
Maximum points possible for this quiz
$published  : bool|null
Whether the quiz is published
$quizType  : string|null
Quiz type (assignment, practice_quiz, survey, graded_survey)
$requireLockdownBrowser  : bool|null
Whether the quiz requires lockdown browser
$requireLockdownBrowserForResults  : bool|null
Whether the quiz requires lockdown browser for results
$requireLockdownBrowserMonitor  : bool|null
Whether the quiz requires lockdown browser monitor
$showCorrectAnswers  : bool|null
Whether to show correct answers after submission
$shuffleAnswers  : bool|null
Whether to shuffle answers
$timeLimit  : int|null
Time limit in minutes
$title  : string|null
Quiz title (required)
$unlockAt  : string|null
Quiz unlock date (ISO 8601 format)
$apiPropertyName  : string
The API property name for multipart requests

Methods

__construct()  : mixed
BaseDto constructor.
getAccessCode()  : string|null
Get access code
getAllowedAttempts()  : int|null
Get allowed attempts
getAssignmentGroupId()  : int|null
Get assignment group ID
getDescription()  : string|null
Get quiz description
getDueAt()  : string|null
Get due date
getHideResults()  : string|null
Get hide results setting
getIpFilter()  : string|null
Get IP filter
getLockAt()  : string|null
Get lock date
getLockdownBrowserMonitorData()  : string|null
Get lockdown browser monitor data
getOneQuestionAtATime()  : bool|null
Get one question at a time status
getPointsPossible()  : float|null
Get points possible
getPublished()  : bool|null
Get published status
getQuizType()  : string|null
Get quiz type
getRequireLockdownBrowser()  : bool|null
Get require lockdown browser status
getRequireLockdownBrowserForResults()  : bool|null
Get require lockdown browser for results status
getRequireLockdownBrowserMonitor()  : bool|null
Get require lockdown browser monitor status
getShowCorrectAnswers()  : bool|null
Get show correct answers status
getShuffleAnswers()  : bool|null
Get shuffle answers status
getTimeLimit()  : int|null
Get time limit
getTitle()  : string|null
Get quiz title
getUnlockAt()  : string|null
Get unlock date
setAccessCode()  : void
Set access code
setAllowedAttempts()  : void
Set allowed attempts
setAssignmentGroupId()  : void
Set assignment group ID
setDescription()  : void
Set quiz description
setDueAt()  : void
Set due date
setHideResults()  : void
Set hide results setting
setIpFilter()  : void
Set IP filter
setLockAt()  : void
Set lock date
setLockdownBrowserMonitorData()  : void
Set lockdown browser monitor data
setOneQuestionAtATime()  : void
Set one question at a time status
setPointsPossible()  : void
Set points possible
setPublished()  : void
Set published status
setQuizType()  : void
Set quiz type
setRequireLockdownBrowser()  : void
Set require lockdown browser status
setRequireLockdownBrowserForResults()  : void
Set require lockdown browser for results status
setRequireLockdownBrowserMonitor()  : void
Set require lockdown browser monitor status
setShowCorrectAnswers()  : void
Set show correct answers status
setShuffleAnswers()  : void
Set shuffle answers status
setTimeLimit()  : void
Set time limit
setTitle()  : void
Set quiz title
setUnlockAt()  : void
Set unlock date
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

$accessCode

Access code/password for the quiz

public string|null $accessCode = null

$allowedAttempts

Number of allowed attempts (-1 for unlimited)

public int|null $allowedAttempts = null

$assignmentGroupId

Assignment group ID for graded quizzes

public int|null $assignmentGroupId = null

$description

Quiz description (HTML content)

public string|null $description = null

$dueAt

Quiz due date (ISO 8601 format)

public string|null $dueAt = null

$hideResults

When to hide quiz results (null, always, until_after_last_attempt)

public string|null $hideResults = null

$ipFilter

IP address filter/restriction

public string|null $ipFilter = null

$lockAt

Quiz lock date (ISO 8601 format)

public string|null $lockAt = null

$lockdownBrowserMonitorData

Lockdown browser monitor data

public string|null $lockdownBrowserMonitorData = null

$oneQuestionAtATime

Whether to display one question at a time

public bool|null $oneQuestionAtATime = null

$pointsPossible

Maximum points possible for this quiz

public float|null $pointsPossible = null

$published

Whether the quiz is published

public bool|null $published = null

$quizType

Quiz type (assignment, practice_quiz, survey, graded_survey)

public string|null $quizType = null

$requireLockdownBrowser

Whether the quiz requires lockdown browser

public bool|null $requireLockdownBrowser = null

$requireLockdownBrowserForResults

Whether the quiz requires lockdown browser for results

public bool|null $requireLockdownBrowserForResults = null

$requireLockdownBrowserMonitor

Whether the quiz requires lockdown browser monitor

public bool|null $requireLockdownBrowserMonitor = null

$showCorrectAnswers

Whether to show correct answers after submission

public bool|null $showCorrectAnswers = null

$shuffleAnswers

Whether to shuffle answers

public bool|null $shuffleAnswers = null

$timeLimit

Time limit in minutes

public int|null $timeLimit = null

$title

Quiz title (required)

public string|null $title = null

$unlockAt

Quiz unlock date (ISO 8601 format)

public string|null $unlockAt = null

$apiPropertyName

The API property name for multipart requests

protected string $apiPropertyName = 'quiz'

Methods

__construct()

BaseDto constructor.

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

getAccessCode()

Get access code

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

getAllowedAttempts()

Get allowed attempts

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

getAssignmentGroupId()

Get assignment group ID

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

getDescription()

Get quiz description

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

getDueAt()

Get due date

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

getHideResults()

Get hide results setting

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

getIpFilter()

Get IP filter

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

getLockAt()

Get lock date

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

getLockdownBrowserMonitorData()

Get lockdown browser monitor data

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

getOneQuestionAtATime()

Get one question at a time status

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

getPointsPossible()

Get points possible

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

getPublished()

Get published status

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

getQuizType()

Get quiz type

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

getRequireLockdownBrowser()

Get require lockdown browser status

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

getRequireLockdownBrowserForResults()

Get require lockdown browser for results status

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

getRequireLockdownBrowserMonitor()

Get require lockdown browser monitor status

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

getShowCorrectAnswers()

Get show correct answers status

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

getShuffleAnswers()

Get shuffle answers status

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

getTimeLimit()

Get time limit

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

getTitle()

Get quiz title

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

getUnlockAt()

Get unlock date

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

setAccessCode()

Set access code

public setAccessCode(string|null $accessCode) : void
Parameters
$accessCode : string|null

setAllowedAttempts()

Set allowed attempts

public setAllowedAttempts(int|null $allowedAttempts) : void
Parameters
$allowedAttempts : int|null

setAssignmentGroupId()

Set assignment group ID

public setAssignmentGroupId(int|null $assignmentGroupId) : void
Parameters
$assignmentGroupId : int|null

setDescription()

Set quiz description

public setDescription(string|null $description) : void
Parameters
$description : string|null

setDueAt()

Set due date

public setDueAt(string|null $dueAt) : void
Parameters
$dueAt : string|null

setHideResults()

Set hide results setting

public setHideResults(string|null $hideResults) : void
Parameters
$hideResults : string|null

setIpFilter()

Set IP filter

public setIpFilter(string|null $ipFilter) : void
Parameters
$ipFilter : string|null

setLockAt()

Set lock date

public setLockAt(string|null $lockAt) : void
Parameters
$lockAt : string|null

setLockdownBrowserMonitorData()

Set lockdown browser monitor data

public setLockdownBrowserMonitorData(string|null $lockdownBrowserMonitorData) : void
Parameters
$lockdownBrowserMonitorData : string|null

setOneQuestionAtATime()

Set one question at a time status

public setOneQuestionAtATime(bool|null $oneQuestionAtATime) : void
Parameters
$oneQuestionAtATime : bool|null

setPointsPossible()

Set points possible

public setPointsPossible(float|null $pointsPossible) : void
Parameters
$pointsPossible : float|null

setPublished()

Set published status

public setPublished(bool|null $published) : void
Parameters
$published : bool|null

setQuizType()

Set quiz type

public setQuizType(string|null $quizType) : void
Parameters
$quizType : string|null

setRequireLockdownBrowser()

Set require lockdown browser status

public setRequireLockdownBrowser(bool|null $requireLockdownBrowser) : void
Parameters
$requireLockdownBrowser : bool|null

setRequireLockdownBrowserForResults()

Set require lockdown browser for results status

public setRequireLockdownBrowserForResults(bool|null $requireLockdownBrowserForResults) : void
Parameters
$requireLockdownBrowserForResults : bool|null

setRequireLockdownBrowserMonitor()

Set require lockdown browser monitor status

public setRequireLockdownBrowserMonitor(bool|null $requireLockdownBrowserMonitor) : void
Parameters
$requireLockdownBrowserMonitor : bool|null

setShowCorrectAnswers()

Set show correct answers status

public setShowCorrectAnswers(bool|null $showCorrectAnswers) : void
Parameters
$showCorrectAnswers : bool|null

setShuffleAnswers()

Set shuffle answers status

public setShuffleAnswers(bool|null $shuffleAnswers) : void
Parameters
$shuffleAnswers : bool|null

setTimeLimit()

Set time limit

public setTimeLimit(int|null $timeLimit) : void
Parameters
$timeLimit : int|null

setTitle()

Set quiz title

public setTitle(string|null $title) : void
Parameters
$title : string|null

setUnlockAt()

Set unlock date

public setUnlockAt(string|null $unlockAt) : void
Parameters
$unlockAt : 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