4 include_once(
"./Services/Utilities/classes/class.ilDOMUtil.php");
33 $a_parent_node_name =
"MediaObject" 37 $this->lng = $DIC->language();
39 $this->parent_node_name = $a_parent_node_name;
40 $this->hier_id = $a_hier_id;
41 $this->purpose = $a_purpose;
50 public function getMAItemNode($a_hier_id, $a_purpose, $a_pc_id =
"", $a_sub_element =
"")
54 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
56 if (count(
$res->nodeset) == 1) {
57 return $res->nodeset[0];
62 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
64 if (count(
$res->nodeset) > 0) {
65 return $res->nodeset[0];
73 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
75 if (count(
$res->nodeset) > 0) {
82 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
84 if (count(
$res->nodeset) > 0) {
93 $path =
"//PageContent[@PCID = '" . $a_pc_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
95 if (count(
$res->nodeset) > 0) {
102 $path =
"//PageContent[@HierId = '" . $a_hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
104 if (count(
$res->nodeset) > 0) {
105 return $res->nodeset;
117 $this->pcid = $a_pcid;
137 if (is_object($this->item_node)) {
150 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/" . $this->parent_node_name;
152 if (count(
$res->nodeset) > 0) {
153 $obj_node =
$res->nodeset[0];
154 $item_node = $this->dom->create_element(
"MediaAliasItem");
156 $item_node->set_attribute(
"Purpose", $this->purpose);
170 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
172 array(
"Width" => $a_width),
189 if (is_object($layout_node)) {
190 return $layout_node->get_attribute(
"Width");
207 if (is_object($layout_node)) {
208 return $layout_node->has_attribute(
"Width");
224 if (is_object($layout_node)) {
225 if ($layout_node->has_attribute(
"Width")) {
226 $layout_node->remove_attribute(
"Width");
228 if ($layout_node->has_attribute(
"Height")) {
229 $layout_node->remove_attribute(
"Height");
243 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
245 array(
"Height" => $a_height),
262 if (is_object($layout_node)) {
263 return $layout_node->get_attribute(
"Height");
277 array(
"TextRepresentation",
"Parameter",
"MapArea"),
279 array(
"Align" =>
"bottom")
295 if (is_object($caption_node)) {
296 return $caption_node->get_content();
313 if (is_object($caption_node)) {
330 if (is_object($caption_node)) {
331 $caption_node->unlink_node($caption_node);
343 "TextRepresentation",
344 array(
"Parameter",
"MapArea"),
345 $a_text_representation,
359 "/TextRepresentation" 361 if (is_object($text_representation_node)) {
362 return $text_representation_node->get_content();
377 "/TextRepresentation" 379 if (is_object($text_representation_node)) {
394 "/TextRepresentation" 396 if (is_object($text_representation_node)) {
397 $text_representation_node->unlink_node($text_representation_node);
407 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
409 array(
"HorizontalAlign" => $a_halign),
423 if (is_object($layout_node)) {
424 return $layout_node->get_attribute(
"HorizontalAlign");
438 for (
$i = 0;
$i < count($par_nodes);
$i++) {
439 $par_node = $par_nodes[
$i];
440 $par_node->unlink_node($par_node);
443 include_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
444 if (is_array($a_par_array)) {
445 foreach ($a_par_array as $par => $val) {
447 $attributes = array(
"Name" => $par,
"Value" => $val);
472 for (
$i = 0;
$i < count($par_nodes);
$i++) {
473 $par_node = $par_nodes[
$i];
474 $par_arr[] = $par_node->get_attribute(
"Name") .
"=\"" . $par_node->get_attribute(
"Value") .
"\"";
476 return implode($par_arr,
", ");
490 for (
$i = 0;
$i < count($par_nodes);
$i++) {
491 $par_node = $par_nodes[
$i];
492 $par_arr[$par_node->get_attribute(
"Name")] =
493 $par_node->get_attribute(
"Value");
517 if (count($par_nodes) > 0) {
533 if (count($par_nodes) > 0) {
534 for (
$i = 0;
$i < count($par_nodes);
$i++) {
535 $par_node = $par_nodes[
$i];
536 $par_node->unlink_node($par_node);
552 $maparea_arr = array();
553 for (
$i = 0;
$i < count($ma_nodes);
$i++) {
554 $maparea_node = $ma_nodes[
$i];
555 $childs = $maparea_node->child_nodes();
557 if ($childs[0]->node_name() ==
"ExtLink") {
558 $link = array(
"LinkType" =>
"ExtLink",
559 "Href" => $childs[0]->get_attribute(
"Href"),
560 "Title" => $childs[0]->get_content());
562 if ($childs[0]->node_name() ==
"IntLink") {
563 $link = array(
"LinkType" =>
"IntLink",
564 "Target" => $childs[0]->get_attribute(
"Target"),
565 "Type" => $childs[0]->get_attribute(
"Type"),
566 "TargetFrame" => $childs[0]->get_attribute(
"TargetFame"),
567 "Title" => $childs[0]->get_content());
569 $maparea_arr[] = array(
571 "Shape" => $maparea_node->get_attribute(
"Shape"),
572 "Coords" => $maparea_node->get_attribute(
"Coords"),
573 "HighlightMode" => $maparea_node->get_attribute(
"HighlightMode"),
574 "HighlightClass" => $maparea_node->get_attribute(
"HighlightClass"),
575 "Id" => $maparea_node->get_attribute(
"Id"),
592 if (is_object($ma_nodes[$a_nr - 1])) {
593 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
594 if (is_object($childs[0]) &&
595 ($childs[0]->node_name() ==
"IntLink" || $childs[0]->node_name() ==
"ExtLink")) {
596 $childs[0]->set_content($a_title);
611 if (is_object($ma_nodes[$a_nr - 1])) {
615 "TargetFrame" => $a_target_frame);
618 $ma_nodes[$a_nr - 1],
637 if (is_object($ma_nodes[$a_nr - 1])) {
643 $ma_nodes[$a_nr - 1],
655 public function setShape($a_nr, $a_shape_type, $a_coords)
662 if (is_object($ma_nodes[$a_nr - 1])) {
663 $ma_nodes[$a_nr - 1]->set_attribute(
"Shape", $a_shape_type);
664 $ma_nodes[$a_nr - 1]->set_attribute(
"Coords", $a_coords);
678 if (is_object($ma_nodes[$a_nr - 1])) {
679 $ma_nodes[$a_nr - 1]->set_attribute(
"HighlightMode", $a_mode);
693 if (is_object($ma_nodes[$a_nr - 1])) {
694 $ma_nodes[$a_nr - 1]->set_attribute(
"HighlightClass", $a_class);
709 "Coords" => $a_coords,
"Id" => $a_id);
720 if ($a_link[
"LinkType"] ==
"int" || $a_link[
"LinkType"] ==
"IntLink") {
722 "TargetFrame" => $a_link[
"TargetFrame"],
723 "Target" => $a_link[
"Target"]);
733 if ($a_link[
"LinkType"] ==
"ext" || $a_link[
"LinkType"] ==
"ExtLink") {
757 if (is_object($ma_nodes[$a_nr - 1])) {
758 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
772 foreach ($ma_nodes as $node) {
773 if ($node->get_attribute(
"Id") == $a_id) {
774 $node->unlink_node($node);
785 $path =
"//PageContent[@HierId = '" . $this->hier_id .
"']/" . $this->parent_node_name .
"/MediaAliasItem[@Purpose='" . $this->purpose .
"']/MapArea";
787 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
802 if (is_object($ma_nodes[$a_nr - 1])) {
803 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
804 if ($childs[0]->node_name() ==
"IntLink") {
807 if ($childs[0]->node_name() ==
"ExtLink") {
823 if (is_object($ma_nodes[$a_nr - 1])) {
824 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
825 return $childs[0]->get_attribute(
"Type");
839 if (is_object($ma_nodes[$a_nr - 1])) {
840 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
841 return $childs[0]->get_attribute(
"Target");
855 if (is_object($ma_nodes[$a_nr - 1])) {
856 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
857 return $childs[0]->get_attribute(
"TargetFrame");
871 if (is_object($ma_nodes[$a_nr - 1])) {
872 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
873 return $childs[0]->get_attribute(
"Href");
887 if (is_object($ma_nodes[$a_nr - 1])) {
888 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
889 return $childs[0]->get_content();
896 public function delete()
898 if (is_object($this->item_node)) {
899 $this->item_node->unlink_node($this->item_node);
919 if (!$a_st_item->copyOriginal()) {
922 $a_st_item->buildMapWorkImage();
929 if ($width == 0 && $height == 0) {
930 $width = $a_st_item->getWidth();
931 $height = $a_st_item->getHeight();
933 $size = @getimagesize($a_st_item->getMapWorkCopyName());
935 if (
$size[0] > 0 && $width > 0) {
936 $x_ratio = $width /
$size[0];
939 if (
$size[1] > 0 && $height > 0) {
940 $y_ratio = $height /
$size[1];
945 for (
$i = 0;
$i < count($areas);
$i++) {
946 if ((((
$i + 1) == $a_area_nr) && !$a_exclude) ||
947 (((
$i + 1) != $a_area_nr) && $a_exclude) ||
951 $area->setShape($areas[
$i][
"Shape"]);
952 $area->setCoords($areas[$i][
"Coords"]);
954 $a_st_item->getMapWorkImage(),
964 if ($a_output_new_area) {
966 $area->setShape($a_area_type);
967 $area->setCoords($a_coords);
969 $a_st_item->getMapWorkImage(),
978 $a_st_item->saveMapWorkImage();
xpath_new_context($dom_document)
xpath_eval($xpath_context, $eval_str, $contextnode=null)
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names
foreach($_POST as $key=> $value) $res
if(array_key_exists('yes', $_REQUEST)) $attributes
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. ...
static setFirstOptionalElement( $doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes, $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...