26 public const AREA =
"Area";
36 public function init(): void
40 $this->
lng = $DIC->language();
54 parent::setNode($a_node);
56 if (isset($this->iim_node->myDOMNode)) {
57 $this->med_alias_node = $this->iim_node->first_child();
59 if (isset($this->med_alias_node) && $this->med_alias_node->myDOMNode != null) {
60 $id = $this->med_alias_node->get_attribute(
"OriginId");
82 $this->mediaobject = $a_mediaobject;
112 return $this->
getMediaObject()->getMediaItem(
"Standard")->getThumbnailTarget();
121 $this->node = $this->dom->create_element(
"PageContent");
123 $this->iim_node = $this->dom->create_element(
"InteractiveImage");
124 $this->iim_node = $this->node->append_child($this->iim_node);
125 $this->mal_node = $this->dom->create_element(
"MediaAlias");
126 $this->mal_node = $this->iim_node->append_child($this->mal_node);
130 $item_node = $this->dom->create_element(
"MediaAliasItem");
131 $item_node = $this->iim_node->append_child($item_node);
132 $item_node->set_attribute(
"Purpose",
"Standard");
135 $layout_node = $this->dom->create_element(
"Layout");
136 $layout_node = $item_node->append_child($layout_node);
137 if ($media_item->getWidth() > 0) {
140 if ($media_item->getHeight() > 0) {
143 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
146 if ($media_item->getCaption() !=
"") {
147 $cap_node = $this->dom->create_element(
"Caption");
148 $cap_node = $item_node->append_child($cap_node);
149 $cap_node->set_attribute(
"Align",
"bottom");
150 $cap_node->set_content($media_item->getCaption());
154 if ($media_item->getTextRepresentation() !=
"") {
155 $tr_node = $this->dom->create_element(
"TextRepresentation");
156 $tr_node = $item_node->append_child($tr_node);
157 $tr_node->set_content($media_item->getTextRepresentation());
163 $xml = $this->dom->dump_node($this->node);
182 foreach ($popups as $p) {
183 $max = max($max, (
int) $p[
"nr"]);
186 $new_item = $this->dom->create_element(
"ContentPopup");
187 $new_item->set_attribute(
"Title", $lng->
txt(
"cont_new_popup"));
188 $new_item->set_attribute(
"Nr", $max + 1);
189 $new_item = $this->iim_node->append_child($new_item);
198 $childs = $this->iim_node->child_nodes();
200 for (
$i = 0;
$i < count($childs);
$i++) {
201 if ($childs[
$i]->node_name() ==
"ContentPopup") {
202 $pc_id = $childs[
$i]->get_attribute(
"PCID");
203 $hier_id = $childs[
$i]->get_attribute(
"HierId");
204 $title = $childs[
$i]->get_attribute(
"Title");
205 $nr = $childs[
$i]->get_attribute(
"Nr");
207 $titles[] = array(
"title" => $title,
"nr" => $nr,
208 "pc_id" => $pc_id,
"hier_id" =>
$hier_id);
220 $childs = $this->iim_node->child_nodes();
221 for (
$i = 0;
$i < count($childs);
$i++) {
222 if ($childs[
$i]->node_name() ==
"ContentPopup") {
223 $pc_id = $childs[
$i]->get_attribute(
"PCID");
224 $hier_id = $childs[
$i]->get_attribute(
"HierId");
226 $childs[
$i]->set_attribute(
"Title", $a_popups[$k]);
239 $childs = $this->iim_node->child_nodes();
241 for (
$i = 0;
$i < count($childs);
$i++) {
242 if ($childs[
$i]->node_name() ==
"ContentPopup") {
243 if ($a_pc_id == $childs[
$i]->get_attribute(
"PCID") &&
244 $a_hier_id == $childs[
$i]->get_attribute(
"HierId")) {
245 $childs[
$i]->unlink($childs[
$i]);
260 string $a_shape_type,
266 foreach ($triggers as $t) {
267 $max = max($max, (
int) $t[
"Nr"]);
285 "OverlayX" =>
"0",
"OverlayY" =>
"0",
"Overlay" =>
"",
"PopupNr" =>
"",
286 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
291 array(
"ContentPopup"),
306 foreach ($triggers as $t) {
307 $max = max($max, (
int) $t[
"Nr"]);
311 "Title" => $lng->
txt(
"cont_new_marker"),
312 "Nr" => $max + 1,
"OverlayX" =>
"0",
"OverlayY" =>
"0",
313 "MarkerX" =>
"0",
"MarkerY" =>
"0",
"PopupNr" =>
"",
314 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
319 array(
"ContentPopup"),
330 if ($a_pc_id !=
"") {
331 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/InteractiveImage/Trigger";
333 if (count(
$res->nodeset) > 0) {
334 return $res->nodeset;
339 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/InteractiveImage/Trigger";
341 if (count(
$res->nodeset) > 0) {
342 return $res->nodeset;
350 $trigger_arr = array();
351 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
352 $tr_node = $tr_nodes[
$i];
353 $childs = $tr_node->child_nodes();
354 $trigger_arr[] = array(
355 "Nr" => $tr_node->get_attribute(
"Nr"),
356 "Type" => $tr_node->get_attribute(
"Type"),
357 "Title" => $tr_node->get_attribute(
"Title"),
358 "OverlayX" => $tr_node->get_attribute(
"OverlayX"),
359 "OverlayY" => $tr_node->get_attribute(
"OverlayY"),
360 "MarkerX" => $tr_node->get_attribute(
"MarkerX"),
361 "MarkerY" => $tr_node->get_attribute(
"MarkerY"),
362 "Overlay" => $tr_node->get_attribute(
"Overlay"),
363 "PopupNr" => $tr_node->get_attribute(
"PopupNr"),
364 "PopupX" => $tr_node->get_attribute(
"PopupX"),
365 "PopupY" => $tr_node->get_attribute(
"PopupY"),
366 "PopupWidth" => $tr_node->get_attribute(
"PopupWidth"),
367 "PopupHeight" => $tr_node->get_attribute(
"PopupHeight")
382 $childs = $this->iim_node->child_nodes();
384 for (
$i = 0;
$i < count($childs);
$i++) {
385 if ($childs[
$i]->node_name() ==
"Trigger") {
386 if ($a_nr == $childs[
$i]->get_attribute(
"Nr")) {
387 $childs[
$i]->unlink($childs[
$i]);
403 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
404 $tr_node = $tr_nodes[
$i];
405 if (isset($a_ovs[
"" . $tr_node->get_attribute(
"Nr")])) {
406 $tr_node->set_attribute(
408 $a_ovs[
"" . $tr_node->get_attribute(
"Nr")]
422 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
423 $tr_node = $tr_nodes[
$i];
424 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
425 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
426 $tr_node->set_attribute(
"OverlayX", (
int) $pos[0]);
427 $tr_node->set_attribute(
"OverlayY", (
int) $pos[1]);
440 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
441 $tr_node = $tr_nodes[
$i];
442 if ($tr_node->get_attribute(
"Type") == self::MARKER) {
443 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
444 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
445 $tr_node->set_attribute(
"MarkerX", (
int) $pos[0]);
446 $tr_node->set_attribute(
"MarkerY", (
int) $pos[1]);
460 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
461 $tr_node = $tr_nodes[
$i];
462 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
463 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
464 $tr_node->set_attribute(
"PopupX", (
int) $pos[0]);
465 $tr_node->set_attribute(
"PopupY", (
int) $pos[1]);
478 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
479 $tr_node = $tr_nodes[
$i];
480 if (isset($a_size[
"" . $tr_node->get_attribute(
"Nr")])) {
481 $size = explode(
",", $a_size[
"" . $tr_node->get_attribute(
"Nr")]);
482 $tr_node->set_attribute(
"PopupWidth", (
int) $size[0]);
483 $tr_node->set_attribute(
"PopupHeight", (
int) $size[1]);
496 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
497 $tr_node = $tr_nodes[
$i];
498 if (isset($a_pops[(
string) $tr_node->get_attribute(
"Nr")])) {
499 $pop = $a_pops[(string) $tr_node->get_attribute(
"Nr")];
500 $tr_node->set_attribute(
"PopupNr", $pop);
513 for (
$i = 0;
$i < count($tr_nodes);
$i++) {
514 $tr_node = $tr_nodes[
$i];
515 if (isset($a_titles[(
string) $tr_node->get_attribute(
"Nr")])) {
516 $tr_node->set_attribute(
518 $a_titles[(
string) $tr_node->get_attribute(
"Nr")]
521 $tr_node->get_attribute(
"Nr"),
522 $a_titles[(string) $tr_node->get_attribute(
"Nr")]
534 $path =
"//PageContent[@PCID = '" . $this->
getPCId() .
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr .
"']/ExtLink";
536 if (count(
$res->nodeset) > 0) {
537 $res->nodeset[0]->set_content($a_title);
543 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr .
"']/ExtLink";
545 if (count(
$res->nodeset) > 0) {
546 $res->nodeset[0]->set_content($a_title);
xpath_eval(php4DOMXPath $xpath_context, string $eval_str, $contextnode=null)
ilMediaAliasItem $std_alias_item
setType(string $a_type)
Set Type.
deletePopup(string $a_hier_id, string $a_pc_id)
Delete popup.
setTriggerPopupPositions(array $a_pos)
Set trigger popup position.
setNode(php4DOMElement $a_node)
static addElementToList(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes)
Places a new node $a_node_name directly before nodes with names of $a_successors. ...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target.
setDom(php4DOMDocument $a_dom)
setTriggerOverlays(array $a_ovs)
Set trigger overlays.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
createAlias(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTriggerTitles(array $a_titles)
Set trigger titles.
addTriggerMarker()
Add a new trigger marker.
xpath_new_context($dom_document)
setTriggerPopupSize(array $a_size)
Set trigger popup size.
deleteTrigger(ilMediaAliasItem $a_alias_item, int $a_nr)
Delete Trigger.
getPopups()
Get popup captions.
setMediaObject(ilObjMediaObject $a_mediaobject)
savePopups(array $a_popups)
Save popups.
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
ilObjMediaObject $mediaobject
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
addContentPopup()
Add a tab.
setExtLinkTitle(int $a_nr, string $a_title)
setTriggerPopups(array $a_pops)
Set trigger popups.
getTriggerNodes(string $a_hier_id, string $a_pc_id="")
setTriggerMarkerPositions(array $a_pos)
Set trigger marker position.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readMediaObject(int $a_mob_id=0)
setTriggerOverlayPositions(array $a_pos)
Set trigger overlay position.
php4DOMElement $med_alias_node
static _lookupType(int $id, bool $reference=false)
addTriggerArea(ilMediaAliasItem $a_alias_item, string $a_shape_type, string $a_coords, string $a_title)
Add a new trigger.