3namespace ceLTIc\LTI\Content;
20 private $custom = array();
27 private $lineItem =
null;
34 private $available =
null;
41 private $submission =
null;
48 private $noUpdate =
null;
72 $this->custom[$name] = $value;
74 reset($this->custom[$name]);
86 $this->lineItem = $lineItem;
96 $this->available = $available;
106 $this->submission = $submission;
116 $this->noUpdate = $noUpdate;
126 $item = parent::toJsonldObject();
127 if (!empty($this->lineItem)) {
128 $item->lineItem = $this->lineItem->toJsonldObject();
130 if (!is_null($this->noUpdate)) {
131 $item->noUpdate = $this->noUpdate;
133 if (!is_null($this->available)) {
134 $item->available = $this->available->toJsonldObject();
136 if (!is_null($this->submission)) {
137 $item->submission = $this->submission->toJsonldObject();
139 if (!empty($this->custom)) {
140 $item->custom = $this->custom;
153 $item = parent::toJsonObject();
154 if (!empty($this->lineItem)) {
155 $item->lineItem = $this->lineItem->toJsonObject();
157 if (!is_null($this->noUpdate)) {
158 $item->noUpdate = $this->noUpdate;
160 if (!is_null($this->available)) {
161 $item->available = $this->available->toJsonObject();
163 if (!is_null($this->submission)) {
164 $item->submission = $this->submission->toJsonObject();
166 if (!empty($this->custom)) {
167 $item->custom = $this->custom;
180 parent::fromJsonObject($item);
181 foreach (get_object_vars($item) as $name => $value) {
184 foreach ($item->custom as $paramName => $paramValue) {
185 $this->
addCustom($paramName, $paramValue);
198 $this->noUpdate = $item->noUpdate;
Class to represent a content-item object.
const TYPE_LTI_LINK
Type for LTI link content-item.
const LTI_LINK_MEDIA_TYPE
Media type for LTI launch links.
setMediaType($mediaType)
Set a media type value for the content-item.
static fromJsonObject($item)
Generate a LineItem object from its JSON or JSON-LD representation.
Class to represent an LTI link content-item object.
addCustom($name, $value=null)
Add a custom parameter for the content-item.
__construct($placementAdvices=null, $id=null)
Class constructor.
toJsonObject()
Wrap the content items to form a complete value for the https://purl.imsglobal.org/spec/lti-dl/claim/...
fromJsonObject($item)
Extract content-item details from its JSON representation.
setSubmission($submission)
Set a submission time period for the content-item.
setLineItem($lineItem)
Set a line-item for the content-item.
setNoUpdate($noUpdate)
Set whether the content-item should not be allowed to be updated.
setAvailable($available)
Set an availability time period for the content-item.
toJsonldObject()
Wrap the content item to form an item complying with the application/vnd.ims.lti.v1....
static fromJsonObject($item)
Generate a LineItem object from its JSON or JSON-LD representation.