Public Member Functions | Data Fields

ilMediaAliasItem Class Reference

Public Member Functions

 ilMediaAliasItem (&$a_dom, $a_hier_id, $a_purpose)
 exists ()
 check if item node exists
 insert ()
 inserts new node in dom
 setWidth ($a_width)
 getWidth ()
 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)
 getHeight ()
 setCaption ($a_caption)
 getCaption ()
 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)
 setHorizontalAlign ($a_halign)
 getHorizontalAlign ()
 setParameters ($a_par_array)
 set parameter
 getParameterString ()
 get all parameters
 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)
 delete ()
 delete full item node from dom

Data Fields

 $dom
 $hier_id
 $purpose
 $item_node

Detailed Description

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


Member Function Documentation

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Caption";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) > 0)
                {
                        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 308 of file class.ilMediaAliasItem.php.

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Parameter";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) > 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 117 of file class.ilMediaAliasItem.php.

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Layout";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $layout_node =& $res->nodeset[0];
                        return $layout_node->has_attribute("Width");
                }
                return false;
        }

Here is the call graph for this function:

ilMediaAliasItem::delete (  ) 

delete full item node from dom

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

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

ilMediaAliasItem::deriveCaption (  ) 

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

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Caption";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) > 0)
                {
                        $caption_node =& $res->nodeset[0];
                        $caption_node->unlink_node($caption_node);
                }
        }

Here is the call graph for this function:

ilMediaAliasItem::deriveParameters (  ) 

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

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

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

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

Here is the call graph for this function:

ilMediaAliasItem::deriveSize (  ) 

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

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Layout";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $layout_node =& $res->nodeset[0];
                        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:

ilMediaAliasItem::exists (  ) 

check if item node exists

Returns:
boolean returns true if item node exists

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

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

ilMediaAliasItem::getCaption (  ) 

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Caption";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $caption_node =& $res->nodeset[0];
                        return $caption_node->get_content();
                }
        }

Here is the call graph for this function:

ilMediaAliasItem::getHeight (  ) 

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Layout";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $layout_node =& $res->nodeset[0];
                        return $layout_node->get_attribute("Height");
                }
        }

Here is the call graph for this function:

ilMediaAliasItem::getHorizontalAlign (  ) 

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Layout";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $layout_node =& $res->nodeset[0];
                        return $layout_node->get_attribute("HorizontalAlign");
                }
        }

Here is the call graph for this function:

ilMediaAliasItem::getParameter ( a_name  ) 

get a single parameter

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

        {
        }

ilMediaAliasItem::getParameterString (  ) 

get all parameters

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Parameter";
                $res =& xpath_eval($xpc, $path);
                $par_arr = array();
                for($i=0; $i < count($res->nodeset); $i++)
                {
                        $par_node =& $res->nodeset[$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:

ilMediaAliasItem::getWidth (  ) 

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose."']/Layout";
                $res =& xpath_eval($xpc, $path);
                if (count($res->nodeset) == 1)
                {
                        $layout_node =& $res->nodeset[0];
                        return $layout_node->get_attribute("Width");
                }
        }

Here is the call graph for this function:

ilMediaAliasItem::ilMediaAliasItem ( &$  a_dom,
a_hier_id,
a_purpose 
)

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

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

        {
                $this->dom =& $a_dom;
                $this->hier_id = $a_hier_id;
                $this->purpose = $a_purpose;

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

Here is the call graph for this function:

ilMediaAliasItem::insert (  ) 

inserts new node in dom

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

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

        {
                $xpc = xpath_new_context($this->dom);
                $path = "//PageContent[@HierId = '".$this->hier_id."']/MediaObject";
                $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:

ilMediaAliasItem::setCaption ( a_caption  ) 

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

References ilDOMUtil::setFirstOptionalElement().

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

Here is the call graph for this function:

ilMediaAliasItem::setHeight ( a_height  ) 

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

References ilDOMUtil::setFirstOptionalElement().

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

Here is the call graph for this function:

ilMediaAliasItem::setHorizontalAlign ( a_halign  ) 

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

References ilDOMUtil::setFirstOptionalElement().

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

Here is the call graph for this function:

ilMediaAliasItem::setParameters ( a_par_array  ) 

set parameter

note: parameter tags are simply appended to the item node, so if current element definition (MediaAliasItem (Layout?, Caption?, Parameter*)>) changes, adoptions may be necessary

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

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

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

                if (is_array($a_par_array))
                {
                        foreach($a_par_array as $par => $val)
                        {
                                $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:

ilMediaAliasItem::setWidth ( a_width  ) 

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

References ilDOMUtil::setFirstOptionalElement().

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

Here is the call graph for this function:


Field Documentation

ilMediaAliasItem::$dom

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

ilMediaAliasItem::$hier_id

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

ilMediaAliasItem::$item_node

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

Referenced by insert().

ilMediaAliasItem::$purpose

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


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