86 private ?
string $url = null;
120 string $documentTarget,
121 ?
int $displayWidth = null,
122 ?
int $displayHeight = null,
123 ?
string $windowTarget = null,
124 ?
string $windowFeatures = null,
144 if (!empty($this->documentTarget)) {
145 $placement = new \stdClass();
147 if (!is_null($this->displayHeight)) {
150 if (!is_null($this->displayWidth)) {
153 if (!empty($this->windowTarget)) {
170 if (!empty($this->documentTarget)) {
171 $placement = new \stdClass();
172 switch ($this->documentTarget) {
173 case self::TYPE_IFRAME:
174 if (!empty($this->url)) {
177 if (!is_null($this->displayWidth)) {
180 if (!is_null($this->displayHeight)) {
184 case self::TYPE_WINDOW:
185 if (!is_null($this->displayWidth)) {
188 if (!is_null($this->displayHeight)) {
191 if (!is_null($this->windowTarget)) {
194 if (!is_null($this->windowFeatures)) {
198 case self::TYPE_EMBED:
199 if (!empty($this->
html)) {
220 $displayWidth = null;
221 $displayHeight = null;
222 $windowTarget = null;
223 $windowFeatures = null;
226 if (isset($item->{
'@type'})) {
227 if (empty($documentTarget) && isset($item->placementAdvice)) {
228 if (isset($item->placementAdvice->presentationDocumentTarget)) {
229 $documentTarget = $item->placementAdvice->presentationDocumentTarget;
232 if (!empty($documentTarget) && isset($item->placementAdvice)) {
233 if (isset($item->placementAdvice->displayWidth)) {
234 $displayWidth = $item->placementAdvice->displayWidth;
236 if (isset($item->placementAdvice->displayHeight)) {
237 $displayHeight = $item->placementAdvice->displayHeight;
239 if (isset($item->placementAdvice->windowTarget)) {
240 $windowTarget = $item->placementAdvice->windowTarget;
243 if (isset($item->url)) {
247 if (empty($documentTarget)) {
248 if (isset($item->embed)) {
249 $documentTarget =
'embed';
250 } elseif (isset($item->iframe)) {
251 $documentTarget =
'iframe';
252 } elseif (isset($item->window)) {
253 $documentTarget =
'window';
255 } elseif (!isset($item->{$documentTarget})) {
256 $documentTarget = null;
258 if (!empty($documentTarget)) {
259 if (isset($item->{$documentTarget}->width)) {
260 $displayWidth = $item->{$documentTarget}->width;
262 if (isset($item->{$documentTarget}->height)) {
263 $displayHeight = $item->{$documentTarget}->height;
265 if (isset($item->{$documentTarget}->targetName)) {
266 $windowTarget = $item->{$documentTarget}->targetName;
268 if (isset($item->{$documentTarget}->windowFeatures)) {
269 $windowFeatures = $item->{$documentTarget}->windowFeatures;
271 if (isset($item->{$documentTarget}->src)) {
272 $url = $item->{$documentTarget}->src;
274 if (isset($item->{$documentTarget}->html)) {
275 $html = $item->{$documentTarget}->html;
279 if (!empty($documentTarget)) {
280 $obj =
new Placement($documentTarget, $displayWidth, $displayHeight, $windowTarget, $windowFeatures, $url, $html);
string $url
URL of iframe src.
static fromJsonObject(object $item, string $documentTarget=null)
Generate the Placement object from an item.
const TYPE_FRAME
Frame placement type.
Class to represent a content-item placement object.
int $displayHeight
Height of item location.
__construct(string $documentTarget, ?int $displayWidth=null, ?int $displayHeight=null, ?string $windowTarget=null, ?string $windowFeatures=null, string $url=null, ?string $html=null)
Class constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $html
HTML to be embedded.
toJsonObject()
Generate the JSON object representation of the placement.
toJsonldObject()
Generate the JSON-LD object representation of the placement.
const TYPE_OVERLAY
Overlay placement type.
const TYPE_WINDOW
Window placement type.
string $documentTarget
Location to open content in.
string $windowTarget
Name of window target.
string $windowFeatures
Comma-separated list of window features.
const TYPE_IFRAME
iFrame placement type.
const TYPE_EMBED
Embed placement type.
const TYPE_POPUP
Popup placement type.
int $displayWidth
Width of item location.