ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMediaAliasItem Class Reference

Class ilMediaAliasItem. More...

+ Collaboration diagram for ilMediaAliasItem:

Public Member Functions

 __construct (&$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.

Constructor & Destructor Documentation

◆ __construct()

ilMediaAliasItem::__construct ( $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.
getMAItemNode($a_hier_id, $a_purpose, $a_pc_id="", $a_sub_element="")

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

+ Here is the call graph for this function:

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 604 of file class.ilMediaAliasItem.php.

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

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 }

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 439 of file class.ilMediaAliasItem.php.

440 {
441 $par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
442 $this->getPcId());
443 if (count($par_nodes) > 0)
444 {
445 return true;
446 }
447 return false;
448 }
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 767 of file class.ilMediaAliasItem.php.

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

◆ deleteAllMapAreas()

ilMediaAliasItem::deleteAllMapAreas ( )

Delete all map areas.

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

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

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 632 of file class.ilMediaAliasItem.php.

633 {
634 $ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
635 $this->getPcId());
636
637 if (is_object($ma_nodes[$a_nr - 1]))
638 {
639 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
640 }
641 }
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 646 of file class.ilMediaAliasItem.php.

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

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 453 of file class.ilMediaAliasItem.php.

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

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 739 of file class.ilMediaAliasItem.php.

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

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getLinkTypeOfArea()

ilMediaAliasItem::getLinkTypeOfArea (   $a_nr)

Get link type.

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

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

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 __construct(), definesCaption(), definesSize(), definesTextRepresentation(), deriveCaption(), deriveSize(), deriveTextRepresentation(), getCaption(), getHeight(), getHorizontalAlign(), getTextRepresentation(), and getWidth().

+ 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 471 of file class.ilMediaAliasItem.php.

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

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 430 of file class.ilMediaAliasItem.php.

431 {
432 }

◆ 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 413 of file class.ilMediaAliasItem.php.

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

References getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getParameterString()

ilMediaAliasItem::getParameterString ( )

Get all parameters as string.

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

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

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 725 of file class.ilMediaAliasItem.php.

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

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 711 of file class.ilMediaAliasItem.php.

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

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 753 of file class.ilMediaAliasItem.php.

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

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 697 of file class.ilMediaAliasItem.php.

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

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:

◆ 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 781 of file class.ilMediaAliasItem.php.

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

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 547 of file class.ilMediaAliasItem.php.

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

References $title, 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 591 of file class.ilMediaAliasItem.php.

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

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 578 of file class.ilMediaAliasItem.php.

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

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 529 of file class.ilMediaAliasItem.php.

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

References $a_type, $title, 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 511 of file class.ilMediaAliasItem.php.

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

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 for($i=0; $i < count($par_nodes); $i++)
374 {
375 $par_node = $par_nodes[$i];
376 $par_node->unlink_node($par_node);
377 }
378
379 include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
380 if (is_array($a_par_array))
381 {
382 foreach($a_par_array as $par => $val)
383 {
384 if (ilMediaItem::checkParameter($par, $val))
385 {
386 $attributes = array("Name" => $par, "Value" => $val);
387 ilDOMUtil::addElementToList($this->dom, $this->item_node,
388 "Parameter", array("MapArea"), "", $attributes);
389 }
390 }
391 }
392 }
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 __construct().

+ 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 564 of file class.ilMediaAliasItem.php.

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

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: