5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
36 $this->lng = $DIC->language();
58 parent::setNode($a_node);
59 $this->iim_node = $a_node->first_child();
60 $this->med_alias_node = $this->iim_node->first_child();
61 if (is_object($this->med_alias_node) && $this->med_alias_node->myDOMNode != null) {
62 $id = $this->med_alias_node->get_attribute(
"OriginId");
68 include_once(
"./Services/COPage/classes/class.ilMediaAliasItem.php");
93 $this->mediaobject = $a_mediaobject;
103 return $this->mediaobject;
117 public function create($a_pg_obj, $a_hier_id)
137 return $this->std_alias_item;
148 return $this->
getMediaObject()->getMediaItem(
"Standard")->getThumbnailTarget();
158 public function createAlias(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
160 $this->node = $this->dom->create_element(
"PageContent");
161 $a_pg_obj->insertContent($this, $a_hier_id,
IL_INSERT_AFTER, $a_pc_id);
162 $this->iim_node = $this->dom->create_element(
"InteractiveImage");
163 $this->iim_node = $this->node->append_child($this->iim_node);
164 $this->mal_node = $this->dom->create_element(
"MediaAlias");
165 $this->mal_node = $this->iim_node->append_child($this->mal_node);
166 $this->mal_node->set_attribute(
"OriginId",
"il__mob_" . $this->
getMediaObject()->getId());
169 $item_node = $this->dom->create_element(
"MediaAliasItem");
170 $item_node = $this->iim_node->append_child($item_node);
171 $item_node->set_attribute(
"Purpose",
"Standard");
174 $layout_node = $this->dom->create_element(
"Layout");
175 $layout_node = $item_node->append_child($layout_node);
176 if ($media_item->getWidth() > 0) {
179 if ($media_item->getHeight() > 0) {
182 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
185 if ($media_item->getCaption() !=
"") {
186 $cap_node = $this->dom->create_element(
"Caption");
187 $cap_node = $item_node->append_child($cap_node);
188 $cap_node->set_attribute(
"Align",
"bottom");
189 $cap_node->set_content($media_item->getCaption());
193 if ($media_item->getTextRepresentation() !=
"") {
194 $tr_node = $this->dom->create_element(
"TextRepresentation");
195 $tr_node = $item_node->append_child($tr_node);
196 $tr_node->set_content($media_item->getTextRepresentation());
205 $xml = $this->dom->dump_node($this->node);
217 die(
"pcinteractiveimage: setstyleclass");
218 if (is_object($this->iim_node)) {
219 $mal_node = $this->iim_node->first_child();
220 if (is_object($mal_node)) {
221 if (!empty($a_class)) {
222 $mal_node->set_attribute(
"Class", $a_class);
224 if ($mal_node->has_attribute(
"Class")) {
225 $mal_node->remove_attribute(
"Class");
239 if (is_object($this->iim_node)) {
240 $mal_node = $this->iim_node->first_child();
241 if (is_object($mal_node)) {
242 $class = $mal_node->get_attribute(
"Class");
263 foreach ($popups as $p) {
264 $max = max($max, (
int) $p[
"nr"]);
267 $new_item = $this->dom->create_element(
"ContentPopup");
268 $new_item->set_attribute(
"Title",
$lng->txt(
"cont_new_popup"));
269 $new_item->set_attribute(
"Nr", $max + 1);
270 $new_item = $this->iim_node->append_child($new_item);
279 $childs = $this->iim_node->child_nodes();
281 for (
$i = 0;
$i < count($childs);
$i++) {
282 if ($childs[
$i]->node_name() ==
"ContentPopup") {
283 $pc_id = $childs[
$i]->get_attribute(
"PCID");
284 $hier_id = $childs[
$i]->get_attribute(
"HierId");
285 $title = $childs[
$i]->get_attribute(
"Title");
286 $nr = $childs[
$i]->get_attribute(
"Nr");
289 "pc_id" => $pc_id,
"hier_id" =>
$hier_id);
301 $childs = $this->iim_node->child_nodes();
302 for (
$i = 0;
$i < count($childs);
$i++) {
303 if ($childs[
$i]->node_name() ==
"ContentPopup") {
304 $pc_id = $childs[
$i]->get_attribute(
"PCID");
305 $hier_id = $childs[
$i]->get_attribute(
"HierId");
307 $childs[
$i]->set_attribute(
"Title", $a_popups[$k]);
318 $childs = $this->iim_node->child_nodes();
320 for (
$i=0;
$i<count($childs);
$i++) {
321 if ($childs[
$i]->node_name() ==
"ContentPopup") {
322 if ($a_pc_id == $childs[
$i]->get_attribute(
"PCID") &&
323 $a_hier_id == $childs[
$i]->get_attribute(
"HierId")) {
324 $childs[
$i]->unlink($childs[
$i]);
433 foreach ($triggers as
$t) {
434 $max = max($max, (
int) $t[
"Nr"]);
441 $a_alias_item->addMapArea(
452 "OverlayX" =>
"0",
"OverlayY" =>
"0",
"Overlay" =>
"",
"PopupNr" =>
"",
453 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
458 array(
"ContentPopup"),
473 foreach ($triggers as
$t) {
474 $max = max($max, (
int) $t[
"Nr"]);
478 "Title" =>
$lng->txt(
"cont_new_marker"),
479 "Nr" => $max + 1,
"OverlayX" =>
"0",
"OverlayY" =>
"0",
480 "MarkerX" =>
"0",
"MarkerY" =>
"0",
"PopupNr" =>
"",
481 "PopupX" =>
"0",
"PopupY" =>
"0",
"PopupWidth" =>
"150",
"PopupHeight" =>
"200");
486 array(
"ContentPopup"),
497 if ($a_pc_id !=
"") {
499 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/InteractiveImage/Trigger";
501 if (count(
$res->nodeset) > 0) {
502 return $res->nodeset;
508 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/InteractiveImage/Trigger";
510 if (count(
$res->nodeset) > 0) {
511 return $res->nodeset;
522 $trigger_arr =
array();
523 for (
$i=0;
$i < count($tr_nodes);
$i++) {
524 $tr_node = $tr_nodes[
$i];
525 $childs = $tr_node->child_nodes();
526 $trigger_arr[] =
array(
527 "Nr" => $tr_node->get_attribute(
"Nr"),
528 "Type" => $tr_node->get_attribute(
"Type"),
529 "Title" => $tr_node->get_attribute(
"Title"),
530 "OverlayX" => $tr_node->get_attribute(
"OverlayX"),
531 "OverlayY" => $tr_node->get_attribute(
"OverlayY"),
532 "MarkerX" => $tr_node->get_attribute(
"MarkerX"),
533 "MarkerY" => $tr_node->get_attribute(
"MarkerY"),
534 "Overlay" => $tr_node->get_attribute(
"Overlay"),
535 "PopupNr" => $tr_node->get_attribute(
"PopupNr"),
536 "PopupX" => $tr_node->get_attribute(
"PopupX"),
537 "PopupY" => $tr_node->get_attribute(
"PopupY"),
538 "PopupWidth" => $tr_node->get_attribute(
"PopupWidth"),
539 "PopupHeight" => $tr_node->get_attribute(
"PopupHeight")
552 $childs = $this->iim_node->child_nodes();
554 for (
$i=0;
$i<count($childs);
$i++) {
555 if ($childs[
$i]->node_name() ==
"Trigger") {
556 if ($a_nr == $childs[
$i]->get_attribute(
"Nr")) {
557 $childs[
$i]->unlink($childs[
$i]);
561 $a_alias_item->deleteMapAreaById($a_nr);
573 for (
$i=0;
$i < count($tr_nodes);
$i++) {
574 $tr_node = $tr_nodes[
$i];
575 if (isset($a_ovs[
"" . $tr_node->get_attribute(
"Nr")])) {
576 $tr_node->set_attribute(
578 $a_ovs[
"" . $tr_node->get_attribute(
"Nr")]
592 for (
$i=0;
$i < count($tr_nodes);
$i++) {
593 $tr_node = $tr_nodes[
$i];
594 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
595 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
596 $tr_node->set_attribute(
"OverlayX", (
int) $pos[0]);
597 $tr_node->set_attribute(
"OverlayY", (
int) $pos[1]);
610 for (
$i=0;
$i < count($tr_nodes);
$i++) {
611 $tr_node = $tr_nodes[
$i];
612 if ($tr_node->get_attribute(
"Type") == self::MARKER) {
613 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
614 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
615 $tr_node->set_attribute(
"MarkerX", (
int) $pos[0]);
616 $tr_node->set_attribute(
"MarkerY", (
int) $pos[1]);
630 for (
$i=0;
$i < count($tr_nodes);
$i++) {
631 $tr_node = $tr_nodes[
$i];
632 if (isset($a_pos[
"" . $tr_node->get_attribute(
"Nr")])) {
633 $pos = explode(
",", $a_pos[
"" . $tr_node->get_attribute(
"Nr")]);
634 $tr_node->set_attribute(
"PopupX", (
int) $pos[0]);
635 $tr_node->set_attribute(
"PopupY", (
int) $pos[1]);
648 for (
$i=0;
$i < count($tr_nodes);
$i++) {
649 $tr_node = $tr_nodes[
$i];
650 if (isset($a_size[
"" . $tr_node->get_attribute(
"Nr")])) {
651 $size = explode(
",", $a_size[
"" . $tr_node->get_attribute(
"Nr")]);
652 $tr_node->set_attribute(
"PopupWidth", (
int)
$size[0]);
653 $tr_node->set_attribute(
"PopupHeight", (
int) $size[1]);
666 for (
$i=0;
$i < count($tr_nodes);
$i++) {
667 $tr_node = $tr_nodes[
$i];
668 if (isset($a_pops[
"" . $tr_node->get_attribute(
"Nr")])) {
669 $pop = $a_pops[
"" . $tr_node->get_attribute(
"Nr")];
670 $tr_node->set_attribute(
"PopupNr", $pop);
683 for (
$i=0;
$i < count($tr_nodes);
$i++) {
684 $tr_node = $tr_nodes[
$i];
685 if (isset($a_titles[
"" . $tr_node->get_attribute(
"Nr")])) {
686 $tr_node->set_attribute(
688 $a_titles[
"" . $tr_node->get_attribute(
"Nr")]
691 $tr_node->get_attribute(
"Nr"),
692 $a_titles[
"" . $tr_node->get_attribute(
"Nr")]
706 if ($this->getPcId() !=
"") {
708 $path =
"//PageContent[@PCID = '" . $this->getPcId() .
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr .
"']/ExtLink";
710 if (count(
$res->nodeset) > 0) {
711 $res->nodeset[0]->set_content($a_title);
717 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr .
"']/ExtLink";
719 if (count(
$res->nodeset) > 0) {
720 $res->nodeset[0]->set_content($a_title);
setTriggerPopups($a_pops)
Set trigger popups.
setExtLinkTitle($a_nr, $a_title)
Set ExtLink Title.
readMediaObject($a_mob_id=0)
Read/get Media Object.
create($a_pg_obj, $a_hier_id)
Create pc media object.
setTriggerPopupPositions($a_pos)
Set trigger popup position.
setNode($a_node)
Set node (and media object node)
deleteTrigger($a_alias_item, $a_nr)
Delete Trigger.
xpath_new_context($dom_document)
setTriggerMarkerPositions($a_pos)
Set trigger marker position.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
setType($a_type)
Set Type.
setDom(&$a_dom)
Set dom object.
addTriggerArea( $a_alias_item, $a_shape_type, $a_coords, $a_title, $a_link)
Get caption.
getMediaObject()
Get Media Object.
deletePopup($a_hier_id, $a_pc_id)
Delete popup.
savePopups($a_popups)
Save popups.
addTriggerMarker()
Add a new trigger marker.
setTriggerOverlays($a_ovs)
Set trigger overlays.
getPopups()
Get popup captions.
foreach($_POST as $key=> $value) $res
createMediaObject()
Create new media object.
setStyleClass($a_class)
Set style class.
getTriggerNodes($a_hier_id, $a_pc_id="")
Get trigger nodes.
getStyleClass()
Get style class.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
init()
Init page content component.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
setTriggerTitles($a_titles)
Set trigger titles.
getBaseThumbnailTarget()
Get base thumbnail target.
static addElementToList( $doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes)
Places a new node $a_node_name directly before nodes with names of $a_successors. ...
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
addContentPopup()
Add a tab.
getStandardAliasItem()
Get standard alias item.
setTriggerPopupSize($a_size)
Set trigger popup size.
setMediaObject($a_mediaobject)
Set Media Object.
getTriggers()
Get triggers.
setTriggerOverlayPositions($a_pos)
Set trigger overlay position.
getStandardMediaItem()
Get standard media item.
createAlias(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create an media alias in page.