ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMediaAliasItem Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilMediaAliasItem:

Public Member Functions

 __construct (DOMDocument $dom, string $a_hier_id, string $a_purpose, string $a_pc_id="", string $a_parent_node_name="MediaObject")
 
 getMAItemNode (string $a_hier_id, string $a_purpose, string $a_pc_id="", string $a_sub_element="")
 
 getParameterNodes (string $a_hier_id, string $a_purpose, string $a_pc_id="")
 
 getMapAreaNodes (string $a_hier_id, string $a_purpose, string $a_pc_id="")
 
 setPcId (string $a_pcid)
 
 getPcId ()
 
 exists ()
 check if item node exists More...
 
 insert ()
 inserts new node in dom More...
 
 setWidth (string $a_width)
 
 getWidth ()
 
 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 (string $a_height)
 
 getHeight ()
 
 setCaption (string $a_caption)
 
 getCaption ()
 
 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 (string $a_text_representation)
 
 getTextRepresentation ()
 
 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 (string $a_halign)
 
 getHorizontalAlign ()
 
 setParameters (array $a_par_array)
 
 getParameterString ()
 Get all parameters as string. More...
 
 getParameters ()
 Get all parameters as array. 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 (int $a_nr, string $a_title)
 
 setAreaIntLink (int $a_nr, string $a_type, string $a_target, string $a_target_frame)
 Set link of area to an internal one. More...
 
 setAreaExtLink (int $a_nr, string $a_href)
 Set link of area to an external one. More...
 
 setShape (int $a_nr, string $a_shape_type, string $a_coords)
 Set shape and coords of single area. More...
 
 setAreaHighlightMode (int $a_nr, string $a_mode)
 Set highlight mode single area. More...
 
 setAreaHighlightClass (int $a_nr, string $a_class)
 Set highlight class single area. More...
 
 addMapArea (string $a_shape_type, string $a_coords, string $a_title, array $a_link, string $a_id="", string $hl_mode="", string $hl_class="",)
 Add a new area to the map. More...
 
 deleteMapArea (int $a_nr)
 Delete a sinlge map area. More...
 
 deleteMapAreaById (string $a_id)
 Delete map areas by id. More...
 
 deleteAllMapAreas ()
 Delete all map areas. More...
 
 getLinkTypeOfArea (int $a_nr)
 Get link type. More...
 
 getTypeOfArea (int $a_nr)
 Get type (only internal link) More...
 
 getTargetOfArea (int $a_nr)
 Get target (only internal link) More...
 
 getTargetFrameOfArea (int $a_nr)
 Get target frame (only internal link) More...
 
 getHrefOfArea (int $a_nr)
 Get href (only external link) More...
 
 getTitleOfArea (int $a_nr)
 Get title. More...
 
 delete ()
 delete full item node from dom More...
 
 makeMapWorkCopy (ilMediaItem $a_st_item, int $a_area_nr, bool $a_exclude, bool $a_output_new_area, string $a_area_type, string $a_coords)
 make map work copy of image More...
 
 hasAnyPropertiesSet ()
 Has the alias any properties set? More...
 
 getModel ()
 

Data Fields

string $hier_id = ""
 
string $purpose = ""
 
DOMNode $item_node = null
 

Protected Member Functions

 getItemNode ()
 

Protected Attributes

DOMDocument $dom_doc
 
ILIAS COPage Dom DomUtil $dom_util
 
string $parent_node_name
 
string $pcid
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilMediaAliasItem Media Alias Item, component of a media object (file or reference)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilMediaAliasItem::__construct ( DOMDocument  $dom,
string  $a_hier_id,
string  $a_purpose,
string  $a_pc_id = "",
string  $a_parent_node_name = "MediaObject" 
)

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

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->dom_doc = $dom;
46 $this->parent_node_name = $a_parent_node_name;
47 $this->hier_id = $a_hier_id;
48 $this->purpose = $a_purpose;
49 $this->setPcId($a_pc_id);
50 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
51 $this->item_node = $this->getMAItemNode(
52 $this->hier_id,
53 $this->purpose,
54 $this->getPcId()
55 );
56 }
getMAItemNode(string $a_hier_id, string $a_purpose, string $a_pc_id="", string $a_sub_element="")
global $DIC
Definition: shib_login.php:26

References $DIC, getMAItemNode(), getPcId(), ILIAS\Repository\lng(), and setPcId().

+ Here is the call graph for this function:

Member Function Documentation

◆ addMapArea()

ilMediaAliasItem::addMapArea ( string  $a_shape_type,
string  $a_coords,
string  $a_title,
array  $a_link,
string  $a_id = "",
string  $hl_mode = "",
string  $hl_class = "" 
)

Add a new area to the map.

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

666 : void {
667 $attributes = array("Shape" => $a_shape_type,
668 "Coords" => $a_coords, "Id" => $a_id,
669 "HighlightMode" => $hl_mode, "HighlightClass" => $hl_class);
670
671 $ma_node = $this->dom_util->addElementToList(
672 $this->getItemNode(),
673 "MapArea",
674 array(),
675 "",
676 $attributes
677 );
678
679 if ($a_link["LinkType"] == "int" || $a_link["LinkType"] == "IntLink") {
680 $attributes = array("Type" => $a_link["Type"],
681 "TargetFrame" => $a_link["TargetFrame"],
682 "Target" => $a_link["Target"]);
683 $this->dom_util->setFirstOptionalElement(
684 $ma_node,
685 "IntLink",
686 array(""),
687 $a_title,
688 $attributes
689 );
690 }
691 if ($a_link["LinkType"] == "ext" || $a_link["LinkType"] == "ExtLink") {
692 $attributes = array("Href" => $a_link["Href"]);
693 $this->dom_util->setFirstOptionalElement(
694 $ma_node,
695 "ExtLink",
696 array(""),
697 $a_title,
698 $attributes
699 );
700 }
701 }

Referenced by PCMediaObjectTest\testAddMapArea(), PCMediaObjectTest\testAreaProps(), PCMediaObjectTest\testDeleteAllMapAreas(), PCMediaObjectTest\testDeleteMapArea(), and PCMediaObjectTest\testDeleteMapAreaById().

+ Here is the caller graph for this function:

◆ definesCaption()

ilMediaAliasItem::definesCaption ( )

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

Returns
bool returns true if caption is not derived from object

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

273 : bool
274 {
275 $caption_node = $this->getMAItemNode(
276 $this->hier_id,
277 $this->purpose,
278 $this->getPcId(),
279 "/Caption"
280 );
281 if (is_object($caption_node)) {
282 return true;
283 }
284 return false;
285 }

Referenced by PCMediaObjectTest\testCaption(), and PCMediaObjectTest\testDeriveCaption().

+ Here is the caller graph for this function:

◆ definesParameters()

ilMediaAliasItem::definesParameters ( )

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

Returns
bool returns true if parameters are not derived from object

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

458 : bool
459 {
460 $par_nodes = $this->getParameterNodes(
461 $this->hier_id,
462 $this->purpose,
463 $this->getPcId()
464 );
465 if (count($par_nodes) > 0) {
466 return true;
467 }
468 return false;
469 }
getParameterNodes(string $a_hier_id, string $a_purpose, string $a_pc_id="")

Referenced by PCMediaObjectTest\testDeriveParameters(), and PCMediaObjectTest\testParameters().

+ Here is the caller graph for this function:

◆ definesSize()

ilMediaAliasItem::definesSize ( )

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

Returns
bool returns true if size is not derived from object

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

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

Referenced by PCMediaObjectTest\testDeriveSize(), and PCMediaObjectTest\testWidth().

+ Here is the caller graph for this function:

◆ definesTextRepresentation()

ilMediaAliasItem::definesTextRepresentation ( )

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

Returns
bool returns true if TextRepresentation is not derived from object

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

333 : bool
334 {
335 $text_representation_node = $this->getMAItemNode(
336 $this->hier_id,
337 $this->purpose,
338 $this->getPcId(),
339 "/TextRepresentation"
340 );
341 if (is_object($text_representation_node)) {
342 return true;
343 }
344 return false;
345 }

Referenced by PCMediaObjectTest\testDeriveTextRepresentation(), and PCMediaObjectTest\testTextRepresentation().

+ Here is the caller graph for this function:

◆ delete()

ilMediaAliasItem::delete ( )

delete full item node from dom

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

860 : void
861 {
862 if (is_object($this->item_node)) {
863 $this->item_node->parentNode->removeChild($this->item_node);
864 }
865 }

◆ deleteAllMapAreas()

ilMediaAliasItem::deleteAllMapAreas ( )

Delete all map areas.

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

741 : void
742 {
743 $path = "//PageContent[@HierId = '" . $this->hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='" . $this->purpose . "']/MapArea";
744 $nodes = $this->dom_util->path($this->dom_doc, $path);
745 foreach ($nodes as $node) {
746 $node->parentNode->removeChild($node);
747 }
748 }
$path
Definition: ltiservices.php:30

References $path.

Referenced by PCMediaObjectTest\testDeleteAllMapAreas().

+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaAliasItem::deleteMapArea ( int  $a_nr)

Delete a sinlge map area.

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

706 : void
707 {
708 $ma_nodes = $this->getMapAreaNodes(
709 $this->hier_id,
710 $this->purpose,
711 $this->getPcId()
712 );
713
714 if (is_object($ma_nodes->item($a_nr - 1))) {
715 $node = $ma_nodes->item($a_nr - 1);
716 $node->parentNode->removeChild($node);
717 }
718 }
getMapAreaNodes(string $a_hier_id, string $a_purpose, string $a_pc_id="")

Referenced by PCMediaObjectTest\testDeleteMapArea().

+ Here is the caller graph for this function:

◆ deleteMapAreaById()

ilMediaAliasItem::deleteMapAreaById ( string  $a_id)

Delete map areas by id.

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

725 : void {
726 $ma_nodes = $this->getMapAreaNodes(
727 $this->hier_id,
728 $this->purpose,
729 $this->getPcId()
730 );
731 foreach ($ma_nodes as $node) {
732 if ($node->getAttribute("Id") == $a_id) {
733 $node->parentNode->removeChild($node);
734 }
735 }
736 }

Referenced by PCMediaObjectTest\testDeleteMapAreaById().

+ Here is the caller graph for this function:

◆ deriveCaption()

ilMediaAliasItem::deriveCaption ( )

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

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

290 : void
291 {
292 $caption_node = $this->getMAItemNode(
293 $this->hier_id,
294 $this->purpose,
295 $this->getPcId(),
296 "/Caption"
297 );
298 if (is_object($caption_node)) {
299 $caption_node->parentNode->removeChild($caption_node);
300 }
301 }

Referenced by PCMediaObjectTest\testDeriveCaption().

+ Here is the caller graph for this function:

◆ deriveParameters()

ilMediaAliasItem::deriveParameters ( )

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

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

474 : void
475 {
476 $par_nodes = $this->getParameterNodes(
477 $this->hier_id,
478 $this->purpose,
479 $this->getPcId()
480 );
481 foreach ($par_nodes as $par_node) {
482 $par_node->parentNode->removeChild($par_node);
483 }
484 }

Referenced by PCMediaObjectTest\testDeriveParameters().

+ Here is the caller graph for this function:

◆ deriveSize()

ilMediaAliasItem::deriveSize ( )

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

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

199 : void
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 if ($layout_node->hasAttribute("Width")) {
209 $layout_node->removeAttribute("Width");
210 }
211 if ($layout_node->hasAttribute("Height")) {
212 $layout_node->removeAttribute("Height");
213 }
214 }
215 }

Referenced by PCMediaObjectTest\testDeriveSize().

+ Here is the caller graph for this function:

◆ deriveTextRepresentation()

ilMediaAliasItem::deriveTextRepresentation ( )

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

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

350 : void
351 {
352 $text_representation_node = $this->getMAItemNode(
353 $this->hier_id,
354 $this->purpose,
355 $this->getPcId(),
356 "/TextRepresentation"
357 );
358 if (is_object($text_representation_node)) {
359 $text_representation_node->parentNode->removeChild($text_representation_node);
360 }
361 }

Referenced by PCMediaObjectTest\testDeriveTextRepresentation().

+ Here is the caller graph for this function:

◆ exists()

ilMediaAliasItem::exists ( )

check if item node exists

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

126 : bool
127 {
128 if (is_object($this->item_node)) {
129 return true;
130 } else {
131 return false;
132 }
133 }

◆ getCaption()

ilMediaAliasItem::getCaption ( )

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

255 : string
256 {
257 $caption_node = $this->getMAItemNode(
258 $this->hier_id,
259 $this->purpose,
260 $this->getPcId(),
261 "/Caption"
262 );
263 if (is_object($caption_node)) {
264 return $this->dom_util->getContent($caption_node);
265 }
266 return "";
267 }

Referenced by PCMediaObjectTest\testCaption().

+ Here is the caller graph for this function:

◆ getHeight()

ilMediaAliasItem::getHeight ( )

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

230 : string
231 {
232 $layout_node = $this->getMAItemNode(
233 $this->hier_id,
234 $this->purpose,
235 $this->getPcId(),
236 "/Layout"
237 );
238 if (is_object($layout_node)) {
239 return $layout_node->getAttribute("Height");
240 }
241 return "";
242 }

Referenced by PCMediaObjectTest\testHeight().

+ Here is the caller graph for this function:

◆ getHorizontalAlign()

ilMediaAliasItem::getHorizontalAlign ( )

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

376 : string
377 {
378 $layout_node = $this->getMAItemNode(
379 $this->hier_id,
380 $this->purpose,
381 $this->getPcId(),
382 "/Layout"
383 );
384 if (is_object($layout_node)) {
385 return $layout_node->getAttribute("HorizontalAlign");
386 }
387 return "";
388 }

Referenced by PCMediaObjectTest\testHorizontalAlign().

+ Here is the caller graph for this function:

◆ getHrefOfArea()

ilMediaAliasItem::getHrefOfArea ( int  $a_nr)

Get href (only external link)

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

826 : string
827 {
828 $ma_nodes = $this->getMapAreaNodes(
829 $this->hier_id,
830 $this->purpose,
831 $this->getPcId()
832 );
833 if (is_object($ma_nodes->item($a_nr - 1))) {
834 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
835 return $childs->item(0)->getAttribute("Href");
836 }
837 return "";
838 }

Referenced by PCMediaObjectTest\testAddMapArea().

+ Here is the caller graph for this function:

◆ getItemNode()

ilMediaAliasItem::getItemNode ( )
protected

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

58 : DOMNode
59 {
60 return $this->item_node;
61 }

References $item_node.

◆ getLinkTypeOfArea()

ilMediaAliasItem::getLinkTypeOfArea ( int  $a_nr)

Get link type.

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

753 : string
754 {
755 $ma_nodes = $this->getMapAreaNodes(
756 $this->hier_id,
757 $this->purpose,
758 $this->getPcId()
759 );
760 if (is_object($ma_nodes->item($a_nr - 1))) {
761 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
762 if ($childs->item(0)->nodeName == "IntLink") {
763 return "int";
764 }
765 if ($childs->item(0)->nodeName == "ExtLink") {
766 return "ext";
767 }
768 }
769 return "";
770 }

Referenced by PCMediaObjectTest\testAreaProps().

+ Here is the caller graph for this function:

◆ getMAItemNode()

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

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

68 : ?DOMNode {
69 if ($a_pc_id != "") {
70 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
71 $nodes = $this->dom_util->path($this->dom_doc, $path);
72 if (count($nodes) == 1) {
73 return $nodes->item(0);
74 }
75 }
76
77 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']" . $a_sub_element;
78 $nodes = $this->dom_util->path($this->dom_doc, $path);
79 if (count($nodes) > 0) {
80 return $nodes->item(0);
81 }
82 return null;
83 }

References $path.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ getMapAreaNodes()

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

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

103 : DOMNodeList {
104 if ($a_pc_id != "") {
105 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
106 return $this->dom_util->path($this->dom_doc, $path);
107 }
108
109 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
110 return $this->dom_util->path($this->dom_doc, $path);
111 }

References $path.

◆ getMapAreas()

ilMediaAliasItem::getMapAreas ( )

Get all map areas.

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

490 : array
491 {
492 $ma_nodes = $this->getMapAreaNodes(
493 $this->hier_id,
494 $this->purpose,
495 $this->getPcId()
496 );
497 $maparea_arr = array();
498 $i = 0;
499 foreach ($ma_nodes as $maparea_node) {
500 $childs = $maparea_node->childNodes;
501 $link = array();
502 $first = $childs->item(0);
503 if ($first->nodeName == "ExtLink") {
504 $link = array("LinkType" => "ExtLink",
505 "Href" => $first->getAttribute("Href"),
506 "Title" => $this->dom_util->getContent($first));
507 }
508 if ($first->nodeName == "IntLink") {
509 $link = array("LinkType" => "IntLink",
510 "Target" => $first->getAttribute("Target"),
511 "Type" => $first->getAttribute("Type"),
512 "TargetFrame" => $first->getAttribute("TargetFame"),
513 "Title" => $this->dom_util->getContent($first));
514 }
515 $maparea_arr[] = array(
516 "Nr" => $i + 1,
517 "Shape" => $maparea_node->getAttribute("Shape"),
518 "Coords" => $maparea_node->getAttribute("Coords"),
519 "HighlightMode" => $maparea_node->getAttribute("HighlightMode"),
520 "HighlightClass" => $maparea_node->getAttribute("HighlightClass"),
521 "Id" => $maparea_node->getAttribute("Id"),
522 "Link" => $link);
523 $i++;
524 }
525
526 return $maparea_arr;
527 }

Referenced by PCMediaObjectTest\testAddMapArea().

+ Here is the caller graph for this function:

◆ getModel()

ilMediaAliasItem::getModel ( )

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

950 : ?stdClass
951 {
952 $model = new \stdClass();
953 $model->areas = $this->getMapAreas();
954 $model->caption = $this->getCaption();
955 return $model;
956 }
getMapAreas()
Get all map areas.

◆ getParameterNodes()

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

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

89 : DOMNodeList {
90 if ($a_pc_id != "") {
91 $path = "//PageContent[@PCID = '" . $a_pc_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
92 return $this->dom_util->path($this->dom_doc, $path);
93 }
94
95 $path = "//PageContent[@HierId = '" . $a_hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
96 return $this->dom_util->path($this->dom_doc, $path);
97 }

References $path.

◆ getParameters()

ilMediaAliasItem::getParameters ( )

Get all parameters as array.

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

438 : array
439 {
440 $par_nodes = $this->getParameterNodes(
441 $this->hier_id,
442 $this->purpose,
443 $this->getPcId()
444 );
445 $par_arr = array();
446 for ($i = 0; $i < count($par_nodes); $i++) {
447 $par_node = $par_nodes[$i];
448 $par_arr[$par_node->getAttribute("Name")] =
449 $par_node->getAttribute("Value");
450 }
451 return $par_arr;
452 }

Referenced by PCMediaObjectTest\testParameters().

+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaAliasItem::getParameterString ( )

Get all parameters as string.

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

421 : string
422 {
423 $par_nodes = $this->getParameterNodes(
424 $this->hier_id,
425 $this->purpose,
426 $this->getPcId()
427 );
428 $par_arr = array();
429 foreach ($par_nodes as $par_node) {
430 $par_arr[] = $par_node->getAttribute("Name") . "=\"" . $par_node->getAttribute("Value") . "\"";
431 }
432 return implode(", ", $par_arr);
433 }

Referenced by PCMediaObjectTest\testParameters().

+ Here is the caller graph for this function:

◆ getPcId()

ilMediaAliasItem::getPcId ( )

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

118 : string
119 {
120 return $this->pcid;
121 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ getTargetFrameOfArea()

ilMediaAliasItem::getTargetFrameOfArea ( int  $a_nr)

Get target frame (only internal link)

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

809 : string
810 {
811 $ma_nodes = $this->getMapAreaNodes(
812 $this->hier_id,
813 $this->purpose,
814 $this->getPcId()
815 );
816 if (is_object($ma_nodes->item($a_nr - 1))) {
817 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
818 return $childs->item(0)->getAttribute("TargetFrame");
819 }
820 return "";
821 }

Referenced by PCMediaObjectTest\testAreaProps().

+ Here is the caller graph for this function:

◆ getTargetOfArea()

ilMediaAliasItem::getTargetOfArea ( int  $a_nr)

Get target (only internal link)

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

792 : string
793 {
794 $ma_nodes = $this->getMapAreaNodes(
795 $this->hier_id,
796 $this->purpose,
797 $this->getPcId()
798 );
799 if (is_object($ma_nodes->item($a_nr - 1))) {
800 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
801 return $childs->item(0)->getAttribute("Target");
802 }
803 return "";
804 }

Referenced by PCMediaObjectTest\testAreaProps().

+ Here is the caller graph for this function:

◆ getTextRepresentation()

ilMediaAliasItem::getTextRepresentation ( )

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

315 : string
316 {
317 $text_representation_node = $this->getMAItemNode(
318 $this->hier_id,
319 $this->purpose,
320 $this->getPcId(),
321 "/TextRepresentation"
322 );
323 if (is_object($text_representation_node)) {
324 return $this->dom_util->getContent($text_representation_node);
325 }
326 return "";
327 }

Referenced by PCMediaObjectTest\testTextRepresentation().

+ Here is the caller graph for this function:

◆ getTitleOfArea()

ilMediaAliasItem::getTitleOfArea ( int  $a_nr)

Get title.

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

843 : string
844 {
845 $ma_nodes = $this->getMapAreaNodes(
846 $this->hier_id,
847 $this->purpose,
848 $this->getPcId()
849 );
850 if (is_object($ma_nodes->item($a_nr - 1))) {
851 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
852 return $this->dom_util->getContent($childs->item(0));
853 }
854 return "";
855 }

Referenced by PCMediaObjectTest\testAreaProps().

+ Here is the caller graph for this function:

◆ getTypeOfArea()

ilMediaAliasItem::getTypeOfArea ( int  $a_nr)

Get type (only internal link)

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

775 : string
776 {
777 $ma_nodes = $this->getMapAreaNodes(
778 $this->hier_id,
779 $this->purpose,
780 $this->getPcId()
781 );
782 if (is_object($ma_nodes->item($a_nr - 1))) {
783 $childs = $ma_nodes->item($a_nr - 1)->childNodes;
784 return $childs->item(0)->getAttribute("Type");
785 }
786 return "";
787 }

Referenced by PCMediaObjectTest\testAreaProps().

+ Here is the caller graph for this function:

◆ getWidth()

ilMediaAliasItem::getWidth ( )

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

164 : string
165 {
166 $layout_node = $this->getMAItemNode(
167 $this->hier_id,
168 $this->purpose,
169 $this->getPcId(),
170 "/Layout"
171 );
172 if (is_object($layout_node)) {
173 return $layout_node->getAttribute("Width");
174 }
175 return "";
176 }

Referenced by PCMediaObjectTest\testWidth().

+ Here is the caller graph for this function:

◆ hasAnyPropertiesSet()

ilMediaAliasItem::hasAnyPropertiesSet ( )

Has the alias any properties set?

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

942 : bool
943 {
944 return ($this->definesSize() ||
945 $this->definesCaption() ||
946 $this->definesTextRepresentation() ||
947 $this->definesParameters());
948 }
definesTextRepresentation()
check if alias item defines own TextRepresentation or derives TextRepresentation from object
definesParameters()
check if alias item defines own parameters or derives parameters from object
definesSize()
check if alias item defines own size or derives size from object
definesCaption()
check if alias item defines own caption or derives caption from object

◆ insert()

ilMediaAliasItem::insert ( )

inserts new node in dom

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

138 : void
139 {
140 $path = "//PageContent[@HierId = '" . $this->hier_id . "']/" . $this->parent_node_name;
141 $nodes = $this->dom_util->path($this->dom_doc, $path);
142 if (count($nodes) > 0) {
143 $obj_node = $nodes->item(0);
144 $item_node = $this->dom_doc->createElement("MediaAliasItem");
145 $item_node = $obj_node->appendChild($item_node);
146 $item_node->setAttribute("Purpose", $this->purpose);
147 $this->item_node = $item_node;
148 }
149 }

References $path.

◆ makeMapWorkCopy()

ilMediaAliasItem::makeMapWorkCopy ( ilMediaItem  $a_st_item,
int  $a_area_nr,
bool  $a_exclude,
bool  $a_output_new_area,
string  $a_area_type,
string  $a_coords 
)

make map work copy of image

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

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

879 : bool {
880 $a_st_item->buildMapWorkImage();
881
882 // determine ratios (first see whether the instance has w/h defined)
883 $width = $this->getWidth();
884 $height = $this->getHeight();
885
886 // if instance has no size, use object w/h
887 if ($width == 0 && $height == 0) {
888 $width = $a_st_item->getWidth();
889 $height = $a_st_item->getHeight();
890 }
891 $size = getimagesize($a_st_item->getOriginalSource());
892 $x_ratio = 1;
893 if ($size[0] > 0 && $width > 0) {
894 $x_ratio = $width / $size[0];
895 }
896 $y_ratio = 1;
897 if ($size[1] > 0 && $height > 0) {
898 $y_ratio = $height / $size[1];
899 }
900
901 // draw map areas
902 $areas = $this->getMapAreas();
903 for ($i = 0; $i < count($areas); $i++) {
904 if (((($i + 1) == $a_area_nr) && !$a_exclude) ||
905 ((($i + 1) != $a_area_nr) && $a_exclude) ||
906 ($a_area_nr == 0)
907 ) {
908 $area = new ilMapArea();
909 $area->setShape($areas[$i]["Shape"]);
910 $area->setCoords($areas[$i]["Coords"]);
911 $area->draw(
912 $a_st_item->getMapWorkImage(),
913 $a_st_item->color1,
914 $a_st_item->color2,
915 true,
916 $x_ratio,
917 $y_ratio
918 );
919 }
920 }
921
922 if ($a_output_new_area) {
923 $area = new ilMapArea();
924 $area->setShape($a_area_type);
925 $area->setCoords($a_coords);
926 $area->draw(
927 $a_st_item->getMapWorkImage(),
928 $a_st_item->color1,
929 $a_st_item->color2,
930 false,
931 $x_ratio,
932 $y_ratio
933 );
934 }
935
936 return true;
937 }
Class ilMapArea.
buildMapWorkImage()
build image map work image

◆ setAreaExtLink()

ilMediaAliasItem::setAreaExtLink ( int  $a_nr,
string  $a_href 
)

Set link of area to an external one.

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

582 : void {
583 $ma_nodes = $this->getMapAreaNodes(
584 $this->hier_id,
585 $this->purpose,
586 $this->getPcId()
587 );
588 if (is_object($ma_nodes[$a_nr - 1])) {
589 $title = $this->getTitleOfArea($a_nr);
590 $this->dom_util->deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
591 $attributes = array("Href" => $a_href);
592 $this->dom_util->setFirstOptionalElement(
593 $ma_nodes[$a_nr - 1],
594 "ExtLink",
595 array(""),
596 $title,
597 $attributes
598 );
599 }
600 }
getTitleOfArea(int $a_nr)
Get title.

◆ setAreaHighlightClass()

ilMediaAliasItem::setAreaHighlightClass ( int  $a_nr,
string  $a_class 
)

Set highlight class single area.

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

644 : void {
645 $ma_nodes = $this->getMapAreaNodes(
646 $this->hier_id,
647 $this->purpose,
648 $this->getPcId()
649 );
650 if (is_object($ma_nodes[$a_nr - 1])) {
651 $ma_nodes[$a_nr - 1]->setAttribute("HighlightClass", $a_class);
652 }
653 }

◆ setAreaHighlightMode()

ilMediaAliasItem::setAreaHighlightMode ( int  $a_nr,
string  $a_mode 
)

Set highlight mode single area.

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

627 : void {
628 $ma_nodes = $this->getMapAreaNodes(
629 $this->hier_id,
630 $this->purpose,
631 $this->getPcId()
632 );
633 if (is_object($ma_nodes[$a_nr - 1])) {
634 $ma_nodes[$a_nr - 1]->setAttribute("HighlightMode", $a_mode);
635 }
636 }

◆ setAreaIntLink()

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

Set link of area to an internal one.

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

555 : void {
556 $ma_nodes = $this->getMapAreaNodes(
557 $this->hier_id,
558 $this->purpose,
559 $this->getPcId()
560 );
561 if (is_object($ma_nodes[$a_nr - 1])) {
562 $title = $this->getTitleOfArea($a_nr);
563 $this->dom_util->deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
564 $attributes = array("Type" => $a_type, "Target" => $a_target,
565 "TargetFrame" => $a_target_frame);
566 $this->dom_util->setFirstOptionalElement(
567 $ma_nodes[$a_nr - 1],
568 "IntLink",
569 array(""),
570 $title,
571 $attributes
572 );
573 }
574 }

◆ setAreaTitle()

ilMediaAliasItem::setAreaTitle ( int  $a_nr,
string  $a_title 
)

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

532 : void {
533 $ma_nodes = $this->getMapAreaNodes(
534 $this->hier_id,
535 $this->purpose,
536 $this->getPcId()
537 );
538 if (is_object($ma_nodes[$a_nr - 1])) {
539 $childs = $ma_nodes[$a_nr - 1]->childNodes;
540 if (is_object($childs[0]) &&
541 ($childs[0]->nodeName == "IntLink" || $childs[0]->nodeName == "ExtLink")) {
542 $childs[0]->nodeValue = $a_title;
543 }
544 }
545 }

◆ setCaption()

ilMediaAliasItem::setCaption ( string  $a_caption)

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

244 : void
245 {
246 $this->dom_util->setFirstOptionalElement(
247 $this->getItemNode(),
248 "Caption",
249 array("TextRepresentation", "Parameter", "MapArea"),
250 $a_caption,
251 array("Align" => "bottom")
252 );
253 }

Referenced by PCMediaObjectTest\testCaption(), and PCMediaObjectTest\testDeriveCaption().

+ Here is the caller graph for this function:

◆ setHeight()

ilMediaAliasItem::setHeight ( string  $a_height)

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

217 : void
218 {
219 $this->dom_util->setFirstOptionalElement(
220 $this->getItemNode(),
221 "Layout",
222 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
223 "",
224 array("Height" => $a_height),
225 false
226 );
227 }

Referenced by PCMediaObjectTest\testDeriveSize(), and PCMediaObjectTest\testHeight().

+ Here is the caller graph for this function:

◆ setHorizontalAlign()

ilMediaAliasItem::setHorizontalAlign ( string  $a_halign)

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

363 : void
364 {
365 $this->dom_util->setFirstOptionalElement(
366 $this->getItemNode(),
367 "Layout",
368 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
369 "",
370 array("HorizontalAlign" => $a_halign),
371 false
372 );
373 }

Referenced by PCMediaObjectTest\testHorizontalAlign().

+ Here is the caller graph for this function:

◆ setParameters()

ilMediaAliasItem::setParameters ( array  $a_par_array)

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

390 : void
391 {
392 $par_nodes = $this->getParameterNodes(
393 $this->hier_id,
394 $this->purpose,
395 $this->getPcId()
396 );
397 for ($i = 0; $i < count($par_nodes); $i++) {
398 $par_node = $par_nodes[$i];
399 $par_node->unlink_node($par_node);
400 }
401
402 if (is_array($a_par_array)) {
403 foreach ($a_par_array as $par => $val) {
404 if (ilMediaItem::checkParameter($par, $val)) {
405 $attributes = array("Name" => $par, "Value" => $val);
406 $this->dom_util->addElementToList(
407 $this->getItemNode(),
408 "Parameter",
409 array("MapArea"),
410 "",
411 $attributes
412 );
413 }
414 }
415 }
416 }
static checkParameter(string $a_par, string $a_val)
Check parameter (filter javascript related and other unsafe parameters/values)

References ilMediaItem\checkParameter().

Referenced by PCMediaObjectTest\testDeriveParameters(), and PCMediaObjectTest\testParameters().

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

◆ setPcId()

ilMediaAliasItem::setPcId ( string  $a_pcid)

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

113 : void
114 {
115 $this->pcid = $a_pcid;
116 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setShape()

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

Set shape and coords of single area.

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

609 : void {
610 $ma_nodes = $this->getMapAreaNodes(
611 $this->hier_id,
612 $this->purpose,
613 $this->getPcId()
614 );
615 if (is_object($ma_nodes[$a_nr - 1])) {
616 $ma_nodes[$a_nr - 1]->setAttribute("Shape", $a_shape_type);
617 $ma_nodes[$a_nr - 1]->setAttribute("Coords", $a_coords);
618 }
619 }

◆ setTextRepresentation()

ilMediaAliasItem::setTextRepresentation ( string  $a_text_representation)

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

305 : void {
306 $this->dom_util->setFirstOptionalElement(
307 $this->getItemNode(),
308 "TextRepresentation",
309 array("Parameter", "MapArea"),
310 $a_text_representation,
311 array()
312 );
313 }

Referenced by PCMediaObjectTest\testDeriveTextRepresentation(), and PCMediaObjectTest\testTextRepresentation().

+ Here is the caller graph for this function:

◆ setWidth()

ilMediaAliasItem::setWidth ( string  $a_width)

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

151 : void
152 {
153 $this->dom_util->setFirstOptionalElement(
154 $this->getItemNode(),
155 "Layout",
156 array("Caption", "TextRepresentation", "Parameter", "MapArea"),
157 "",
158 array("Width" => $a_width),
159 false
160 );
161 }

Referenced by PCMediaObjectTest\testDeriveSize(), and PCMediaObjectTest\testWidth().

+ Here is the caller graph for this function:

Field Documentation

◆ $dom_doc

DOMDocument ilMediaAliasItem::$dom_doc
protected

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

◆ $dom_util

ILIAS COPage Dom DomUtil ilMediaAliasItem::$dom_util
protected

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

◆ $hier_id

string ilMediaAliasItem::$hier_id = ""

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

◆ $item_node

DOMNode ilMediaAliasItem::$item_node = null

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

Referenced by getItemNode().

◆ $lng

ilLanguage ilMediaAliasItem::$lng
protected

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

◆ $parent_node_name

string ilMediaAliasItem::$parent_node_name
protected

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

◆ $pcid

string ilMediaAliasItem::$pcid
protected

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

◆ $purpose

string ilMediaAliasItem::$purpose = ""

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


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