32 $this->{
'@type'} =
$type;
33 if (is_object($placementAdvice) && (count(get_object_vars($placementAdvice)) > 0)) {
34 $this->placementAdvice = $placementAdvice;
66 if (!empty($mediaType)) {
67 $this->mediaType = $mediaType;
69 unset($this->mediaType);
84 }
else if (isset($this->title)) {
100 }
else if (isset($this->text)) {
125 $obj = new \stdClass();
126 $obj->{
'@context'} =
'http://purl.imsglobal.org/ctx/lti/v1/ContentItem';
127 if (!is_array($items)) {
128 $obj->{
'@graph'} =
array();
129 $obj->{
'@graph'}[] = $items;
131 $obj->{
'@graph'} = $items;
134 return json_encode($obj);
__construct($type, $placementAdvice=null, $id=null)
Class constructor.
if(!array_key_exists('StateId', $_REQUEST)) $id
setText($text)
Set a link text value for the content-item.
const LTI_LINK_MEDIA_TYPE
Media type for LTI launch links.
setUrl($url)
Set a URL value for the content-item.
setMediaType($mediaType)
Set a media type value for the content-item.
static toJson($items)
Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type ins...
Class to represent a content-item object.
Create styles array
The data for the language used.
setTitle($title)
Set a title value for the content-item.