5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
51 $this->iim_node = $a_node->first_child();
52 $this->med_alias_node = $this->iim_node->first_child();
53 if (is_object($this->med_alias_node) && $this->med_alias_node->myDOMNode != null)
55 $id = $this->med_alias_node->get_attribute(
"OriginId");
62 include_once(
"./Services/COPage/classes/class.ilMediaAliasItem.php");
83 $this->mediaobject = $a_mediaobject;
93 return $this->mediaobject;
127 return $this->std_alias_item;
138 return $this->
getMediaObject()->getMediaItem(
"Standard")->getThumbnailTarget();
150 $this->node =& $this->dom->create_element(
"PageContent");
151 $a_pg_obj->insertContent($this, $a_hier_id,
IL_INSERT_AFTER, $a_pc_id);
152 $this->iim_node =& $this->dom->create_element(
"InteractiveImage");
153 $this->iim_node =& $this->node->append_child($this->iim_node);
154 $this->mal_node =& $this->dom->create_element(
"MediaAlias");
155 $this->mal_node =& $this->iim_node->append_child($this->mal_node);
156 $this->mal_node->set_attribute(
"OriginId",
"il__mob_".$this->
getMediaObject()->getId());
159 $item_node =& $this->dom->create_element(
"MediaAliasItem");
160 $item_node =& $this->iim_node->append_child($item_node);
161 $item_node->set_attribute(
"Purpose",
"Standard");
164 $layout_node =& $this->dom->create_element(
"Layout");
165 $layout_node =& $item_node->append_child($layout_node);
166 if ($media_item->getWidth() > 0)
170 if ($media_item->getHeight() > 0)
174 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
177 if ($media_item->getCaption() !=
"")
179 $cap_node =& $this->dom->create_element(
"Caption");
180 $cap_node =& $item_node->append_child($cap_node);
181 $cap_node->set_attribute(
"Align",
"bottom");
182 $cap_node->set_content($media_item->getCaption());
186 if ($media_item->getTextRepresentation() !=
"")
188 $tr_node =& $this->dom->create_element(
"TextRepresentation");
189 $tr_node =& $item_node->append_child($tr_node);
190 $tr_node->set_content($media_item->getTextRepresentation());
199 $xml = $this->dom->dump_node($this->node);
211 die(
"pcinteractiveimage: setstyleclass");
212 if (is_object($this->iim_node))
214 $mal_node = $this->iim_node->first_child();
215 if (is_object($mal_node))
217 if (!empty($a_class))
219 $mal_node->set_attribute(
"Class", $a_class);
223 if ($mal_node->has_attribute(
"Class"))
225 $mal_node->remove_attribute(
"Class");
239 if (is_object($this->iim_node))
241 $mal_node = $this->iim_node->first_child();
242 if (is_object($mal_node))
244 $class = $mal_node->get_attribute(
"Class");
265 foreach ($popups as $p)
267 $max = max($max, (
int) $p[
"nr"]);
270 $new_item = $this->dom->create_element(
"ContentPopup");
271 $new_item->set_attribute(
"Title", $lng->txt(
"cont_new_popup"));
272 $new_item->set_attribute(
"Nr", $max + 1);
273 $new_item = $this->iim_node->append_child($new_item);
282 $childs = $this->iim_node->child_nodes();
284 for($i = 0; $i < count($childs); $i++)
286 if ($childs[$i]->node_name() ==
"ContentPopup")
288 $pc_id = $childs[$i]->get_attribute(
"PCID");
289 $hier_id = $childs[$i]->get_attribute(
"HierId");
290 $title = $childs[$i]->get_attribute(
"Title");
291 $nr = $childs[$i]->get_attribute(
"Nr");
293 $titles[] = array(
"title" => $title,
"nr" => $nr,
294 "pc_id" => $pc_id,
"hier_id" =>
$hier_id);
306 $childs = $this->iim_node->child_nodes();
307 for($i = 0; $i < count($childs); $i++)
309 if ($childs[$i]->node_name() ==
"ContentPopup")
311 $pc_id = $childs[$i]->get_attribute(
"PCID");
312 $hier_id = $childs[$i]->get_attribute(
"HierId");
314 $childs[$i]->set_attribute(
"Title", $a_popups[$k]);
325 $childs = $this->iim_node->child_nodes();
327 for ($i=0; $i<count($childs); $i++)
329 if ($childs[$i]->node_name() ==
"ContentPopup")
331 if ($a_pc_id == $childs[$i]->get_attribute(
"PCID") &&
332 $a_hier_id == $childs[$i]->get_attribute(
"HierId"))
334 $childs[$i]->unlink($childs[$i]);
439 foreach ($triggers as
$t)
441 $max = max($max, (
int) $t[
"Nr"]);
448 $a_alias_item->addMapArea(
449 $a_shape_type, $a_coords,
452 $attributes = array(
"Type" => self::AREA,
455 "OverlayX" =>
"0",
"OverlayY" =>
"0",
"Overlay" =>
"",
"PopupNr" =>
"",
456 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
458 "Trigger", array(
"ContentPopup"),
"", $attributes);
470 foreach ($triggers as
$t)
472 $max = max($max, (
int) $t[
"Nr"]);
475 $attributes = array(
"Type" => self::MARKER,
476 "Title" => $lng->txt(
"cont_new_marker"),
477 "Nr" => $max + 1,
"OverlayX" =>
"0",
"OverlayY" =>
"0",
478 "MarkerX" =>
"0",
"MarkerY" =>
"0",
"PopupNr" =>
"",
479 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
481 "Trigger", array(
"ContentPopup"),
"", $attributes);
492 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/InteractiveImage/Trigger";
494 if (count(
$res->nodeset) > 0)
496 return $res->nodeset;
502 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/InteractiveImage/Trigger";
504 if (count(
$res->nodeset) > 0)
506 return $res->nodeset;
517 $trigger_arr = array();
518 for($i=0; $i < count($tr_nodes); $i++)
520 $tr_node = $tr_nodes[$i];
521 $childs = $tr_node->child_nodes();
522 $trigger_arr[] = array(
523 "Nr" => $tr_node->get_attribute(
"Nr"),
524 "Type" => $tr_node->get_attribute(
"Type"),
525 "Title" => $tr_node->get_attribute(
"Title"),
526 "OverlayX" => $tr_node->get_attribute(
"OverlayX"),
527 "OverlayY" => $tr_node->get_attribute(
"OverlayY"),
528 "MarkerX" => $tr_node->get_attribute(
"MarkerX"),
529 "MarkerY" => $tr_node->get_attribute(
"MarkerY"),
530 "Overlay" => $tr_node->get_attribute(
"Overlay"),
531 "PopupNr" => $tr_node->get_attribute(
"PopupNr"),
532 "PopupX" => $tr_node->get_attribute(
"PopupX"),
533 "PopupY" => $tr_node->get_attribute(
"PopupY"),
534 "PopupWidth" => $tr_node->get_attribute(
"PopupWidth"),
535 "PopupHeight" => $tr_node->get_attribute(
"PopupHeight")
548 $childs = $this->iim_node->child_nodes();
550 for ($i=0; $i<count($childs); $i++)
552 if ($childs[$i]->node_name() ==
"Trigger")
554 if ($a_nr == $childs[$i]->get_attribute(
"Nr"))
556 $childs[$i]->unlink($childs[$i]);
560 $a_alias_item->deleteMapAreaById($a_nr);
572 for($i=0; $i < count($tr_nodes); $i++)
574 $tr_node = $tr_nodes[$i];
575 if (isset($a_ovs[
"".$tr_node->get_attribute(
"Nr")]))
577 $tr_node->set_attribute(
"Overlay",
578 $a_ovs[
"".$tr_node->get_attribute(
"Nr")]);
591 for($i=0; $i < count($tr_nodes); $i++)
593 $tr_node = $tr_nodes[$i];
594 if (isset($a_pos[
"".$tr_node->get_attribute(
"Nr")]))
596 $pos = explode(
",", $a_pos[
"".$tr_node->get_attribute(
"Nr")]);
597 $tr_node->set_attribute(
"OverlayX", (
int) $pos[0]);
598 $tr_node->set_attribute(
"OverlayY", (
int) $pos[1]);
611 for($i=0; $i < count($tr_nodes); $i++)
613 $tr_node = $tr_nodes[$i];
616 if (isset($a_pos[
"".$tr_node->get_attribute(
"Nr")]))
618 $pos = explode(
",", $a_pos[
"".$tr_node->get_attribute(
"Nr")]);
619 $tr_node->set_attribute(
"MarkerX", (
int) $pos[0]);
620 $tr_node->set_attribute(
"MarkerY", (
int) $pos[1]);
634 for($i=0; $i < count($tr_nodes); $i++)
636 $tr_node = $tr_nodes[$i];
637 if (isset($a_pos[
"".$tr_node->get_attribute(
"Nr")]))
639 $pos = explode(
",", $a_pos[
"".$tr_node->get_attribute(
"Nr")]);
640 $tr_node->set_attribute(
"PopupX", (
int) $pos[0]);
641 $tr_node->set_attribute(
"PopupY", (
int) $pos[1]);
654 for($i=0; $i < count($tr_nodes); $i++)
656 $tr_node = $tr_nodes[$i];
657 if (isset($a_size[
"".$tr_node->get_attribute(
"Nr")]))
659 $size = explode(
",", $a_size[
"".$tr_node->get_attribute(
"Nr")]);
660 $tr_node->set_attribute(
"PopupWidth", (
int)
$size[0]);
661 $tr_node->set_attribute(
"PopupHeight", (
int) $size[1]);
674 for($i=0; $i < count($tr_nodes); $i++)
676 $tr_node = $tr_nodes[$i];
677 if (isset($a_pops[
"".$tr_node->get_attribute(
"Nr")]))
679 $pop = $a_pops[
"".$tr_node->get_attribute(
"Nr")];
680 $tr_node->set_attribute(
"PopupNr", $pop);
693 for($i=0; $i < count($tr_nodes); $i++)
695 $tr_node = $tr_nodes[$i];
696 if (isset($a_titles[
"".$tr_node->get_attribute(
"Nr")]))
698 $tr_node->set_attribute(
"Title",
699 $a_titles[
"".$tr_node->get_attribute(
"Nr")]);
701 $a_titles[
"".$tr_node->get_attribute(
"Nr")]);
714 if ($this->getPcId() !=
"")
717 $path =
"//PageContent[@PCID = '".$this->getPcId().
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='".$a_nr.
"']/ExtLink";
719 if (count(
$res->nodeset) > 0)
721 $res->nodeset[0]->set_content($a_title);
727 $path =
"//PageContent[@HierId = '".$this->hier_id.
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='".$a_nr.
"']/ExtLink";
729 if (count(
$res->nodeset) > 0)
731 $res->nodeset[0]->set_content($a_title);