40 string $a_parent_node_name =
"MediaObject" 44 $this->
lng = $DIC->language();
45 $this->dom_doc = $dom;
46 $this->parent_node_name = $a_parent_node_name;
47 $this->hier_id = $a_hier_id;
48 $this->purpose = $a_purpose;
50 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
67 string $a_sub_element =
"" 70 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
71 $nodes = $this->dom_util->path($this->dom_doc,
$path);
72 if (count($nodes) == 1) {
73 return $nodes->item(0);
77 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
78 $nodes = $this->dom_util->path($this->dom_doc,
$path);
79 if (count($nodes) > 0) {
80 return $nodes->item(0);
91 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
92 return $this->dom_util->path($this->dom_doc,
$path);
95 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
96 return $this->dom_util->path($this->dom_doc,
$path);
104 if ($a_pc_id !=
"") {
105 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
106 return $this->dom_util->path($this->dom_doc,
$path);
109 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
110 return $this->dom_util->path($this->dom_doc,
$path);
115 $this->pcid = $a_pcid;
128 if (is_object($this->item_node)) {
141 $nodes = $this->dom_util->path($this->dom_doc,
$path);
142 if (count($nodes) > 0) {
143 $obj_node = $nodes->item(0);
144 $item_node = $this->dom_doc->createElement(
"MediaAliasItem");
145 $item_node = $obj_node->appendChild($item_node);
146 $item_node->setAttribute(
"Purpose", $this->purpose);
153 $this->dom_util->setFirstOptionalElement(
156 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
158 array(
"Width" => $a_width),
172 if (is_object($layout_node)) {
173 return $layout_node->getAttribute(
"Width");
190 if (is_object($layout_node)) {
191 return $layout_node->hasAttribute(
"Width");
207 if (is_object($layout_node)) {
208 if ($layout_node->hasAttribute(
"Width")) {
209 $layout_node->removeAttribute(
"Width");
211 if ($layout_node->hasAttribute(
"Height")) {
212 $layout_node->removeAttribute(
"Height");
219 $this->dom_util->setFirstOptionalElement(
222 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
224 array(
"Height" => $a_height),
238 if (is_object($layout_node)) {
239 return $layout_node->getAttribute(
"Height");
246 $this->dom_util->setFirstOptionalElement(
249 array(
"TextRepresentation",
"Parameter",
"MapArea"),
251 array(
"Align" =>
"bottom")
263 if (is_object($caption_node)) {
264 return $this->dom_util->getContent($caption_node);
281 if (is_object($caption_node)) {
298 if (is_object($caption_node)) {
299 $caption_node->parentNode->removeChild($caption_node);
304 string $a_text_representation
306 $this->dom_util->setFirstOptionalElement(
308 "TextRepresentation",
309 array(
"Parameter",
"MapArea"),
310 $a_text_representation,
321 "/TextRepresentation" 323 if (is_object($text_representation_node)) {
324 return $this->dom_util->getContent($text_representation_node);
339 "/TextRepresentation" 341 if (is_object($text_representation_node)) {
356 "/TextRepresentation" 358 if (is_object($text_representation_node)) {
359 $text_representation_node->parentNode->removeChild($text_representation_node);
365 $this->dom_util->setFirstOptionalElement(
368 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
370 array(
"HorizontalAlign" => $a_halign),
384 if (is_object($layout_node)) {
385 return $layout_node->getAttribute(
"HorizontalAlign");
397 for ($i = 0; $i < count($par_nodes); $i++) {
398 $par_node = $par_nodes[$i];
399 $par_node->unlink_node($par_node);
402 if (is_array($a_par_array)) {
403 foreach ($a_par_array as $par => $val) {
405 $attributes = array(
"Name" => $par,
"Value" => $val);
406 $this->dom_util->addElementToList(
429 foreach ($par_nodes as $par_node) {
430 $par_arr[] = $par_node->getAttribute(
"Name") .
"=\"" . $par_node->getAttribute(
"Value") .
"\"";
432 return implode(
", ", $par_arr);
446 for ($i = 0; $i < count($par_nodes); $i++) {
447 $par_node = $par_nodes[$i];
448 $par_arr[$par_node->getAttribute(
"Name")] =
449 $par_node->getAttribute(
"Value");
465 if (count($par_nodes) > 0) {
481 foreach ($par_nodes as $par_node) {
482 $par_node->parentNode->removeChild($par_node);
497 $maparea_arr = array();
499 foreach ($ma_nodes as $maparea_node) {
500 $childs = $maparea_node->childNodes;
502 $first = $childs->item(0);
503 if ($first->nodeName ==
"ExtLink") {
504 $link = array(
"LinkType" =>
"ExtLink",
505 "Href" => $first->getAttribute(
"Href"),
506 "Title" => $this->dom_util->getContent($first));
508 if ($first->nodeName ==
"IntLink") {
509 $link = array(
"LinkType" =>
"IntLink",
510 "Target" => $first->getAttribute(
"Target"),
511 "Type" => $first->getAttribute(
"Type"),
512 "TargetFrame" => $first->getAttribute(
"TargetFame"),
513 "Title" => $this->dom_util->getContent($first));
515 $maparea_arr[] = array(
517 "Shape" => $maparea_node->getAttribute(
"Shape"),
518 "Coords" => $maparea_node->getAttribute(
"Coords"),
519 "HighlightMode" => $maparea_node->getAttribute(
"HighlightMode"),
520 "HighlightClass" => $maparea_node->getAttribute(
"HighlightClass"),
521 "Id" => $maparea_node->getAttribute(
"Id"),
538 if (is_object($ma_nodes[$a_nr - 1])) {
539 $childs = $ma_nodes[$a_nr - 1]->childNodes;
540 if (is_object($childs[0]) &&
541 ($childs[0]->nodeName ==
"IntLink" || $childs[0]->nodeName ==
"ExtLink")) {
542 $childs[0]->nodeValue = $a_title;
554 string $a_target_frame
561 if (is_object($ma_nodes[$a_nr - 1])) {
563 $this->dom_util->deleteAllChildsByName($ma_nodes[$a_nr - 1], array(
"IntLink",
"ExtLink"));
564 $attributes = array(
"Type" => $a_type,
"Target" => $a_target,
565 "TargetFrame" => $a_target_frame);
566 $this->dom_util->setFirstOptionalElement(
567 $ma_nodes[$a_nr - 1],
588 if (is_object($ma_nodes[$a_nr - 1])) {
590 $this->dom_util->deleteAllChildsByName($ma_nodes[$a_nr - 1]->myDOMNode, array(
"IntLink",
"ExtLink"));
591 $attributes = array(
"Href" => $a_href);
592 $this->dom_util->setFirstOptionalElement(
593 $ma_nodes[$a_nr - 1]->myDOMNode,
607 string $a_shape_type,
615 if (is_object($ma_nodes[$a_nr - 1])) {
616 $ma_nodes[$a_nr - 1]->setAttribute(
"Shape", $a_shape_type);
617 $ma_nodes[$a_nr - 1]->setAttribute(
"Coords", $a_coords);
633 if (is_object($ma_nodes[$a_nr - 1])) {
634 $ma_nodes[$a_nr - 1]->setAttribute(
"HighlightMode", $a_mode);
650 if (is_object($ma_nodes[$a_nr - 1])) {
651 $ma_nodes[$a_nr - 1]->setAttribute(
"HighlightClass", $a_class);
659 string $a_shape_type,
664 string $hl_mode =
"",
665 string $hl_class =
"",
667 $attributes = array(
"Shape" => $a_shape_type,
668 "Coords" => $a_coords,
"Id" => $a_id,
669 "HighlightMode" => $hl_mode,
"HighlightClass" => $hl_class);
671 $ma_node = $this->dom_util->addElementToList(
679 if ($a_link[
"LinkType"] ==
"int" || $a_link[
"LinkType"] ==
"IntLink") {
680 $attributes = array(
"Type" => $a_link[
"Type"],
681 "TargetFrame" => $a_link[
"TargetFrame"],
682 "Target" => $a_link[
"Target"]);
683 $this->dom_util->setFirstOptionalElement(
691 if ($a_link[
"LinkType"] ==
"ext" || $a_link[
"LinkType"] ==
"ExtLink") {
692 $attributes = array(
"Href" => $a_link[
"Href"]);
693 $this->dom_util->setFirstOptionalElement(
714 if (is_object($ma_nodes->item($a_nr - 1))) {
715 $node = $ma_nodes->item($a_nr - 1);
716 $node->parentNode->removeChild($node);
731 foreach ($ma_nodes as $node) {
732 if ($node->getAttribute(
"Id") == $a_id) {
733 $node->parentNode->removeChild($node);
743 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='" . $this->purpose .
"']/MapArea";
744 $nodes = $this->dom_util->path($this->dom_doc,
$path);
745 foreach ($nodes as $node) {
746 $node->parentNode->removeChild($node);
760 if (is_object($ma_nodes->item($a_nr - 1))) {
761 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
762 if ($childs->item(0)->nodeName ==
"IntLink") {
765 if ($childs->item(0)->nodeName ==
"ExtLink") {
782 if (is_object($ma_nodes->item($a_nr - 1))) {
783 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
784 return $childs->item(0)->getAttribute(
"Type");
799 if (is_object($ma_nodes->item($a_nr - 1))) {
800 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
801 return $childs->item(0)->getAttribute(
"Target");
816 if (is_object($ma_nodes->item($a_nr - 1))) {
817 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
818 return $childs->item(0)->getAttribute(
"TargetFrame");
833 if (is_object($ma_nodes->item($a_nr - 1))) {
834 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
835 return $childs->item(0)->getAttribute(
"Href");
850 if (is_object($ma_nodes->item($a_nr - 1))) {
851 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
852 return $this->dom_util->getContent($childs->item(0));
860 public function delete():
void 862 if (is_object($this->item_node)) {
863 $this->item_node->parentNode->removeChild($this->item_node);
876 bool $a_output_new_area,
887 if ($width == 0 && $height == 0) {
893 if ($size[0] > 0 && $width > 0) {
894 $x_ratio = $width / $size[0];
897 if ($size[1] > 0 && $height > 0) {
898 $y_ratio = $height / $size[1];
903 for ($i = 0; $i < count($areas); $i++) {
904 if (((($i + 1) == $a_area_nr) && !$a_exclude) ||
905 ((($i + 1) != $a_area_nr) && $a_exclude) ||
909 $area->setShape($areas[$i][
"Shape"]);
910 $area->setCoords($areas[$i][
"Coords"]);
922 if ($a_output_new_area) {
924 $area->setShape($a_area_type);
925 $area->setCoords($a_coords);
952 $model = new \stdClass();
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null