Homework API
Homework items add these additional properties and methods to the ContentFrame API.
descriptionUrlurlGets the URL to the homework description.
homeworkGroupsHomeworkGroup[]Gets an array of HomeworkGroup objects, which contain information about each homework group in this homework activity.
startTimestringGets the start time formatted in the current user's culture.
statestringGets the current homework state. Possible values are:
  • active - the student is actively taking the homework
  • error - the homework encountered an error
  • review - the student is reviewing the answers
  • summary - start state of the homework
timeLeftstringGets the time left for the homework, formatted in the current user's culture.
timeLimitbooleanGets whether the homework has a time limit.
I18NobjectGets an object containing strings in the language of the current user. These are the object properties with their accompanying English text:
  • Attempts - Attempts
  • Both - Both
  • Print - Print
  • Remaining - Remaining
  • Review - Review
  • Score - Score
  • Start - Start
  • Student - Student
  • Teacher - Teacher
To listen to events, call addListener on the Frame API.
examstatechangedFires when the homework state changes.
examtimechangedFires when the time left changes for timed homework.
Appends the specified HTML to the description on the homework summary page.
appendToDescription(string html) : void
  • htmlHTML to append to the description.
This example appends some time-limit text to the summary page description.
api.appendToDescription("The time limit for this item is 30 minutes");
Performs an action for the content displayed within the content frame.
performAction(string type, various param) : void
  • type Defines the type of action to perform. These are the possible values:
  • NameMeaning
    descriptionView the description for the homework in a new window.
    doneGo back to the summary page.
    homeworkreviewReview a previously submitted homework set. Set param to the partId of the homework set to review. Typically, you obtain partid from HomeworkGroup.actions.
    homeworkstartStart a new or saved homework group. Set param to the partId of the saved homework group, or the partId of the homework group for a new attempt. Typically, you obtain partid from HomeworkGroup.actions.
    printOpen the homework for printing in a new window. Specify what to print with one of the following values for param:
    • 1 - Print a homework form for a student to take.
    • 2 - Print homework answer key for a teacher.
    • 3 - Print both student and teacher homework forms. If questions or answers are randomized, this prints an appropriate teacher key for the printed student homework.
    saveSave the homework.
    submitSubmit the homework.
  • paramAdditional, action-specific data, if any. See individual action types for descriptions of param data that the action requires.
This example starts the homework group with partId 3.
See Also
Content Frames ContentFrame API HomeworkGroup