ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMediaAliasItem Class Reference

Class ilMediaAliasItem. More...

+ Collaboration diagram for ilMediaAliasItem:

Public Member Functions

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

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:
class.ilMediaAliasItem.php 51579 2014-07-18 17:14:47Z akill

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

Member Function Documentation

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

Add a new area to the map.

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

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

{
$attributes = array("Shape" => $a_shape_type,
"Coords" => $a_coords, "Id" => $a_id);
$ma_node = ilDOMUtil::addElementToList($this->dom, $this->item_node,
"MapArea", array(), "", $attributes);
if ($a_link["LinkType"] == "int" || $a_link["LinkType"] == "IntLink")
{
$attributes = array("Type" => $a_link["Type"],
"TargetFrame" => $a_link["TargetFrame"],
"Target" => $a_link["Target"]);
ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "IntLink",
array(""), $a_title, $attributes);
}
if ($a_link["LinkType"] == "ext" || $a_link["LinkType"] == "ExtLink")
{
$attributes = array("Href" => $a_link["Href"]);
ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "ExtLink",
array(""), $a_title, $attributes);
}
}

+ Here is the call graph for this function:

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.

References getMAItemNode(), and getPcId().

{
$caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Caption");
if (is_object($caption_node))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilMediaAliasItem::definesParameters ( )

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

Returns
boolean returns true if parameters are not derived from object

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

References getParameterNodes(), and getPcId().

{
$par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (count($par_nodes) > 0)
{
return true;
}
return false;
}

+ Here is the call graph for this function:

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.

References getMAItemNode(), and getPcId().

{
$layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Layout");
if (is_object($layout_node))
{
return $layout_node->has_attribute("Width");
}
return false;
}

+ Here is the call graph for this function:

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.

References getMAItemNode(), and getPcId().

{
$text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/TextRepresentation");
if (is_object($text_representation_node))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilMediaAliasItem::delete ( )

delete full item node from dom

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

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
if (is_object($this->item_node))
{
$this->item_node->unlink_node($this->item_node);
}
}

+ Here is the caller graph for this function:

ilMediaAliasItem::deleteAllMapAreas ( )

Delete all map areas.

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

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

{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$this->hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='".$this->purpose."']/MapArea";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++)
{
$res->nodeset[$i]->unlink_node($res->nodeset[$i]);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::deleteMapArea (   $a_nr)

Delete a sinlge map area.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::deleteMapAreaById (   $a_id)

Delete map areas by id.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
foreach ($ma_nodes as $node)
{
if ($node->get_attribute("Id") == $a_id)
{
$node->unlink_node($node);
}
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::deriveCaption ( )

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

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Caption");
if (is_object($caption_node))
{
$caption_node->unlink_node($caption_node);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::deriveParameters ( )

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

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

References getParameterNodes(), and getPcId().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (count($par_nodes) > 0)
{
for($i=0; $i < count($par_nodes); $i++)
{
$par_node =& $par_nodes[$i];
$par_node->unlink_node($par_node);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::deriveSize ( )

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

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Layout");
if (is_object($layout_node))
{
if ($layout_node->has_attribute("Width"))
{
$layout_node->remove_attribute("Width");
}
if ($layout_node->has_attribute("Height"))
{
$layout_node->remove_attribute("Height");
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::deriveTextRepresentation ( )

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

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/TextRepresentation");
if (is_object($text_representation_node))
{
$text_representation_node->unlink_node($text_representation_node);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::exists ( )

check if item node exists

Returns
boolean returns true if item node exists

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

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
if (is_object($this->item_node))
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

ilMediaAliasItem::getCaption ( )

Get Caption.

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\getAliasValues().

{
$caption_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Caption");
if (is_object($caption_node))
{
return $caption_node->get_content();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getHeight ( )

Get Height.

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\getAliasValues(), ilPCMediaObjectGUI\initAliasForm(), and makeMapWorkCopy().

{
$layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Layout");
if (is_object($layout_node))
{
return $layout_node->get_attribute("Height");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getHorizontalAlign ( )

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

References getMAItemNode(), and getPcId().

{
$layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Layout");
if (is_object($layout_node))
{
return $layout_node->get_attribute("HorizontalAlign");
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::getHrefOfArea (   $a_nr)

Get href (only external link)

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
return $childs[0]->get_attribute("Href");
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::getLinkTypeOfArea (   $a_nr)

Get link type.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
if ($childs[0]->node_name() == "IntLink")
{
return "int";
}
if ($childs[0]->node_name() == "ExtLink")
{
return "ext";
}
}
}

+ Here is the call graph for this function:

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

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

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

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

{
if ($a_pc_id != "")
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
return $res->nodeset[0];
}
}
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
return $res->nodeset[0];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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().

{
if ($a_pc_id != "")
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
return $res->nodeset;
}
return array();
}
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
return $res->nodeset;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getMapAreas ( )

Get all map areas.

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

References getMapAreaNodes(), and getPcId().

Referenced by ilPCImageMapTableGUI\getItems(), and makeMapWorkCopy().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
$maparea_arr = array();
for($i=0; $i < count($ma_nodes); $i++)
{
$maparea_node = $ma_nodes[$i];
$childs = $maparea_node->child_nodes();
$link = array();
if ($childs[0]->node_name() == "ExtLink")
{
$link = array("LinkType" => "ExtLink",
"Href" => $childs[0]->get_attribute("Href"),
"Title" => $childs[0]->get_content());
}
if ($childs[0]->node_name() == "IntLink")
{
$link = array("LinkType" => "IntLink",
"Target" => $childs[0]->get_attribute("Target"),
"Type" => $childs[0]->get_attribute("Type"),
"TargetFrame" => $childs[0]->get_attribute("TargetFame"),
"Title" => $childs[0]->get_content());
}
$maparea_arr[] = array(
"Nr" => $i + 1,
"Shape" => $maparea_node->get_attribute("Shape"),
"Coords" => $maparea_node->get_attribute("Coords"),
"HighlightMode" => $maparea_node->get_attribute("HighlightMode"),
"HighlightClass" => $maparea_node->get_attribute("HighlightClass"),
"Id" => $maparea_node->get_attribute("Id"),
"Link" => $link);
}
return $maparea_arr;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getParameter (   $a_name)

get a single parameter

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

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

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

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

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

{
if ($a_pc_id != "")
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@PCID = '".$a_pc_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
return $res->nodeset;
}
return array();
}
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$a_hier_id."']/".$this->parent_node_name."/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
return $res->nodeset;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getParameters ( )

Get all parameters as array.

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

References getParameterNodes(), and getPcId().

Referenced by ilPCMediaObjectGUI\initAliasForm().

{
$par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
$this->getPcId());
$par_arr = array();
for($i=0; $i < count($par_nodes); $i++)
{
$par_node =& $par_nodes[$i];
$par_arr[$par_node->get_attribute("Name")] =
$par_node->get_attribute("Value");
}
return $par_arr;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getParameterString ( )

Get all parameters as string.

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

References getParameterNodes(), and getPcId().

Referenced by ilPCMediaObjectGUI\getAliasValues().

{
$par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
$this->getPcId());
$par_arr = array();
for($i=0; $i < count($par_nodes); $i++)
{
$par_node =& $par_nodes[$i];
$par_arr[] = $par_node->get_attribute("Name")."=\"".$par_node->get_attribute("Value")."\"";
}
return implode($par_arr, ", ");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getTargetFrameOfArea (   $a_nr)

Get target frame (only interna link.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
return $childs[0]->get_attribute("TargetFrame");
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::getTargetOfArea (   $a_nr)

Get target (only interna link.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
return $childs[0]->get_attribute("Target");
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::getTextRepresentation ( )

Get TextRepresentation.

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\getAliasValues().

{
$text_representation_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/TextRepresentation");
if (is_object($text_representation_node))
{
return $text_representation_node->get_content();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getTitleOfArea (   $a_nr)

Get title.

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

References getMapAreaNodes(), and getPcId().

Referenced by setAreaExtLink(), and setAreaIntLink().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
return $childs[0]->get_content();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::getTypeOfArea (   $a_nr)

Get type (only interna link.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
return $childs[0]->get_attribute("Type");
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::getWidth ( )

Get width.

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

References getMAItemNode(), and getPcId().

Referenced by ilPCMediaObjectGUI\getAliasValues(), and makeMapWorkCopy().

{
$layout_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId(), "/Layout");
if (is_object($layout_node))
{
return $layout_node->get_attribute("Width");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

{
$this->dom =& $a_dom;
$this->parent_node_name = $a_parent_node_name;
$this->hier_id = $a_hier_id;
$this->purpose = $a_purpose;
$this->setPcId($a_pc_id);
$this->item_node = $this->getMAItemNode($this->hier_id, $this->purpose,
$this->getPcId());
}

+ Here is the call graph for this function:

ilMediaAliasItem::insert ( )

inserts new node in dom

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

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

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$this->hier_id."']/".$this->parent_node_name;
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
$obj_node =& $res->nodeset[0];
$item_node =& $this->dom->create_element("MediaAliasItem");
$item_node =& $obj_node->append_child($item_node);
$item_node->set_attribute("Purpose", $this->purpose);
$this->item_node =& $item_node;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

make map work copy of image

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

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

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

Referenced by ilPCImageMapEditorGUI\makeMapWorkCopy().

{
global $lng;
if (!$a_st_item->copyOriginal())
{
return false;
}
$a_st_item->buildMapWorkImage();
// determine ratios (first see whether the instance has w/h defined)
$width = $this->getWidth();
$height = $this->getHeight();
// if instance has no size, use object w/h
if ($width == 0 && $height == 0)
{
$width = $a_st_item->getWidth();
$height = $a_st_item->getHeight();
}
$size = @getimagesize($a_st_item->getMapWorkCopyName());
$x_ratio = 1;
if ($size[0] > 0 && $width > 0)
{
$x_ratio = $width / $size[0];
}
$y_ratio = 1;
if ($size[1] > 0 && $height > 0)
{
$y_ratio = $height / $size[1];
}
// draw map areas
$areas = $this->getMapAreas();
for ($i=0; $i < count($areas); $i++)
{
if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
((($i+1) != $a_area_nr) && $a_exclude) ||
($a_area_nr == 0)
)
{
$area = new ilMapArea();
$area->setShape($areas[$i]["Shape"]);
$area->setCoords($areas[$i]["Coords"]);
$area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2, true,
$x_ratio, $y_ratio);
}
}
if ($a_output_new_area)
{
$area = new ilMapArea();
$area->setShape($a_area_type);
$area->setCoords($a_coords);
$area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2, false,
$x_ratio, $y_ratio);
}
$a_st_item->saveMapWorkImage();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setAreaExtLink (   $a_nr,
  $a_href 
)

Set link of area to an external one.

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

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

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$title = $this->getTitleOfArea($a_nr);
ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
$attributes = array("Href" => $a_href);
ilDOMUtil::setFirstOptionalElement($this->dom, $ma_nodes[$a_nr - 1], "ExtLink",
array(""), $title, $attributes);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::setAreaHighlightClass (   $a_nr,
  $a_class 
)

Set highlight class single area.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$ma_nodes[$a_nr - 1]->set_attribute("HighlightClass", $a_class);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::setAreaHighlightMode (   $a_nr,
  $a_mode 
)

Set highlight mode single area.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$ma_nodes[$a_nr - 1]->set_attribute("HighlightMode", $a_mode);
}
}

+ Here is the call graph for this function:

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

Set link of area to an internal one.

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

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

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$title = $this->getTitleOfArea($a_nr);
ilDOMUtil::deleteAllChildsByName($ma_nodes[$a_nr - 1], array("IntLink", "ExtLink"));
$attributes = array("Type" => $a_type, "Target" => $a_target,
"TargetFrame" => $a_target_frame);
ilDOMUtil::setFirstOptionalElement($this->dom, $ma_nodes[$a_nr - 1], "IntLink",
array(""), $title, $attributes);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::setAreaTitle (   $a_nr,
  $a_title 
)

Set title of area.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$childs = $ma_nodes[$a_nr - 1]->child_nodes();
if (is_object($childs[0]) &&
($childs[0]->node_name() == "IntLink" || $childs[0]->node_name() == "ExtLink"))
{
$childs[0]->set_content($a_title);
}
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::setCaption (   $a_caption)

Set Caption.

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

References ilDOMUtil\setFirstOptionalElement().

Referenced by ilPCMediaObjectGUI\saveAliasProperties(), and ilPCInteractiveImageGUI\update().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setHeight (   $a_height)

Set Height.

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

References ilDOMUtil\setFirstOptionalElement().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setHorizontalAlign (   $a_halign)

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

References ilDOMUtil\setFirstOptionalElement().

Referenced by ilPCInteractiveImageGUI\centerAlign(), ilPCMediaObjectGUI\centerAlign(), ilPCInteractiveImageGUI\leftAlign(), ilPCMediaObjectGUI\leftAlign(), ilPCInteractiveImageGUI\leftFloatAlign(), ilPCMediaObjectGUI\leftFloatAlign(), ilPCInteractiveImageGUI\rightAlign(), ilPCMediaObjectGUI\rightAlign(), ilPCInteractiveImageGUI\rightFloatAlign(), and ilPCMediaObjectGUI\rightFloatAlign().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setParameters (   $a_par_array)

set parameter

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

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

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

{
$par_nodes = $this->getParameterNodes($this->hier_id, $this->purpose,
$this->getPcId());
$par_arr = array();
for($i=0; $i < count($par_nodes); $i++)
{
$par_node =& $par_nodes[$i];
$par_node->unlink_node($par_node);
}
if (is_array($a_par_array))
{
foreach($a_par_array as $par => $val)
{
$attributes = array ("Name" => $par, "Value" => $val);
ilDOMUtil::addElementToList($this->dom, $this->item_node,
"Parameter", array("MapArea"), "", $attributes);
/* $par_node =& $this->dom->create_element("Parameter");
$par_node =& $this->item_node->append_child($par_node);
$par_node->set_attribute("Name", $par);
$par_node->set_attribute("Value", $val); */
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setPcId (   $a_pcid)

Set PC Id.

Parameters
string$a_pcidPC Id

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

Referenced by ilMediaAliasItem().

{
$this->pcid = $a_pcid;
}

+ Here is the caller graph for this function:

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

Set shape and coords of single area.

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

References getMapAreaNodes(), and getPcId().

{
$ma_nodes = $this->getMapAreaNodes($this->hier_id, $this->purpose,
$this->getPcId());
if (is_object($ma_nodes[$a_nr - 1]))
{
$ma_nodes[$a_nr - 1]->set_attribute("Shape", $a_shape_type);
$ma_nodes[$a_nr - 1]->set_attribute("Coords", $a_coords);
}
}

+ Here is the call graph for this function:

ilMediaAliasItem::setTextRepresentation (   $a_text_representation)

Set TextRepresentation.

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

References ilDOMUtil\setFirstOptionalElement().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMediaAliasItem::setWidth (   $a_width)

Set width.

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

References ilDOMUtil\setFirstOptionalElement().

Referenced by ilPCMediaObjectGUI\saveAliasProperties().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMediaAliasItem::$dom

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

ilMediaAliasItem::$hier_id

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

ilMediaAliasItem::$item_node

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

Referenced by insert().

ilMediaAliasItem::$purpose

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


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