ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 

Protected Attributes

 $lng
 

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

34 {
35 global $DIC;
36
37 $this->lng = $DIC->language();
38 $this->dom = $a_dom;
39 $this->parent_node_name = $a_parent_node_name;
40 $this->hier_id = $a_hier_id;
41 $this->purpose = $a_purpose;
42 $this->setPcId($a_pc_id);
43 $this->item_node = $this->getMAItemNode(
44 $this->hier_id,
45 $this->purpose,
46 $this->getPcId()
47 );
48 }
setPcId($a_pcid)
Set PC Id.
getMAItemNode($a_hier_id, $a_purpose, $a_pc_id="", $a_sub_element="")
global $DIC
Definition: saml.php:7

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

707 {
708 $attributes = array("Shape" => $a_shape_type,
709 "Coords" => $a_coords, "Id" => $a_id);
710
712 $this->dom,
713 $this->item_node,
714 "MapArea",
715 array(),
716 "",
718 );
719
720 if ($a_link["LinkType"] == "int" || $a_link["LinkType"] == "IntLink") {
721 $attributes = array("Type" => $a_link["Type"],
722 "TargetFrame" => $a_link["TargetFrame"],
723 "Target" => $a_link["Target"]);
725 $this->dom,
726 $ma_node,
727 "IntLink",
728 array(""),
729 $a_title,
731 );
732 }
733 if ($a_link["LinkType"] == "ext" || $a_link["LinkType"] == "ExtLink") {
734 $attributes = array("Href" => $a_link["Href"]);
736 $this->dom,
737 $ma_node,
738 "ExtLink",
739 array(""),
740 $a_title,
742 );
743 }
744 }
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,...
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.
$attributes

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

306 {
307 $caption_node = $this->getMAItemNode(
308 $this->hier_id,
309 $this->purpose,
310 $this->getPcId(),
311 "/Caption"
312 );
313 if (is_object($caption_node)) {
314 return true;
315 }
316 return false;
317 }

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

511 {
512 $par_nodes = $this->getParameterNodes(
513 $this->hier_id,
514 $this->purpose,
515 $this->getPcId()
516 );
517 if (count($par_nodes) > 0) {
518 return true;
519 }
520 return false;
521 }
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 199 of file class.ilMediaAliasItem.php.

200 {
201 $layout_node = $this->getMAItemNode(
202 $this->hier_id,
203 $this->purpose,
204 $this->getPcId(),
205 "/Layout"
206 );
207 if (is_object($layout_node)) {
208 return $layout_node->has_attribute("Width");
209 }
210 return false;
211 }

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

372 {
373 $text_representation_node = $this->getMAItemNode(
374 $this->hier_id,
375 $this->purpose,
376 $this->getPcId(),
377 "/TextRepresentation"
378 );
379 if (is_object($text_representation_node)) {
380 return true;
381 }
382 return false;
383 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ delete()

ilMediaAliasItem::delete ( )

delete full item node from dom

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

897 {
898 if (is_object($this->item_node)) {
899 $this->item_node->unlink_node($this->item_node);
900 }
901 }

◆ deleteAllMapAreas()

ilMediaAliasItem::deleteAllMapAreas ( )

Delete all map areas.

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

783 {
784 $xpc = xpath_new_context($this->dom);
785 $path = "//PageContent[@HierId = '" . $this->hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='" . $this->purpose . "']/MapArea";
786 $res = xpath_eval($xpc, $path);
787 for ($i = 0; $i < count($res->nodeset); $i++) {
788 $res->nodeset[$i]->unlink_node($res->nodeset[$i]);
789 }
790 }
$i
Definition: disco.tpl.php:19
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
foreach($_POST as $key=> $value) $res

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

750 {
751 $ma_nodes = $this->getMapAreaNodes(
752 $this->hier_id,
753 $this->purpose,
754 $this->getPcId()
755 );
756
757 if (is_object($ma_nodes[$a_nr - 1])) {
758 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
759 }
760 }
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 765 of file class.ilMediaAliasItem.php.

766 {
767 $ma_nodes = $this->getMapAreaNodes(
768 $this->hier_id,
769 $this->purpose,
770 $this->getPcId()
771 );
772 foreach ($ma_nodes as $node) {
773 if ($node->get_attribute("Id") == $a_id) {
774 $node->unlink_node($node);
775 }
776 }
777 }

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

323 {
324 $caption_node = $this->getMAItemNode(
325 $this->hier_id,
326 $this->purpose,
327 $this->getPcId(),
328 "/Caption"
329 );
330 if (is_object($caption_node)) {
331 $caption_node->unlink_node($caption_node);
332 }
333 }

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

527 {
528 $par_nodes = $this->getParameterNodes(
529 $this->hier_id,
530 $this->purpose,
531 $this->getPcId()
532 );
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);
537 }
538 }
539 }

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

217 {
218 $layout_node = $this->getMAItemNode(
219 $this->hier_id,
220 $this->purpose,
221 $this->getPcId(),
222 "/Layout"
223 );
224 if (is_object($layout_node)) {
225 if ($layout_node->has_attribute("Width")) {
226 $layout_node->remove_attribute("Width");
227 }
228 if ($layout_node->has_attribute("Height")) {
229 $layout_node->remove_attribute("Height");
230 }
231 }
232 }

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

389 {
390 $text_representation_node = $this->getMAItemNode(
391 $this->hier_id,
392 $this->purpose,
393 $this->getPcId(),
394 "/TextRepresentation"
395 );
396 if (is_object($text_representation_node)) {
397 $text_representation_node->unlink_node($text_representation_node);
398 }
399 }

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

136 {
137 if (is_object($this->item_node)) {
138 return true;
139 } else {
140 return false;
141 }
142 }

◆ getCaption()

ilMediaAliasItem::getCaption ( )

Get Caption.

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

288 {
289 $caption_node = $this->getMAItemNode(
290 $this->hier_id,
291 $this->purpose,
292 $this->getPcId(),
293 "/Caption"
294 );
295 if (is_object($caption_node)) {
296 return $caption_node->get_content();
297 }
298 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ getHeight()

ilMediaAliasItem::getHeight ( )

Get Height.

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

255 {
256 $layout_node = $this->getMAItemNode(
257 $this->hier_id,
258 $this->purpose,
259 $this->getPcId(),
260 "/Layout"
261 );
262 if (is_object($layout_node)) {
263 return $layout_node->get_attribute("Height");
264 }
265 }

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

416 {
417 $layout_node = $this->getMAItemNode(
418 $this->hier_id,
419 $this->purpose,
420 $this->getPcId(),
421 "/Layout"
422 );
423 if (is_object($layout_node)) {
424 return $layout_node->get_attribute("HorizontalAlign");
425 }
426 }

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

865 {
866 $ma_nodes = $this->getMapAreaNodes(
867 $this->hier_id,
868 $this->purpose,
869 $this->getPcId()
870 );
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");
874 }
875 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getLinkTypeOfArea()

ilMediaAliasItem::getLinkTypeOfArea (   $a_nr)

Get link type.

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

796 {
797 $ma_nodes = $this->getMapAreaNodes(
798 $this->hier_id,
799 $this->purpose,
800 $this->getPcId()
801 );
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") {
805 return "int";
806 }
807 if ($childs[0]->node_name() == "ExtLink") {
808 return "ext";
809 }
810 }
811 }

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

51 {
52 if ($a_pc_id != "") {
53 $xpc = xpath_new_context($this->dom);
54 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
55 $res = xpath_eval($xpc, $path);
56 if (count($res->nodeset) == 1) {
57 return $res->nodeset[0];
58 }
59 }
60
61 $xpc = xpath_new_context($this->dom);
62 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
63 $res = xpath_eval($xpc, $path);
64 if (count($res->nodeset) > 0) {
65 return $res->nodeset[0];
66 }
67 }

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

90 {
91 if ($a_pc_id != "") {
92 $xpc = xpath_new_context($this->dom);
93 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
94 $res = xpath_eval($xpc, $path);
95 if (count($res->nodeset) > 0) {
96 return $res->nodeset;
97 }
98 return array();
99 }
100
101 $xpc = xpath_new_context($this->dom);
102 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
103 $res = xpath_eval($xpc, $path);
104 if (count($res->nodeset) > 0) {
105 return $res->nodeset;
106 }
107 return array();
108 }

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

546 {
547 $ma_nodes = $this->getMapAreaNodes(
548 $this->hier_id,
549 $this->purpose,
550 $this->getPcId()
551 );
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();
556 $link = array();
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());
561 }
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());
568 }
569 $maparea_arr[] = array(
570 "Nr" => $i + 1,
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"),
576 "Link" => $link);
577 }
578
579 return $maparea_arr;
580 }

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

502 {
503 }

◆ getParameterNodes()

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

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

70 {
71 if ($a_pc_id != "") {
72 $xpc = xpath_new_context($this->dom);
73 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
74 $res = xpath_eval($xpc, $path);
75 if (count($res->nodeset) > 0) {
76 return $res->nodeset;
77 }
78 return array();
79 }
80
81 $xpc = xpath_new_context($this->dom);
82 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
83 $res = xpath_eval($xpc, $path);
84 if (count($res->nodeset) > 0) {
85 return $res->nodeset;
86 }
87 }

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

483 {
484 $par_nodes = $this->getParameterNodes(
485 $this->hier_id,
486 $this->purpose,
487 $this->getPcId()
488 );
489 $par_arr = array();
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");
494 }
495 return $par_arr;
496 }

References $i, getParameterNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getParameterString()

ilMediaAliasItem::getParameterString ( )

Get all parameters as string.

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

465 {
466 $par_nodes = $this->getParameterNodes(
467 $this->hier_id,
468 $this->purpose,
469 $this->getPcId()
470 );
471 $par_arr = array();
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") . "\"";
475 }
476 return implode($par_arr, ", ");
477 }

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

849 {
850 $ma_nodes = $this->getMapAreaNodes(
851 $this->hier_id,
852 $this->purpose,
853 $this->getPcId()
854 );
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");
858 }
859 }

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

833 {
834 $ma_nodes = $this->getMapAreaNodes(
835 $this->hier_id,
836 $this->purpose,
837 $this->getPcId()
838 );
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");
842 }
843 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getTextRepresentation()

ilMediaAliasItem::getTextRepresentation ( )

Get TextRepresentation.

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

354 {
355 $text_representation_node = $this->getMAItemNode(
356 $this->hier_id,
357 $this->purpose,
358 $this->getPcId(),
359 "/TextRepresentation"
360 );
361 if (is_object($text_representation_node)) {
362 return $text_representation_node->get_content();
363 }
364 }

References getMAItemNode(), and getPcId().

+ Here is the call graph for this function:

◆ getTitleOfArea()

ilMediaAliasItem::getTitleOfArea (   $a_nr)

Get title.

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

881 {
882 $ma_nodes = $this->getMapAreaNodes(
883 $this->hier_id,
884 $this->purpose,
885 $this->getPcId()
886 );
887 if (is_object($ma_nodes[$a_nr - 1])) {
888 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
889 return $childs[0]->get_content();
890 }
891 }

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

817 {
818 $ma_nodes = $this->getMapAreaNodes(
819 $this->hier_id,
820 $this->purpose,
821 $this->getPcId()
822 );
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");
826 }
827 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ getWidth()

ilMediaAliasItem::getWidth ( )

Get width.

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

182 {
183 $layout_node = $this->getMAItemNode(
184 $this->hier_id,
185 $this->purpose,
186 $this->getPcId(),
187 "/Layout"
188 );
189 if (is_object($layout_node)) {
190 return $layout_node->get_attribute("Width");
191 }
192 }

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

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

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

916 {
918
919 if (!$a_st_item->copyOriginal()) {
920 return false;
921 }
922 $a_st_item->buildMapWorkImage();
923
924 // determine ratios (first see whether the instance has w/h defined)
925 $width = $this->getWidth();
926 $height = $this->getHeight();
927
928 // if instance has no size, use object w/h
929 if ($width == 0 && $height == 0) {
930 $width = $a_st_item->getWidth();
931 $height = $a_st_item->getHeight();
932 }
933 $size = @getimagesize($a_st_item->getMapWorkCopyName());
934 $x_ratio = 1;
935 if ($size[0] > 0 && $width > 0) {
936 $x_ratio = $width / $size[0];
937 }
938 $y_ratio = 1;
939 if ($size[1] > 0 && $height > 0) {
940 $y_ratio = $height / $size[1];
941 }
942
943 // draw map areas
944 $areas = $this->getMapAreas();
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) ||
948 ($a_area_nr == 0)
949 ) {
950 $area = new ilMapArea();
951 $area->setShape($areas[$i]["Shape"]);
952 $area->setCoords($areas[$i]["Coords"]);
953 $area->draw(
954 $a_st_item->getMapWorkImage(),
955 $a_st_item->color1,
956 $a_st_item->color2,
957 true,
958 $x_ratio,
959 $y_ratio
960 );
961 }
962 }
963
964 if ($a_output_new_area) {
965 $area = new ilMapArea();
966 $area->setShape($a_area_type);
967 $area->setCoords($a_coords);
968 $area->draw(
969 $a_st_item->getMapWorkImage(),
970 $a_st_item->color1,
971 $a_st_item->color2,
972 false,
973 $x_ratio,
974 $y_ratio
975 );
976 }
977
978 $a_st_item->saveMapWorkImage();
979
980 return true;
981 }
$size
Definition: RandomTest.php:84
Class ilMapArea.
getMapAreas()
Get all map areas.

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

631 {
632 $ma_nodes = $this->getMapAreaNodes(
633 $this->hier_id,
634 $this->purpose,
635 $this->getPcId()
636 );
637 if (is_object($ma_nodes[$a_nr - 1])) {
638 $title = $this->getTitleOfArea($a_nr);
639 ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
640 $attributes = array("Href" => $a_href);
642 $this->dom,
643 $ma_nodes[$a_nr - 1],
644 "ExtLink",
645 array(""),
646 $title,
648 );
649 }
650 }
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 $attributes, $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 686 of file class.ilMediaAliasItem.php.

687 {
688 $ma_nodes = $this->getMapAreaNodes(
689 $this->hier_id,
690 $this->purpose,
691 $this->getPcId()
692 );
693 if (is_object($ma_nodes[$a_nr - 1])) {
694 $ma_nodes[$a_nr - 1]->set_attribute("HighlightClass", $a_class);
695 }
696 }

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

672 {
673 $ma_nodes = $this->getMapAreaNodes(
674 $this->hier_id,
675 $this->purpose,
676 $this->getPcId()
677 );
678 if (is_object($ma_nodes[$a_nr - 1])) {
679 $ma_nodes[$a_nr - 1]->set_attribute("HighlightMode", $a_mode);
680 }
681 }

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

605 {
606 $ma_nodes = $this->getMapAreaNodes(
607 $this->hier_id,
608 $this->purpose,
609 $this->getPcId()
610 );
611 if (is_object($ma_nodes[$a_nr - 1])) {
612 $title = $this->getTitleOfArea($a_nr);
613 ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
614 $attributes = array("Type" => $a_type, "Target" => $a_target,
615 "TargetFrame" => $a_target_frame);
617 $this->dom,
618 $ma_nodes[$a_nr - 1],
619 "IntLink",
620 array(""),
621 $title,
623 );
624 }
625 }
$a_type
Definition: workflow.php:92

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

586 {
587 $ma_nodes = $this->getMapAreaNodes(
588 $this->hier_id,
589 $this->purpose,
590 $this->getPcId()
591 );
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);
597 }
598 }
599 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setCaption()

ilMediaAliasItem::setCaption (   $a_caption)

Set Caption.

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

272 {
274 $this->dom,
275 $this->item_node,
276 "Caption",
277 array("TextRepresentation", "Parameter", "MapArea"),
278 $a_caption,
279 array("Align" => "bottom")
280 );
281 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setHeight()

ilMediaAliasItem::setHeight (   $a_height)

Set Height.

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

238 {
240 $this->dom,
241 $this->item_node,
242 "Layout",
243 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
244 "",
245 array("Height" => $a_height),
246 false
247 );
248 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setHorizontalAlign()

ilMediaAliasItem::setHorizontalAlign (   $a_halign)

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

402 {
404 $this->dom,
405 $this->item_node,
406 "Layout",
407 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
408 "",
409 array("HorizontalAlign" => $a_halign),
410 false
411 );
412 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setParameters()

ilMediaAliasItem::setParameters (   $a_par_array)

set parameter

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

432 {
433 $par_nodes = $this->getParameterNodes(
434 $this->hier_id,
435 $this->purpose,
436 $this->getPcId()
437 );
438 for ($i=0; $i < count($par_nodes); $i++) {
439 $par_node = $par_nodes[$i];
440 $par_node->unlink_node($par_node);
441 }
442
443 include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
444 if (is_array($a_par_array)) {
445 foreach ($a_par_array as $par => $val) {
446 if (ilMediaItem::checkParameter($par, $val)) {
447 $attributes = array("Name" => $par, "Value" => $val);
449 $this->dom,
450 $this->item_node,
451 "Parameter",
452 array("MapArea"),
453 "",
455 );
456 }
457 }
458 }
459 }
static checkParameter($a_par, $a_val)
Check parameter (filter javascript related and other unsafe parameters/values)

References $attributes, $i, 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 115 of file class.ilMediaAliasItem.php.

116 {
117 $this->pcid = $a_pcid;
118 }

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

656 {
657 $ma_nodes = $this->getMapAreaNodes(
658 $this->hier_id,
659 $this->purpose,
660 $this->getPcId()
661 );
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);
665 }
666 }

References getMapAreaNodes(), and getPcId().

+ Here is the call graph for this function:

◆ setTextRepresentation()

ilMediaAliasItem::setTextRepresentation (   $a_text_representation)

Set TextRepresentation.

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

339 {
341 $this->dom,
342 $this->item_node,
343 "TextRepresentation",
344 array("Parameter", "MapArea"),
345 $a_text_representation,
346 array()
347 );
348 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ setWidth()

ilMediaAliasItem::setWidth (   $a_width)

Set width.

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

165 {
167 $this->dom,
168 $this->item_node,
169 "Layout",
170 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
171 "",
172 array("Width" => $a_width),
173 false
174 );
175 }

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

Field Documentation

◆ $dom

ilMediaAliasItem::$dom

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

◆ $hier_id

ilMediaAliasItem::$hier_id

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

◆ $item_node

ilMediaAliasItem::$item_node

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

Referenced by insert().

◆ $lng

ilMediaAliasItem::$lng
protected

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

Referenced by makeMapWorkCopy().

◆ $purpose

ilMediaAliasItem::$purpose

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


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