3namespace ceLTIc\LTI\Content;
57 private $windowTarget =
null;
64 private $windowFeatures =
null;
78 private $displayWidth =
null;
85 private $displayHeight =
null;
106 $url =
null, $html =
null)
109 $this->displayWidth = $displayWidth;
110 $this->displayHeight = $displayHeight;
111 $this->windowTarget = $windowTarget;
112 $this->windowFeatures = $windowFeatures;
124 if (!empty($this->documentTarget)) {
125 $placement = new \stdClass();
127 if (!is_null($this->displayHeight)) {
128 $placement->displayHeight = $this->displayHeight;
130 if (!is_null($this->displayWidth)) {
131 $placement->displayWidth = $this->displayWidth;
133 if (!empty($this->windowTarget)) {
134 $placement->windowTarget = $this->windowTarget;
150 if (!empty($this->documentTarget)) {
151 $placement = new \stdClass();
152 switch ($this->documentTarget) {
154 if (!empty($this->url)) {
155 $placement->src = $this->url;
157 if (!is_null($this->displayWidth)) {
158 $placement->width = $this->displayWidth;
160 if (!is_null($this->displayHeight)) {
161 $placement->height = $this->displayHeight;
165 if (!is_null($this->displayWidth)) {
166 $placement->width = $this->displayWidth;
168 if (!is_null($this->displayHeight)) {
169 $placement->height = $this->displayHeight;
171 if (!is_null($this->windowTarget)) {
172 $placement->targetName = $this->windowTarget;
174 if (!is_null($this->windowFeatures)) {
175 $placement->windowFeatures = $this->windowFeatures;
179 if (!empty($this->html)) {
180 $placement->html = $this->html;
202 $displayWidth =
null;
203 $displayHeight =
null;
204 $windowTarget =
null;
205 $windowFeatures =
null;
208 if (isset($item->{
'@type'})) {
210 if (isset($item->placementAdvice->presentationDocumentTarget)) {
215 if (isset($item->placementAdvice->displayWidth)) {
216 $displayWidth = $item->placementAdvice->displayWidth;
218 if (isset($item->placementAdvice->displayHeight)) {
219 $displayHeight = $item->placementAdvice->displayHeight;
221 if (isset($item->placementAdvice->windowTarget)) {
222 $windowTarget = $item->placementAdvice->windowTarget;
225 if (isset($item->url)) {
230 if (isset($item->embed)) {
232 } elseif (isset($item->iframe)) {
234 } elseif (isset($item->window)) {
244 if (isset($item->{$documentTarget}->height)) {
245 $displayHeight = $item->{$documentTarget}->height;
247 if (isset($item->{$documentTarget}->targetName)) {
248 $windowTarget = $item->{$documentTarget}->targetName;
250 if (isset($item->{$documentTarget}->windowFeatures)) {
251 $windowFeatures = $item->{$documentTarget}->windowFeatures;
253 if (isset($item->{$documentTarget}->src)) {
254 $url = $item->{$documentTarget}->src;
256 if (isset($item->{$documentTarget}->html)) {
257 $html = $item->{$documentTarget}->html;
261 if (!empty($documentTarget)) {
262 $obj =
new Placement($documentTarget, $displayWidth, $displayHeight, $windowTarget, $windowFeatures, $url, $html);
Class to represent a content-item placement object.
$documentTarget
Location to open content in.
__construct($documentTarget, $displayWidth=null, $displayHeight=null, $windowTarget=null, $windowFeatures=null, $url=null, $html=null)
Class constructor.
const TYPE_OVERLAY
Overlay placement type.
static fromJsonObject($item, $documentTarget=null)
Generate the Placement object from an item.
const TYPE_IFRAME
iFrame placement type.
const TYPE_FRAME
Frame placement type.
const TYPE_POPUP
Popup placement type.
toJsonObject()
Generate the JSON object representation of the placement.
const TYPE_EMBED
Embed placement type.
toJsonldObject()
Generate the JSON-LD object representation of the placement.
const TYPE_WINDOW
Window placement type.