ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMediaAliasItem Class Reference

Class ilMediaAliasItem. More...

+ Collaboration diagram for ilMediaAliasItem:

Public Member Functions

 ilMediaAliasItem (&$a_dom, $a_hier_id, $a_purpose, $a_pc_id="", $a_parent_node_name="MediaObject")
 
 getMAItemNode ($a_hier_id, $a_purpose, $a_pc_id="", $a_sub_element="")
 
 getParameterNodes ($a_hier_id, $a_purpose, $a_pc_id="")
 
 getMapAreaNodes ($a_hier_id, $a_purpose, $a_pc_id="")
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPcId ()
 Get PC Id. More...
 
 exists ()
 check if item node exists More...
 
 insert ()
 inserts new node in dom More...
 
 setWidth ($a_width)
 Set width. More...
 
 getWidth ()
 Get width. More...
 
 definesSize ()
 check if alias item defines own size or derives size from object More...
 
 deriveSize ()
 derive size from object (-> width and height attributes are removed from layout element) More...
 
 setHeight ($a_height)
 Set Height. More...
 
 getHeight ()
 Get Height. More...
 
 setCaption ($a_caption)
 Set Caption. More...
 
 getCaption ()
 Get Caption. More...
 
 definesCaption ()
 check if alias item defines own caption or derives caption from object More...
 
 deriveCaption ()
 derive caption from object (-> caption element is removed from media alias item) More...
 
 setTextRepresentation ($a_text_representation)
 Set TextRepresentation. More...
 
 getTextRepresentation ()
 Get TextRepresentation. More...
 
 definesTextRepresentation ()
 check if alias item defines own TextRepresentation or derives TextRepresentation from object More...
 
 deriveTextRepresentation ()
 derive TextRepresentation from object (-> TextRepresentation element is removed from media alias item) More...
 
 setHorizontalAlign ($a_halign)
 
 getHorizontalAlign ()
 
 setParameters ($a_par_array)
 set parameter More...
 
 getParameterString ()
 Get all parameters as string. More...
 
 getParameters ()
 Get all parameters as array. More...
 
 getParameter ($a_name)
 get a single parameter More...
 
 definesParameters ()
 check if alias item defines own parameters or derives parameters from object More...
 
 deriveParameters ()
 derive parameters from object (-> all parameter elements are removed from media alias item) More...
 
 getMapAreas ()
 Get all map areas. More...
 
 setAreaTitle ($a_nr, $a_title)
 Set title of area. More...
 
 setAreaIntLink ($a_nr, $a_type, $a_target, $a_target_frame)
 Set link of area to an internal one. More...
 
 setAreaExtLink ($a_nr, $a_href)
 Set link of area to an external one. More...
 
 setShape ($a_nr, $a_shape_type, $a_coords)
 Set shape and coords of single area. More...
 
 setAreaHighlightMode ($a_nr, $a_mode)
 Set highlight mode single area. More...
 
 setAreaHighlightClass ($a_nr, $a_class)
 Set highlight class single area. More...
 
 addMapArea ($a_shape_type, $a_coords, $a_title, $a_link, $a_id="")
 Add a new area to the map. More...
 
 deleteMapArea ($a_nr)
 Delete a sinlge map area. More...
 
 deleteMapAreaById ($a_id)
 Delete map areas by id. More...
 
 deleteAllMapAreas ()
 Delete all map areas. More...
 
 getLinkTypeOfArea ($a_nr)
 Get link type. More...
 
 getTypeOfArea ($a_nr)
 Get type (only interna link. More...
 
 getTargetOfArea ($a_nr)
 Get target (only interna link. More...
 
 getTargetFrameOfArea ($a_nr)
 Get target frame (only interna link. More...
 
 getHrefOfArea ($a_nr)
 Get href (only external link) More...
 
 getTitleOfArea ($a_nr)
 Get title. More...
 
 delete ()
 delete full item node from dom More...
 
 makeMapWorkCopy ($a_st_item, $a_area_nr=0, $a_exclude=false, $a_output_new_area, $a_area_type, $a_coords)
 make map work copy of image More...
 

Data Fields

 $dom
 
 $hier_id
 
 $purpose
 
 $item_node
 

Detailed Description

Class ilMediaAliasItem.

Media Alias Item, component of a media object (file or reference)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilMediaAliasItem.php.

Member Function Documentation

◆ addMapArea()

ilMediaAliasItem::addMapArea (   $a_shape_type,
  $a_coords,
  $a_title,
  $a_link,
  $a_id = "" 
)

Add a new area to the map.

Definition at line 605 of file class.ilMediaAliasItem.php.

607 {
608 $attributes = array("Shape" => $a_shape_type,
609 "Coords" => $a_coords, "Id" => $a_id);
610
611 $ma_node = ilDOMUtil::addElementToList($this->dom, $this->item_node,
612 "MapArea", array(), "", $attributes);
613
614 if ($a_link["LinkType"] == "int" || $a_link["LinkType"] == "IntLink")
615 {
616 $attributes = array("Type" => $a_link["Type"],
617 "TargetFrame" => $a_link["TargetFrame"],
618 "Target" => $a_link["Target"]);
619 ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "IntLink",
620 array(""), $a_title, $attributes);
621 }
622 if ($a_link["LinkType"] == "ext" || $a_link["LinkType"] == "ExtLink")
623 {
624 $attributes = array("Href" => $a_link["Href"]);
625 ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "ExtLink",
626 array(""), $a_title, $attributes);
627 }
628 }
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.
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,...

References ilDOMUtil\addElementToList(), and ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ definesCaption()

ilMediaAliasItem::definesCaption ( )

check if alias item defines own caption or derives caption from object

Returns
boolean returns true if caption is not derived from object

Definition at line 272 of file class.ilMediaAliasItem.php.

273 {
274 $caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
275 $this->getPcId(), "/Caption");
276 if (is_object($caption_node))
277 {
278 return true;
279 }
280 return false;
281 }
getMAItemNode($a_hier_id, $a_purpose, $a_pc_id="", $a_sub_element="")

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ definesParameters()

ilMediaAliasItem::definesParameters ( )

check if alias item defines own parameters or derives parameters from object

Returns
boolean returns true if parameters are not derived from object

Definition at line 440 of file class.ilMediaAliasItem.php.

441 {
442 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
443 $this->getPcId());
444 if (count($par_nodes) > 0)
445 {
446 return true;
447 }
448 return false;
449 }
getParameterNodes($a_hier_id, $a_purpose, $a_pc_id="")

References getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ definesSize()

ilMediaAliasItem::definesSize ( )

check if alias item defines own size or derives size from object

Returns
boolean returns true if size is not derived from object

Definition at line 187 of file class.ilMediaAliasItem.php.

188 {
189 $layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
190 $this->getPcId(), "/Layout");
191 if (is_object($layout_node))
192 {
193 return $layout_node->has_attribute("Width");
194 }
195 return false;
196 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ definesTextRepresentation()

ilMediaAliasItem::definesTextRepresentation ( )

check if alias item defines own TextRepresentation or derives TextRepresentation from object

Returns
boolean returns true if TextRepresentation is not derived from object

Definition at line 324 of file class.ilMediaAliasItem.php.

325 {
326 $text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
327 $this->getPcId(), "/TextRepresentation");
328 if (is_object($text_representation_node))
329 {
330 return true;
331 }
332 return false;
333 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ delete()

ilMediaAliasItem::delete ( )

delete full item node from dom

Definition at line 768 of file class.ilMediaAliasItem.php.

769 {
770 if (is_object($this->item_node))
771 {
772 $this->item_node->unlink_node($this->item_node);
773 }
774 }

◆ deleteAllMapAreas()

ilMediaAliasItem::deleteAllMapAreas ( )

Delete all map areas.

Definition at line 663 of file class.ilMediaAliasItem.php.

664 {
665 $xpc = xpath_new_context($this->dom);
666 $path = "//PageContent[@HierId = '".$this->hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='".$this->purpose."']/MapArea";
667 $res =& xpath_eval($xpc, $path);
668 for ($i = 0; $i < count($res->nodeset); $i++)
669 {
670 $res->nodeset[$i]->unlink_node($res->nodeset[$i]);
671 }
672 }
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
$path
Definition: index.php:22

References $path, $res, xpath_eval(), and xpath_new_context().

+ Here is the call graph for this function:

◆ deleteMapArea()

ilMediaAliasItem::deleteMapArea (   $a_nr)

Delete a sinlge map area.

Definition at line 633 of file class.ilMediaAliasItem.php.

634 {
635 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
636 $this->getPcId());
637
638 if (is_object($ma_nodes[$a_nr - 1]))
639 {
640 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
641 }
642 }
getMapAreaNodes($a_hier_id, $a_purpose, $a_pc_id="")

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ deleteMapAreaById()

ilMediaAliasItem::deleteMapAreaById (   $a_id)

Delete map areas by id.

Definition at line 647 of file class.ilMediaAliasItem.php.

648 {
649 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
650 $this->getPcId());
651 foreach ($ma_nodes as $node)
652 {
653 if ($node->get_attribute("Id") == $a_id)
654 {
655 $node->unlink_node($node);
656 }
657 }
658 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ deriveCaption()

ilMediaAliasItem::deriveCaption ( )

derive caption from object (-> caption element is removed from media alias item)

Definition at line 286 of file class.ilMediaAliasItem.php.

287 {
288 $caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
289 $this->getPcId(), "/Caption");
290 if (is_object($caption_node))
291 {
292 $caption_node->unlink_node($caption_node);
293 }
294 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ deriveParameters()

ilMediaAliasItem::deriveParameters ( )

derive parameters from object (-> all parameter elements are removed from media alias item)

Definition at line 454 of file class.ilMediaAliasItem.php.

455 {
456 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
457 $this->getPcId());
458 if (count($par_nodes) > 0)
459 {
460 for($i=0; $i < count($par_nodes); $i++)
461 {
462 $par_node =& $par_nodes[$i];
463 $par_node->unlink_node($par_node);
464 }
465 }
466 }

References getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ deriveSize()

ilMediaAliasItem::deriveSize ( )

derive size from object (-> width and height attributes are removed from layout element)

Definition at line 201 of file class.ilMediaAliasItem.php.

202 {
203 $layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
204 $this->getPcId(), "/Layout");
205 if (is_object($layout_node))
206 {
207 if ($layout_node->has_attribute("Width"))
208 {
209 $layout_node->remove_attribute("Width");
210 }
211 if ($layout_node->has_attribute("Height"))
212 {
213 $layout_node->remove_attribute("Height");
214 }
215 }
216 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ deriveTextRepresentation()

ilMediaAliasItem::deriveTextRepresentation ( )

derive TextRepresentation from object (-> TextRepresentation element is removed from media alias item)

Definition at line 338 of file class.ilMediaAliasItem.php.

339 {
340 $text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
341 $this->getPcId(), "/TextRepresentation");
342 if (is_object($text_representation_node))
343 {
344 $text_representation_node->unlink_node($text_representation_node);
345 }
346 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ exists()

ilMediaAliasItem::exists ( )

check if item node exists

Returns
boolean returns true if item node exists

Definition at line 128 of file class.ilMediaAliasItem.php.

129 {
130 if (is_object($this->item_node))
131 {
132 return true;
133 }
134 else
135 {
136 return false;
137 }
138 }

◆ getCaption()

ilMediaAliasItem::getCaption ( )

Get Caption.

Definition at line 257 of file class.ilMediaAliasItem.php.

258 {
259 $caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
260 $this->getPcId(), "/Caption");
261 if (is_object($caption_node))
262 {
263 return $caption_node->get_content();
264 }
265 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ getHeight()

ilMediaAliasItem::getHeight ( )

Get Height.

Definition at line 232 of file class.ilMediaAliasItem.php.

233 {
234 $layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
235 $this->getPcId(), "/Layout");
236 if (is_object($layout_node))
237 {
238 return $layout_node->get_attribute("Height");
239 }
240 }

References getMAItemNode(), and getPcId().

Referenced by makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHorizontalAlign()

ilMediaAliasItem::getHorizontalAlign ( )

Definition at line 356 of file class.ilMediaAliasItem.php.

357 {
358 $layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
359 $this->getPcId(), "/Layout");
360 if (is_object($layout_node))
361 {
362 return $layout_node->get_attribute("HorizontalAlign");
363 }
364 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ getHrefOfArea()

ilMediaAliasItem::getHrefOfArea (   $a_nr)

Get href (only external link)

Definition at line 740 of file class.ilMediaAliasItem.php.

741 {
742 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
743 $this->getPcId());
744 if (is_object($ma_nodes[$a_nr - 1]))
745 {
746 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
747 return $childs[0]->get_attribute("Href");
748 }
749 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getLinkTypeOfArea()

ilMediaAliasItem::getLinkTypeOfArea (   $a_nr)

Get link type.

Definition at line 677 of file class.ilMediaAliasItem.php.

678 {
679 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
680 $this->getPcId());
681 if (is_object($ma_nodes[$a_nr - 1]))
682 {
683 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
684 if ($childs[0]->node_name() == "IntLink")
685 {
686 return "int";
687 }
688 if ($childs[0]->node_name() == "ExtLink")
689 {
690 return "ext";
691 }
692 }
693 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getMAItemNode()

ilMediaAliasItem::getMAItemNode (   $a_hier_id,
  $a_purpose,
  $a_pc_id = "",
  $a_sub_element = "" 
)

Definition at line 35 of file class.ilMediaAliasItem.php.

36 {
37 if ($a_pc_id != "")
38 {
39 $xpc = xpath_new_context($this->dom);
40 $path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
41 $res =& xpath_eval($xpc, $path);
42 if (count($res->nodeset) == 1)
43 {
44 return $res->nodeset[0];
45 }
46 }
47
48 $xpc = xpath_new_context($this->dom);
49 $path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
50 $res =& xpath_eval($xpc, $path);
51 if (count($res->nodeset) > 0)
52 {
53 return $res->nodeset[0];
54 }
55 }

References $path, $res, xpath_eval(), and xpath_new_context().

Referenced by definesCaption(), definesSize(), definesTextRepresentation(), deriveCaption(), deriveSize(), deriveTextRepresentation(), getCaption(), getHeight(), getHorizontalAlign(), getTextRepresentation(), getWidth(), and ilMediaAliasItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapAreaNodes()

ilMediaAliasItem::getMapAreaNodes (   $a_hier_id,
  $a_purpose,
  $a_pc_id = "" 
)

Definition at line 80 of file class.ilMediaAliasItem.php.

81 {
82 if ($a_pc_id != "")
83 {
84 $xpc = xpath_new_context($this->dom);
85 $path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
86 $res =& xpath_eval($xpc, $path);
87 if (count($res->nodeset) > 0)
88 {
89 return $res->nodeset;
90 }
91 return array();
92 }
93
94 $xpc = xpath_new_context($this->dom);
95 $path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
96 $res =& xpath_eval($xpc, $path);
97 if (count($res->nodeset) > 0)
98 {
99 return $res->nodeset;
100 }
101 }

References $path, $res, xpath_eval(), and xpath_new_context().

Referenced by deleteMapArea(), deleteMapAreaById(), getHrefOfArea(), getLinkTypeOfArea(), getMapAreas(), getTargetFrameOfArea(), getTargetOfArea(), getTitleOfArea(), getTypeOfArea(), setAreaExtLink(), setAreaHighlightClass(), setAreaHighlightMode(), setAreaIntLink(), setAreaTitle(), and setShape().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapAreas()

ilMediaAliasItem::getMapAreas ( )

Get all map areas.

Definition at line 472 of file class.ilMediaAliasItem.php.

473 {
474 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
475 $this->getPcId());
476 $maparea_arr = array();
477 for($i=0; $i < count($ma_nodes); $i++)
478 {
479 $maparea_node = $ma_nodes[$i];
480 $childs = $maparea_node->child_nodes();
481 $link = array();
482 if ($childs[0]->node_name() == "ExtLink")
483 {
484 $link = array("LinkType" => "ExtLink",
485 "Href" => $childs[0]->get_attribute("Href"),
486 "Title" => $childs[0]->get_content());
487 }
488 if ($childs[0]->node_name() == "IntLink")
489 {
490 $link = array("LinkType" => "IntLink",
491 "Target" => $childs[0]->get_attribute("Target"),
492 "Type" => $childs[0]->get_attribute("Type"),
493 "TargetFrame" => $childs[0]->get_attribute("TargetFame"),
494 "Title" => $childs[0]->get_content());
495 }
496 $maparea_arr[] = array(
497 "Nr" => $i + 1,
498 "Shape" => $maparea_node->get_attribute("Shape"),
499 "Coords" => $maparea_node->get_attribute("Coords"),
500 "HighlightMode" => $maparea_node->get_attribute("HighlightMode"),
501 "HighlightClass" => $maparea_node->get_attribute("HighlightClass"),
502 "Id" => $maparea_node->get_attribute("Id"),
503 "Link" => $link);
504 }
505
506 return $maparea_arr;
507 }

References getMapAreaNodes(), and getPcId().

Referenced by makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParameter()

ilMediaAliasItem::getParameter (   $a_name)

get a single parameter

Definition at line 431 of file class.ilMediaAliasItem.php.

432 {
433 }

◆ getParameterNodes()

ilMediaAliasItem::getParameterNodes (   $a_hier_id,
  $a_purpose,
  $a_pc_id = "" 
)

Definition at line 57 of file class.ilMediaAliasItem.php.

58 {
59 if ($a_pc_id != "")
60 {
61 $xpc = xpath_new_context($this->dom);
62 $path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
63 $res =& xpath_eval($xpc, $path);
64 if (count($res->nodeset) > 0)
65 {
66 return $res->nodeset;
67 }
68 return array();
69 }
70
71 $xpc = xpath_new_context($this->dom);
72 $path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
73 $res =& xpath_eval($xpc, $path);
74 if (count($res->nodeset) > 0)
75 {
76 return $res->nodeset;
77 }
78 }

References $path, $res, xpath_eval(), and xpath_new_context().

Referenced by definesParameters(), deriveParameters(), getParameters(), getParameterString(), and setParameters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParameters()

ilMediaAliasItem::getParameters ( )

Get all parameters as array.

Definition at line 414 of file class.ilMediaAliasItem.php.

415 {
416 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
417 $this->getPcId());
418 $par_arr = array();
419 for($i=0; $i < count($par_nodes); $i++)
420 {
421 $par_node =& $par_nodes[$i];
422 $par_arr[$par_node->get_attribute("Name")] =
423 $par_node->get_attribute("Value");
424 }
425 return $par_arr;
426 }

References getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getParameterString()

ilMediaAliasItem::getParameterString ( )

Get all parameters as string.

Definition at line 398 of file class.ilMediaAliasItem.php.

399 {
400 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
401 $this->getPcId());
402 $par_arr = array();
403 for($i=0; $i < count($par_nodes); $i++)
404 {
405 $par_node =& $par_nodes[$i];
406 $par_arr[] = $par_node->get_attribute("Name")."=\"".$par_node->get_attribute("Value")."\"";
407 }
408 return implode($par_arr, ", ");
409 }

References getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getPcId()

◆ getTargetFrameOfArea()

ilMediaAliasItem::getTargetFrameOfArea (   $a_nr)

Get target frame (only interna link.

Definition at line 726 of file class.ilMediaAliasItem.php.

727 {
728 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
729 $this->getPcId());
730 if (is_object($ma_nodes[$a_nr - 1]))
731 {
732 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
733 return $childs[0]->get_attribute("TargetFrame");
734 }
735 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getTargetOfArea()

ilMediaAliasItem::getTargetOfArea (   $a_nr)

Get target (only interna link.

Definition at line 712 of file class.ilMediaAliasItem.php.

713 {
714 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
715 $this->getPcId());
716 if (is_object($ma_nodes[$a_nr - 1]))
717 {
718 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
719 return $childs[0]->get_attribute("Target");
720 }
721 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getTextRepresentation()

ilMediaAliasItem::getTextRepresentation ( )

Get TextRepresentation.

Definition at line 309 of file class.ilMediaAliasItem.php.

310 {
311 $text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
312 $this->getPcId(), "/TextRepresentation");
313 if (is_object($text_representation_node))
314 {
315 return $text_representation_node->get_content();
316 }
317 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ getTitleOfArea()

ilMediaAliasItem::getTitleOfArea (   $a_nr)

Get title.

Definition at line 754 of file class.ilMediaAliasItem.php.

755 {
756 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
757 $this->getPcId());
758 if (is_object($ma_nodes[$a_nr - 1]))
759 {
760 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
761 return $childs[0]->get_content();
762 }
763 }

References getMapAreaNodes(), and getPcId().

Referenced by setAreaExtLink(), and setAreaIntLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeOfArea()

ilMediaAliasItem::getTypeOfArea (   $a_nr)

Get type (only interna link.

Definition at line 698 of file class.ilMediaAliasItem.php.

699 {
700 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
701 $this->getPcId());
702 if (is_object($ma_nodes[$a_nr - 1]))
703 {
704 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
705 return $childs[0]->get_attribute("Type");
706 }
707 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getWidth()

ilMediaAliasItem::getWidth ( )

Get width.

Definition at line 172 of file class.ilMediaAliasItem.php.

173 {
174 $layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
175 $this->getPcId(), "/Layout");
176 if (is_object($layout_node))
177 {
178 return $layout_node->get_attribute("Width");
179 }
180 }

References getMAItemNode(), and getPcId().

Referenced by makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilMediaAliasItem()

ilMediaAliasItem::ilMediaAliasItem ( $a_dom,
  $a_hier_id,
  $a_purpose,
  $a_pc_id = "",
  $a_parent_node_name = "MediaObject" 
)

Definition at line 23 of file class.ilMediaAliasItem.php.

25 {
26 $this->dom =& $a_dom;
27 $this->parent_node_name = $a_parent_node_name;
28 $this->hier_id = $a_hier_id;
29 $this->purpose = $a_purpose;
30 $this->setPcId($a_pc_id);
31 $this->item_node = $this->getMAItemNode($this->hier_id, $this->purpose,
32 $this->getPcId());
33 }
setPcId($a_pcid)
Set PC Id.

References getMAItemNode(), getPcId(), and setPcId().

+ Here is the call graph for this function:

◆ insert()

ilMediaAliasItem::insert ( )

inserts new node in dom

Definition at line 143 of file class.ilMediaAliasItem.php.

144 {
145 $xpc = xpath_new_context($this->dom);
146 $path = "//PageContent[@HierId = '".$this->hier_id."']/".$this->parent_node_name;
147 $res =& xpath_eval($xpc, $path);
148 if (count($res->nodeset) > 0)
149 {
150 $obj_node =& $res->nodeset[0];
151 $item_node =& $this->dom->create_element("MediaAliasItem");
152 $item_node =& $obj_node->append_child($item_node);
153 $item_node->set_attribute("Purpose", $this->purpose);
154 $this->item_node =& $item_node;
155 }
156 }

References $item_node, $path, $res, xpath_eval(), and xpath_new_context().

+ Here is the call graph for this function:

◆ makeMapWorkCopy()

ilMediaAliasItem::makeMapWorkCopy (   $a_st_item,
  $a_area_nr = 0,
  $a_exclude = false,
  $a_output_new_area,
  $a_area_type,
  $a_coords 
)

make map work copy of image

Parameters
int$a_area_nrdraw area $a_area_nr only
boolean$a_excludetrue: draw all areas but area $a_area_nr

Definition at line 782 of file class.ilMediaAliasItem.php.

784 {
785 global $lng;
786
787 if (!$a_st_item->copyOriginal())
788 {
789 return false;
790 }
791 $a_st_item->buildMapWorkImage();
792
793 // determine ratios (first see whether the instance has w/h defined)
794 $width = $this->getWidth();
795 $height = $this->getHeight();
796
797 // if instance has no size, use object w/h
798 if ($width == 0 && $height == 0)
799 {
800 $width = $a_st_item->getWidth();
801 $height = $a_st_item->getHeight();
802 }
803 $size = @getimagesize($a_st_item->getMapWorkCopyName());
804 $x_ratio = 1;
805 if ($size[0] > 0 && $width > 0)
806 {
807 $x_ratio = $width / $size[0];
808 }
809 $y_ratio = 1;
810 if ($size[1] > 0 && $height > 0)
811 {
812 $y_ratio = $height / $size[1];
813 }
814
815 // draw map areas
816 $areas = $this->getMapAreas();
817 for ($i=0; $i < count($areas); $i++)
818 {
819 if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
820 ((($i+1) != $a_area_nr) && $a_exclude) ||
821 ($a_area_nr == 0)
822 )
823 {
824 $area = new ilMapArea();
825 $area->setShape($areas[$i]["Shape"]);
826 $area->setCoords($areas[$i]["Coords"]);
827 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2, true,
828 $x_ratio, $y_ratio);
829 }
830 }
831
832 if ($a_output_new_area)
833 {
834 $area = new ilMapArea();
835 $area->setShape($a_area_type);
836 $area->setCoords($a_coords);
837 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2, false,
838 $x_ratio, $y_ratio);
839 }
840
841 $a_st_item->saveMapWorkImage();
842
843 return true;
844 }
$size
Definition: RandomTest.php:79
Class ilMapArea.
getMapAreas()
Get all map areas.
global $lng
Definition: privfeed.php:40

References $lng, $size, getHeight(), getMapAreas(), and getWidth().

+ Here is the call graph for this function:

◆ setAreaExtLink()

ilMediaAliasItem::setAreaExtLink (   $a_nr,
  $a_href 
)

Set link of area to an external one.

Definition at line 548 of file class.ilMediaAliasItem.php.

549 {
550 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
551 $this->getPcId());
552 if (is_object($ma_nodes[$a_nr - 1]))
553 {
554 $title = $this->getTitleOfArea($a_nr);
555 ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
556 $attributes = array("Href" => $a_href);
557 ilDOMUtil::setFirstOptionalElement($this->dom, $ma_nodes[$a_nr - 1], "ExtLink",
558 array(""), $title, $attributes);
559 }
560 }
deleteAllChildsByName(&$a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names
getTitleOfArea($a_nr)
Get title.

References ilDOMUtil\deleteAllChildsByName(), getMapAreaNodes(), getPcId(), getTitleOfArea(), and ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setAreaHighlightClass()

ilMediaAliasItem::setAreaHighlightClass (   $a_nr,
  $a_class 
)

Set highlight class single area.

Definition at line 592 of file class.ilMediaAliasItem.php.

593 {
594 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
595 $this->getPcId());
596 if (is_object($ma_nodes[$a_nr - 1]))
597 {
598 $ma_nodes[$a_nr - 1]->set_attribute("HighlightClass", $a_class);
599 }
600 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setAreaHighlightMode()

ilMediaAliasItem::setAreaHighlightMode (   $a_nr,
  $a_mode 
)

Set highlight mode single area.

Definition at line 579 of file class.ilMediaAliasItem.php.

580 {
581 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
582 $this->getPcId());
583 if (is_object($ma_nodes[$a_nr - 1]))
584 {
585 $ma_nodes[$a_nr - 1]->set_attribute("HighlightMode", $a_mode);
586 }
587 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setAreaIntLink()

ilMediaAliasItem::setAreaIntLink (   $a_nr,
  $a_type,
  $a_target,
  $a_target_frame 
)

Set link of area to an internal one.

Definition at line 530 of file class.ilMediaAliasItem.php.

531 {
532 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
533 $this->getPcId());
534 if (is_object($ma_nodes[$a_nr - 1]))
535 {
536 $title = $this->getTitleOfArea($a_nr);
537 ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
538 $attributes = array("Type" => $a_type, "Target" => $a_target,
539 "TargetFrame" => $a_target_frame);
540 ilDOMUtil::setFirstOptionalElement($this->dom, $ma_nodes[$a_nr - 1], "IntLink",
541 array(""), $title, $attributes);
542 }
543 }

References ilDOMUtil\deleteAllChildsByName(), getMapAreaNodes(), getPcId(), getTitleOfArea(), and ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setAreaTitle()

ilMediaAliasItem::setAreaTitle (   $a_nr,
  $a_title 
)

Set title of area.

Definition at line 512 of file class.ilMediaAliasItem.php.

513 {
514 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
515 $this->getPcId());
516 if (is_object($ma_nodes[$a_nr - 1]))
517 {
518 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
519 if (is_object($childs[0]) &&
520 ($childs[0]->node_name() == "IntLink" || $childs[0]->node_name() == "ExtLink"))
521 {
522 $childs[0]->set_content($a_title);
523 }
524 }
525 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setCaption()

ilMediaAliasItem::setCaption (   $a_caption)

Set Caption.

Definition at line 246 of file class.ilMediaAliasItem.php.

247 {
248 ilDOMUtil::setFirstOptionalElement($this->dom, $this->item_node, "Caption",
249 array("TextRepresentation", "Parameter", "MapArea"),
250 $a_caption, array("Align" => "bottom"));
251 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setHeight()

ilMediaAliasItem::setHeight (   $a_height)

Set Height.

Definition at line 221 of file class.ilMediaAliasItem.php.

222 {
223 ilDOMUtil::setFirstOptionalElement($this->dom, $this->item_node, "Layout",
224 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
225 "", array("Height" => $a_height), false);
226 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setHorizontalAlign()

ilMediaAliasItem::setHorizontalAlign (   $a_halign)

Definition at line 348 of file class.ilMediaAliasItem.php.

349 {
350 ilDOMUtil::setFirstOptionalElement($this->dom, $this->item_node, "Layout",
351 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
352 "", array("HorizontalAlign" => $a_halign), false);
353 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setParameters()

ilMediaAliasItem::setParameters (   $a_par_array)

set parameter

Definition at line 369 of file class.ilMediaAliasItem.php.

370 {
371 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
372 $this->getPcId());
373 $par_arr = array();
374 for($i=0; $i < count($par_nodes); $i++)
375 {
376 $par_node =& $par_nodes[$i];
377 $par_node->unlink_node($par_node);
378 }
379
380 include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
381 if (is_array($a_par_array))
382 {
383 foreach($a_par_array as $par => $val)
384 {
385 if (ilMediaItem::checkParameter($par, $val))
386 {
387 $attributes = array("Name" => $par, "Value" => $val);
388 ilDOMUtil::addElementToList($this->dom, $this->item_node,
389 "Parameter", array("MapArea"), "", $attributes);
390 }
391 }
392 }
393 }
static checkParameter($a_par, $a_val)
Check parameter (filter javascript related and other unsafe parameters/values)

References ilDOMUtil\addElementToList(), ilMediaItem\checkParameter(), getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setPcId()

ilMediaAliasItem::setPcId (   $a_pcid)

Set PC Id.

Parameters
string$a_pcidPC Id

Definition at line 108 of file class.ilMediaAliasItem.php.

109 {
110 $this->pcid = $a_pcid;
111 }

Referenced by ilMediaAliasItem().

+ Here is the caller graph for this function:

◆ setShape()

ilMediaAliasItem::setShape (   $a_nr,
  $a_shape_type,
  $a_coords 
)

Set shape and coords of single area.

Definition at line 565 of file class.ilMediaAliasItem.php.

566 {
567 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
568 $this->getPcId());
569 if (is_object($ma_nodes[$a_nr - 1]))
570 {
571 $ma_nodes[$a_nr - 1]->set_attribute("Shape", $a_shape_type);
572 $ma_nodes[$a_nr - 1]->set_attribute("Coords", $a_coords);
573 }
574 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setTextRepresentation()

ilMediaAliasItem::setTextRepresentation (   $a_text_representation)

Set TextRepresentation.

Definition at line 299 of file class.ilMediaAliasItem.php.

300 {
301 ilDOMUtil::setFirstOptionalElement($this->dom, $this->item_node, "TextRepresentation",
302 array("Parameter", "MapArea"),
303 $a_text_representation, array());
304 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setWidth()

ilMediaAliasItem::setWidth (   $a_width)

Set width.

Definition at line 161 of file class.ilMediaAliasItem.php.

162 {
163 ilDOMUtil::setFirstOptionalElement($this->dom, $this->item_node, "Layout",
164 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
165 "", array("Width" => $a_width), false);
166 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

Field Documentation

◆ $dom

ilMediaAliasItem::$dom

Definition at line 18 of file class.ilMediaAliasItem.php.

◆ $hier_id

ilMediaAliasItem::$hier_id

Definition at line 19 of file class.ilMediaAliasItem.php.

◆ $item_node

ilMediaAliasItem::$item_node

Definition at line 21 of file class.ilMediaAliasItem.php.

Referenced by insert().

◆ $purpose

ilMediaAliasItem::$purpose

Definition at line 20 of file class.ilMediaAliasItem.php.


The documentation for this class was generated from the following file: