Class to represent a content-item object. More...
Public Member Functions | |
__construct ($type, $placementAdvices=null, $id=null) | |
Class constructor. | |
setUrl ($url) | |
Set a URL value for the content-item. | |
setMediaType ($mediaType) | |
Set a media type value for the content-item. | |
setTitle ($title) | |
Set a title value for the content-item. | |
setText ($text) | |
Set a link text value for the content-item. | |
setHtml ($html) | |
Set an HTML embed value for the content-item. | |
addPlacementAdvice ($placementAdvice) | |
Add a placement for the content-item. | |
setIcon ($icon) | |
Set an icon image for the content-item. | |
setThumbnail ($thumbnail) | |
Set a thumbnail image for the content-item. | |
setHideOnCreate ($hideOnCreate) | |
Set whether the content-item should be hidden from learners by default. | |
Static Public Member Functions | |
static | toJson ($items, $ltiVersion=Util::LTI_VERSION1) |
Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type instance. | |
static | fromJson ($items) |
Generate an array of Item objects from their JSON representation. | |
static | fromJsonItem ($item) |
Generate an Item object from its JSON or JSON-LD representation. | |
Data Fields | |
const | TYPE_LINK = 'link' |
Type for link content-item. | |
const | TYPE_LTI_LINK = 'ltiResourceLink' |
Type for LTI link content-item. | |
const | TYPE_LTI_ASSIGNMENT = 'ltiAssignment' |
Type for LTI assignment content-item. | |
const | TYPE_FILE = 'file' |
Type for file content-item. | |
const | TYPE_HTML = 'html' |
Type for HTML content-item. | |
const | TYPE_IMAGE = 'image' |
Type for image content-item. | |
const | LTI_LINK_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltilink' |
Media type for LTI launch links. | |
const | LTI_ASSIGNMENT_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltiassignment' |
Media type for LTI assignment links. | |
Protected Member Functions | |
toJsonldObject () | |
Wrap the content item to form an item complying with the application/vnd.ims.lti.v1.contentitems+json media type. | |
toJsonObject () | |
Wrap the content items to form a complete value for the https://purl.imsglobal.org/spec/lti-dl/claim/content_items claim. | |
fromJsonObject ($item) | |
Extract content-item details from its JSON representation. | |
Class to represent a content-item object.
Definition at line 14 of file Content/Item.php.
__construct | ( | $type, | |
$placementAdvices = null , |
|||
$id = null |
|||
) |
Class constructor.
string | $type | Class type of content-item |
Placement[] | Placement | null | $placementAdvices | Array of Placement objects (or single placement object) for item (optional) |
string | null | $id | URL of content-item (optional) |
Reimplemented in ContentItem.
Definition at line 141 of file Content/Item.php.
Referenced by LtiAssignmentItem\__construct().
addPlacementAdvice | ( | $placementAdvice | ) |
Add a placement for the content-item.
Placement | null | $placementAdvice | Placement advice object |
Definition at line 210 of file Content/Item.php.
|
static |
Generate an array of Item objects from their JSON representation.
object | $items | A JSON object representing Content-Items |
Definition at line 284 of file Content/Item.php.
|
static |
Generate an Item object from its JSON or JSON-LD representation.
object | $item | A JSON or JSON-LD object representing a content-item |
Definition at line 448 of file Content/Item.php.
|
protected |
Extract content-item details from its JSON representation.
object | $item | A JSON object representing a content-item |
Reimplemented in FileItem, and LtiLinkItem.
Definition at line 510 of file Content/Item.php.
setHideOnCreate | ( | $hideOnCreate | ) |
Set whether the content-item should be hidden from learners by default.
bool | null | $hideOnCreate | True if the item should be hidden from learners |
Definition at line 242 of file Content/Item.php.
setHtml | ( | $html | ) |
Set an HTML embed value for the content-item.
string | null | $html | HTML text value |
Definition at line 200 of file Content/Item.php.
setIcon | ( | $icon | ) |
Set an icon image for the content-item.
Image | null | $icon | Icon image object |
Definition at line 222 of file Content/Item.php.
setMediaType | ( | $mediaType | ) |
Set a media type value for the content-item.
string | null | $mediaType | Media type value |
Definition at line 170 of file Content/Item.php.
Referenced by LtiAssignmentItem\__construct(), and LtiLinkItem\__construct().
setText | ( | $text | ) |
Set a link text value for the content-item.
string | null | $text | Link text value |
Definition at line 190 of file Content/Item.php.
setThumbnail | ( | $thumbnail | ) |
Set a thumbnail image for the content-item.
Image | null | $thumbnail | Thumbnail image object |
Definition at line 232 of file Content/Item.php.
setTitle | ( | $title | ) |
Set a title value for the content-item.
string | null | $title | Title value |
Definition at line 180 of file Content/Item.php.
setUrl | ( | $url | ) |
Set a URL value for the content-item.
string | null | $url | URL value |
Definition at line 160 of file Content/Item.php.
|
static |
Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type instance.
Item[] | Item | $items | An array of content items or a single item |
string | $ltiVersion | LTI version in use |
Definition at line 255 of file Content/Item.php.
References Util\LTI_VERSION1P3.
|
protected |
Wrap the content item to form an item complying with the application/vnd.ims.lti.v1.contentitems+json media type.
Reimplemented in FileItem, and LtiLinkItem.
Definition at line 309 of file Content/Item.php.
|
protected |
Wrap the content items to form a complete value for the https://purl.imsglobal.org/spec/lti-dl/claim/content_items claim.
Reimplemented in FileItem, and LtiLinkItem.
Definition at line 377 of file Content/Item.php.
const LTI_ASSIGNMENT_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltiassignment' |
Media type for LTI assignment links.
Definition at line 55 of file Content/Item.php.
Referenced by LtiAssignmentItem\__construct().
const LTI_LINK_MEDIA_TYPE = 'application/vnd.ims.lti.v1.ltilink' |
Media type for LTI launch links.
Definition at line 50 of file Content/Item.php.
Referenced by LtiLinkItem\__construct().
const TYPE_FILE = 'file' |
Type for file content-item.
Definition at line 35 of file Content/Item.php.
Referenced by FileItem\__construct().
const TYPE_HTML = 'html' |
Type for HTML content-item.
Definition at line 40 of file Content/Item.php.
const TYPE_IMAGE = 'image' |
Type for image content-item.
Definition at line 45 of file Content/Item.php.
const TYPE_LINK = 'link' |
Type for link content-item.
Definition at line 20 of file Content/Item.php.
const TYPE_LTI_ASSIGNMENT = 'ltiAssignment' |
Type for LTI assignment content-item.
Definition at line 30 of file Content/Item.php.
Referenced by LtiAssignmentItem\__construct().
const TYPE_LTI_LINK = 'ltiResourceLink' |
Type for LTI link content-item.
Definition at line 25 of file Content/Item.php.
Referenced by LtiLinkItem\__construct().