22 $a_parent_node_name =
"MediaObject")
25 $this->parent_node_name = $a_parent_node_name;
26 $this->hier_id = $a_hier_id;
27 $this->purpose = $a_purpose;
29 $this->item_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
33 function getMAItemNode($a_hier_id, $a_purpose, $a_pc_id =
"", $a_sub_element =
"")
38 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
40 if (count(
$res->nodeset) == 1)
42 return $res->nodeset[0];
47 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
49 if (count(
$res->nodeset) > 0)
51 return $res->nodeset[0];
60 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
62 if (count(
$res->nodeset) > 0)
70 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
72 if (count(
$res->nodeset) > 0)
83 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
85 if (count(
$res->nodeset) > 0)
93 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
95 if (count(
$res->nodeset) > 0)
108 $this->pcid = $a_pcid;
128 if (is_object($this->item_node))
144 $path =
"//PageContent[@HierId = '".$this->hier_id.
"']/".$this->parent_node_name;
146 if (count(
$res->nodeset) > 0)
148 $obj_node =&
$res->nodeset[0];
149 $item_node =& $this->dom->create_element(
"MediaAliasItem");
151 $item_node->set_attribute(
"Purpose", $this->purpose);
162 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
163 "", array(
"Width" => $a_width),
false);
172 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
174 if (is_object($layout_node))
176 return $layout_node->get_attribute(
"Width");
187 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
189 if (is_object($layout_node))
191 return $layout_node->has_attribute(
"Width");
201 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
203 if (is_object($layout_node))
205 if ($layout_node->has_attribute(
"Width"))
207 $layout_node->remove_attribute(
"Width");
209 if ($layout_node->has_attribute(
"Height"))
211 $layout_node->remove_attribute(
"Height");
222 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
223 "", array(
"Height" => $a_height),
false);
232 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
234 if (is_object($layout_node))
236 return $layout_node->get_attribute(
"Height");
247 array(
"TextRepresentation",
"Parameter",
"MapArea"),
248 $a_caption, array(
"Align" =>
"bottom"));
257 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
259 if (is_object($caption_node))
261 return $caption_node->get_content();
272 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
274 if (is_object($caption_node))
286 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
288 if (is_object($caption_node))
290 $caption_node->unlink_node($caption_node);
300 array(
"Parameter",
"MapArea"),
301 $a_text_representation, array());
309 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
310 $this->
getPcId(),
"/TextRepresentation");
311 if (is_object($text_representation_node))
313 return $text_representation_node->get_content();
324 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
325 $this->
getPcId(),
"/TextRepresentation");
326 if (is_object($text_representation_node))
338 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
339 $this->
getPcId(),
"/TextRepresentation");
340 if (is_object($text_representation_node))
342 $text_representation_node->unlink_node($text_representation_node);
349 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
350 "", array(
"HorizontalAlign" => $a_halign),
false);
356 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
358 if (is_object($layout_node))
360 return $layout_node->get_attribute(
"HorizontalAlign");
372 for($i=0; $i < count($par_nodes); $i++)
374 $par_node =& $par_nodes[$i];
375 $par_node->unlink_node($par_node);
378 if (is_array($a_par_array))
380 foreach($a_par_array as $par => $val)
382 $attributes = array (
"Name" => $par,
"Value" => $val);
384 "Parameter", array(
"MapArea"),
"", $attributes);
401 for($i=0; $i < count($par_nodes); $i++)
403 $par_node =& $par_nodes[$i];
404 $par_arr[] = $par_node->get_attribute(
"Name").
"=\"".$par_node->get_attribute(
"Value").
"\"";
406 return implode($par_arr,
", ");
417 for($i=0; $i < count($par_nodes); $i++)
419 $par_node =& $par_nodes[$i];
420 $par_arr[$par_node->get_attribute(
"Name")] =
421 $par_node->get_attribute(
"Value");
442 if (count($par_nodes) > 0)
456 if (count($par_nodes) > 0)
458 for($i=0; $i < count($par_nodes); $i++)
460 $par_node =& $par_nodes[$i];
461 $par_node->unlink_node($par_node);
474 $maparea_arr = array();
475 for($i=0; $i < count($ma_nodes); $i++)
477 $maparea_node = $ma_nodes[$i];
478 $childs = $maparea_node->child_nodes();
480 if ($childs[0]->node_name() ==
"ExtLink")
482 $link = array(
"LinkType" =>
"ExtLink",
483 "Href" => $childs[0]->get_attribute(
"Href"),
484 "Title" => $childs[0]->get_content());
486 if ($childs[0]->node_name() ==
"IntLink")
488 $link = array(
"LinkType" =>
"IntLink",
489 "Target" => $childs[0]->get_attribute(
"Target"),
490 "Type" => $childs[0]->get_attribute(
"Type"),
491 "TargetFrame" => $childs[0]->get_attribute(
"TargetFame"),
492 "Title" => $childs[0]->get_content());
494 $maparea_arr[] = array(
496 "Shape" => $maparea_node->get_attribute(
"Shape"),
497 "Coords" => $maparea_node->get_attribute(
"Coords"),
498 "Id" => $maparea_node->get_attribute(
"Id"),
512 if (is_object($ma_nodes[$a_nr - 1]))
514 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
515 if (is_object($childs[0]) &&
516 ($childs[0]->node_name() ==
"IntLink" || $childs[0]->node_name() ==
"ExtLink"))
518 $childs[0]->set_content($a_title);
530 if (is_object($ma_nodes[$a_nr - 1]))
534 $attributes = array(
"Type" => $a_type,
"Target" => $a_target,
535 "TargetFrame" => $a_target_frame);
537 array(
""),
$title, $attributes);
548 if (is_object($ma_nodes[$a_nr - 1]))
552 $attributes = array(
"Href" => $a_href);
554 array(
""),
$title, $attributes);
565 if (is_object($ma_nodes[$a_nr - 1]))
567 $ma_nodes[$a_nr - 1]->set_attribute(
"Shape", $a_shape_type);
568 $ma_nodes[$a_nr - 1]->set_attribute(
"Coords", $a_coords);
578 $attributes = array(
"Shape" => $a_shape_type,
579 "Coords" => $a_coords,
"Id" => $a_id);
581 "MapArea", array(),
"", $attributes);
583 if ($a_link[
"LinkType"] ==
"int" || $a_link[
"LinkType"] ==
"IntLink")
585 $attributes = array(
"Type" => $a_link[
"Type"],
586 "TargetFrame" => $a_link[
"TargetFrame"],
587 "Target" => $a_link[
"Target"]);
589 array(
""), $a_title, $attributes);
591 if ($a_link[
"LinkType"] ==
"ext" || $a_link[
"LinkType"] ==
"ExtLink")
593 $attributes = array(
"Href" => $a_link[
"Href"]);
595 array(
""), $a_title, $attributes);
607 if (is_object($ma_nodes[$a_nr - 1]))
609 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
620 foreach ($ma_nodes as $node)
622 if ($node->get_attribute(
"Id") == $a_id)
624 $node->unlink_node($node);
635 $path =
"//PageContent[@HierId = '".$this->hier_id.
"']/".$this->parent_node_name.
"/MediaAliasItem[@Purpose='".$this->purpose.
"']/MapArea";
637 for ($i = 0; $i < count(
$res->nodeset); $i++)
639 $res->nodeset[$i]->unlink_node(
$res->nodeset[$i]);
650 if (is_object($ma_nodes[$a_nr - 1]))
652 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
653 if ($childs[0]->node_name() ==
"IntLink")
657 if ($childs[0]->node_name() ==
"ExtLink")
671 if (is_object($ma_nodes[$a_nr - 1]))
673 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
674 return $childs[0]->get_attribute(
"Type");
685 if (is_object($ma_nodes[$a_nr - 1]))
687 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
688 return $childs[0]->get_attribute(
"Target");
699 if (is_object($ma_nodes[$a_nr - 1]))
701 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
702 return $childs[0]->get_attribute(
"TargetFrame");
713 if (is_object($ma_nodes[$a_nr - 1]))
715 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
716 return $childs[0]->get_attribute(
"Href");
727 if (is_object($ma_nodes[$a_nr - 1]))
729 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
730 return $childs[0]->get_content();
739 if (is_object($this->item_node))
741 $this->item_node->unlink_node($this->item_node);
752 $a_output_new_area, $a_area_type, $a_coords)
756 if (!$a_st_item->copyOriginal())
760 $a_st_item->buildMapWorkImage();
767 if ($width == 0 && $height == 0)
769 $width = $a_st_item->getWidth();
770 $height = $a_st_item->getHeight();
772 $size = @getimagesize($a_st_item->getMapWorkCopyName());
774 if (
$size[0] > 0 && $width > 0)
776 $x_ratio = $width /
$size[0];
779 if (
$size[1] > 0 && $height > 0)
781 $y_ratio = $height /
$size[1];
786 for ($i=0; $i < count($areas); $i++)
788 if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
789 ((($i+1) != $a_area_nr) && $a_exclude) ||
794 $area->setShape($areas[$i][
"Shape"]);
795 $area->setCoords($areas[$i][
"Coords"]);
796 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2,
true,
801 if ($a_output_new_area)
804 $area->setShape($a_area_type);
805 $area->setCoords($a_coords);
806 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2,
false,
810 $a_st_item->saveMapWorkImage();