39 string $a_parent_node_name =
"MediaObject"
43 $this->
lng = $DIC->language();
45 $this->parent_node_name = $a_parent_node_name;
46 $this->hier_id = $a_hier_id;
47 $this->purpose = $a_purpose;
60 string $a_sub_element =
""
64 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
66 if (count(
$res->nodeset) == 1) {
67 return $res->nodeset[0];
72 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
74 if (count(
$res->nodeset) > 0) {
75 return $res->nodeset[0];
87 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
89 if (count(
$res->nodeset) > 0) {
95 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
97 if (count(
$res->nodeset) > 0) {
109 if ($a_pc_id !=
"") {
110 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
112 if (count(
$res->nodeset) > 0) {
113 return $res->nodeset;
118 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
120 if (count(
$res->nodeset) > 0) {
121 return $res->nodeset;
128 $this->pcid = $a_pcid;
141 if (is_object($this->item_node)) {
154 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/" . $this->parent_node_name;
156 if (count(
$res->nodeset) > 0) {
157 $obj_node =
$res->nodeset[0];
158 $item_node = $this->dom->create_element(
"MediaAliasItem");
161 $this->item_node = $item_node;
171 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
173 array(
"Width" => $a_width),
181 $layout_node = $this->getMAItemNode(
187 if (is_object($layout_node)) {
188 return $layout_node->get_attribute(
"Width");
199 $layout_node = $this->getMAItemNode(
205 if (is_object($layout_node)) {
206 return $layout_node->has_attribute(
"Width");
216 $layout_node = $this->getMAItemNode(
222 if (is_object($layout_node)) {
223 if ($layout_node->has_attribute(
"Width")) {
224 $layout_node->remove_attribute(
"Width");
226 if ($layout_node->has_attribute(
"Height")) {
227 $layout_node->remove_attribute(
"Height");
238 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
240 array(
"Height" => $a_height),
248 $layout_node = $this->getMAItemNode(
254 if (is_object($layout_node)) {
255 return $layout_node->get_attribute(
"Height");
266 array(
"TextRepresentation",
"Parameter",
"MapArea"),
268 array(
"Align" =>
"bottom")
274 $caption_node = $this->getMAItemNode(
280 if (is_object($caption_node)) {
281 return $caption_node->get_content();
292 $caption_node = $this->getMAItemNode(
298 if (is_object($caption_node)) {
309 $caption_node = $this->getMAItemNode(
315 if (is_object($caption_node)) {
316 $caption_node->unlink_node($caption_node);
321 string $a_text_representation
326 "TextRepresentation",
327 array(
"Parameter",
"MapArea"),
328 $a_text_representation,
335 $text_representation_node = $this->getMAItemNode(
339 "/TextRepresentation"
341 if (is_object($text_representation_node)) {
342 return $text_representation_node->get_content();
353 $text_representation_node = $this->getMAItemNode(
357 "/TextRepresentation"
359 if (is_object($text_representation_node)) {
370 $text_representation_node = $this->getMAItemNode(
374 "/TextRepresentation"
376 if (is_object($text_representation_node)) {
377 $text_representation_node->unlink_node($text_representation_node);
387 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
389 array(
"HorizontalAlign" => $a_halign),
397 $layout_node = $this->getMAItemNode(
403 if (is_object($layout_node)) {
404 return $layout_node->get_attribute(
"HorizontalAlign");
411 $par_nodes = $this->getParameterNodes(
416 for (
$i = 0;
$i < count($par_nodes);
$i++) {
417 $par_node = $par_nodes[
$i];
418 $par_node->unlink_node($par_node);
421 if (is_array($a_par_array)) {
422 foreach ($a_par_array as $par => $val) {
424 $attributes = array(
"Name" => $par,
"Value" => $val);
443 $par_nodes = $this->getParameterNodes(
449 for (
$i = 0;
$i < count($par_nodes);
$i++) {
450 $par_node = $par_nodes[
$i];
451 $par_arr[] = $par_node->get_attribute(
"Name") .
"=\"" . $par_node->get_attribute(
"Value") .
"\"";
453 return implode(
", ", $par_arr);
461 $par_nodes = $this->getParameterNodes(
467 for (
$i = 0;
$i < count($par_nodes);
$i++) {
468 $par_node = $par_nodes[
$i];
469 $par_arr[$par_node->get_attribute(
"Name")] =
470 $par_node->get_attribute(
"Value");
481 $par_nodes = $this->getParameterNodes(
486 if (count($par_nodes) > 0) {
497 $par_nodes = $this->getParameterNodes(
502 if (count($par_nodes) > 0) {
503 for (
$i = 0;
$i < count($par_nodes);
$i++) {
504 $par_node = $par_nodes[
$i];
505 $par_node->unlink_node($par_node);
516 $ma_nodes = $this->getMapAreaNodes(
521 $maparea_arr = array();
522 for (
$i = 0;
$i < count($ma_nodes);
$i++) {
523 $maparea_node = $ma_nodes[
$i];
524 $childs = $maparea_node->child_nodes();
526 if ($childs[0]->node_name() ==
"ExtLink") {
527 $link = array(
"LinkType" =>
"ExtLink",
528 "Href" => $childs[0]->get_attribute(
"Href"),
529 "Title" => $childs[0]->get_content());
531 if ($childs[0]->node_name() ==
"IntLink") {
532 $link = array(
"LinkType" =>
"IntLink",
533 "Target" => $childs[0]->get_attribute(
"Target"),
534 "Type" => $childs[0]->get_attribute(
"Type"),
535 "TargetFrame" => $childs[0]->get_attribute(
"TargetFame"),
536 "Title" => $childs[0]->get_content());
538 $maparea_arr[] = array(
540 "Shape" => $maparea_node->get_attribute(
"Shape"),
541 "Coords" => $maparea_node->get_attribute(
"Coords"),
542 "HighlightMode" => $maparea_node->get_attribute(
"HighlightMode"),
543 "HighlightClass" => $maparea_node->get_attribute(
"HighlightClass"),
544 "Id" => $maparea_node->get_attribute(
"Id"),
555 $ma_nodes = $this->getMapAreaNodes(
560 if (is_object($ma_nodes[$a_nr - 1])) {
561 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
562 if (is_object($childs[0]) &&
563 ($childs[0]->node_name() ==
"IntLink" || $childs[0]->node_name() ==
"ExtLink")) {
564 $childs[0]->set_content($a_title);
576 string $a_target_frame
578 $ma_nodes = $this->getMapAreaNodes(
583 if (is_object($ma_nodes[$a_nr - 1])) {
584 $title = $this->getTitleOfArea($a_nr);
586 $attributes = array(
"Type" => $a_type,
"Target" => $a_target,
587 "TargetFrame" => $a_target_frame);
590 $ma_nodes[$a_nr - 1],
606 $ma_nodes = $this->getMapAreaNodes(
611 if (is_object($ma_nodes[$a_nr - 1])) {
612 $title = $this->getTitleOfArea($a_nr);
617 $ma_nodes[$a_nr - 1],
631 string $a_shape_type,
634 $ma_nodes = $this->getMapAreaNodes(
639 if (is_object($ma_nodes[$a_nr - 1])) {
640 $ma_nodes[$a_nr - 1]->set_attribute(
"Shape", $a_shape_type);
641 $ma_nodes[$a_nr - 1]->set_attribute(
"Coords", $a_coords);
652 $ma_nodes = $this->getMapAreaNodes(
657 if (is_object($ma_nodes[$a_nr - 1])) {
658 $ma_nodes[$a_nr - 1]->set_attribute(
"HighlightMode", $a_mode);
669 $ma_nodes = $this->getMapAreaNodes(
674 if (is_object($ma_nodes[$a_nr - 1])) {
675 $ma_nodes[$a_nr - 1]->set_attribute(
"HighlightClass", $a_class);
683 string $a_shape_type,
690 "Coords" => $a_coords,
"Id" => $a_id);
701 if ($a_link[
"LinkType"] ==
"int" || $a_link[
"LinkType"] ==
"IntLink") {
703 "TargetFrame" => $a_link[
"TargetFrame"],
704 "Target" => $a_link[
"Target"]);
714 if ($a_link[
"LinkType"] ==
"ext" || $a_link[
"LinkType"] ==
"ExtLink") {
732 $ma_nodes = $this->getMapAreaNodes(
738 if (is_object($ma_nodes[$a_nr - 1])) {
739 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
749 $ma_nodes = $this->getMapAreaNodes(
754 foreach ($ma_nodes as $node) {
755 if ($node->get_attribute(
"Id") == $a_id) {
756 $node->unlink_node($node);
767 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='" . $this->purpose .
"']/MapArea";
769 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
779 $ma_nodes = $this->getMapAreaNodes(
784 if (is_object($ma_nodes[$a_nr - 1])) {
785 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
786 if ($childs[0]->node_name() ==
"IntLink") {
789 if ($childs[0]->node_name() ==
"ExtLink") {
801 $ma_nodes = $this->getMapAreaNodes(
806 if (is_object($ma_nodes[$a_nr - 1])) {
807 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
808 return $childs[0]->get_attribute(
"Type");
818 $ma_nodes = $this->getMapAreaNodes(
823 if (is_object($ma_nodes[$a_nr - 1])) {
824 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
825 return $childs[0]->get_attribute(
"Target");
835 $ma_nodes = $this->getMapAreaNodes(
840 if (is_object($ma_nodes[$a_nr - 1])) {
841 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
842 return $childs[0]->get_attribute(
"TargetFrame");
852 $ma_nodes = $this->getMapAreaNodes(
857 if (is_object($ma_nodes[$a_nr - 1])) {
858 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
859 return $childs[0]->get_attribute(
"Href");
869 $ma_nodes = $this->getMapAreaNodes(
874 if (is_object($ma_nodes[$a_nr - 1])) {
875 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
876 return $childs[0]->get_content();
884 public function delete():
void
886 if (is_object($this->item_node)) {
887 $this->item_node->unlink_node($this->item_node);
900 bool $a_output_new_area,
904 $a_st_item->copyOriginal();
908 $width = $this->getWidth();
909 $height = $this->getHeight();
912 if ($width == 0 && $height == 0) {
918 if ($size[0] > 0 && $width > 0) {
919 $x_ratio = $width / $size[0];
922 if ($size[1] > 0 && $height > 0) {
923 $y_ratio = $height / $size[1];
927 $areas = $this->getMapAreas();
928 for (
$i = 0;
$i < count($areas);
$i++) {
929 if ((((
$i + 1) == $a_area_nr) && !$a_exclude) ||
930 (((
$i + 1) != $a_area_nr) && $a_exclude) ||
934 $area->setShape($areas[
$i][
"Shape"]);
935 $area->setCoords($areas[
$i][
"Coords"]);
947 if ($a_output_new_area) {
949 $area->setShape($a_area_type);
950 $area->setCoords($a_coords);
970 return ($this->definesSize() ||
971 $this->definesCaption() ||
972 $this->definesTextRepresentation() ||
973 $this->definesParameters());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
static deleteAllChildsByName(php4DOMElement $a_parent, array $a_node_names)
delete all childs of a node by names in $a_node_names
static setFirstOptionalElement(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes, bool $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found,...
set_attribute($name, $value)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xpath_new_context($dom_document)
xpath_eval(php4DOMXPath $xpath_context, string $eval_str, $contextnode=null)