Public Member Functions | Protected Attributes

ilLocatorGUI Class Reference

locator handling class More...

Public Member Functions

 ilLocatorGUI ()
 Constructor.
 setTextOnly ($a_textonly)
 Set Only text, no HTML.
 setOffline ($a_offline)
 getOffline ()
 getTextOnly ()
 Get Only text, no HTML.
 addRepositoryItems ($a_ref_id=0)
 add repository item
 addAdministrationItems ($a_ref_id=0)
 add administration tree items
 addContextItems ($a_ref_id, $a_omit_node=false, $a_stop=0)
 addItem ($a_title, $a_link, $a_frame="", $a_ref_id=0)
 add locator item
 clearItems ()
 Clear all Items.
 getItems ()
 Get all locator entries.
 getHTML ()
 Get locator HTML.

Protected Attributes

 $lng
 $entries

Detailed Description

locator handling class

This class supplies an implementation for the locator. The locator will send its output to ist own frame, enabling more flexibility in the design of the desktop.

Author:
Arjan Ammerlaan <a.l.ammerlaan@web.de>
Version:
Id:
class.ilLocatorGUI.php 15498 2007-12-05 14:37:40Z akill

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


Member Function Documentation

ilLocatorGUI::addAdministrationItems ( a_ref_id = 0  ) 

add administration tree items

Parameters:
int $a_ref_id current ref id (optional); if empty $_GET["ref_id"] is used

Definition at line 134 of file class.ilLocatorGUI.php.

References $_GET, $ilCtrl, $lng, and addItem().

        {
                global $tree, $ilCtrl, $objDefinition, $lng;

                if ($a_ref_id == 0)
                {
                        $a_ref_id = $_GET["ref_id"];
                }

                if ($a_ref_id > 0)
                {
                        $path = $tree->getPathFull($a_ref_id);
                        
                        // add item for each node on path
                        foreach ($path as $key => $row)
                        {
                                if (!in_array($row["type"], array("root", "cat", "crs", "fold", "grp", "icrs")))
                                {
                                        continue;
                                }
                                
                                if ($row["child"] == ROOT_FOLDER_ID)
                                {
                                        $row["title"] = $lng->txt("repository"); 
                                }
                                
                                $class_name = $objDefinition->getClassName($row["type"]);
                                $class = strtolower("ilObj".$class_name."GUI");
                                $ilCtrl->setParameterByClass($class, "ref_id", $row["child"]);
                                $this->addItem($row["title"],
                                        $ilCtrl->getLinkTargetbyClass($class, "view"), "", $row["child"]);
                        }
                }
        }

Here is the call graph for this function:

ilLocatorGUI::addContextItems ( a_ref_id,
a_omit_node = false,
a_stop = 0 
)

Definition at line 169 of file class.ilLocatorGUI.php.

References addItem().

        {
                global $tree;
                
                if ($a_ref_id > 0)
                {
                        $path = $tree->getPathFull($a_ref_id);
                        
                        // we want to show the full path, from the major container to the item
                        // (folders are not! treated as containers here), at least one parent item
                        $r_path = array_reverse($path);
                        $first = "";
                        $omit = array();
                        $do_omit = false;
                        foreach ($r_path as $key => $row)
                        {
                                if ($first == "")
                                {
                                        if (in_array($row["type"], array("root", "cat", "grp", "crs")) &&
                                                $row["child"] != $a_ref_id)
                                        {
                                                $first = $row["child"];
                                        }
                                }
                                if ($a_stop == $row["child"])
                                {
                                        $do_omit = true;
                                }
                                $omit[$row["child"]] = $do_omit;
                        }

                        $add_it = false;
                        foreach ($path as $key => $row)
                        {
                                if ($first == $row["child"])
                                {
                                        $add_it = true;
                                }
                                
                                
                                if ($add_it && !$omit[$row["child"]] &&
                                        (!$a_omit_node || ($row["child"] != $a_ref_id)))
                                {
//echo "-".ilObject::_lookupTitle($row["obj_id"])."-";
                                        if ($row["title"] == "ILIAS" && $row["type"] == "root")
                                        {
                                                $row["title"] = $this->lng->txt("repository");
                                        }
                                        $this->addItem($row["title"],
                                                "./goto.php?client_id=".rawurlencode(CLIENT_ID)."&target=".$row["type"]."_".$row["child"],
                                                "_top", $row["child"]);
                                }
                        }
                }
        }

Here is the call graph for this function:

ilLocatorGUI::addItem ( a_title,
a_link,
a_frame = "",
a_ref_id = 0 
)

add locator item

Parameters:
string $a_title item title
string $a_link item link
string $a_frame frame target

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

Referenced by addAdministrationItems(), addContextItems(), and addRepositoryItems().

        {
                $this->entries[] = array("title" => $a_title,
                        "link" => $a_link, "frame" => $a_frame, "ref_id" => $a_ref_id); 
        }

Here is the caller graph for this function:

ilLocatorGUI::addRepositoryItems ( a_ref_id = 0  ) 

add repository item

Parameters:
int $a_ref_id current ref id (optional); if empty $_GET["ref_id"] is used

Definition at line 90 of file class.ilLocatorGUI.php.

References $_GET, ilFrameTargetInfo::_getFrame(), and addItem().

        {
                global $tree;

                if ($a_ref_id == 0)
                {
                        $a_ref_id = $_GET["ref_id"];
                }
                
                $pre = "";
                if (defined("ILIAS_MODULE"))
                {
                        $pre = "../";
                }
                
                if ($a_ref_id > 0)
                {
                        $path = $tree->getPathFull($a_ref_id);
                        
                        // add item for each node on path
                        foreach ($path as $key => $row)
                        {
                                if (!in_array($row["type"], array("root", "cat","crs", "fold", "grp", "icrs")))
                                {
                                        continue;
                                }
                                if ($row["title"] == "ILIAS" && $row["type"] == "root")
                                {
                                        $row["title"] = $this->lng->txt("repository");
                                }
                                
                                $this->addItem($row["title"],
                                        $pre."repository.php?cmd=frameset&amp;ref_id=".$row["child"],
                                        ilFrameTargetInfo::_getFrame("MainContent"), $row["child"]);
                        }
                }
        }

Here is the call graph for this function:

ilLocatorGUI::clearItems (  ) 

Clear all Items.

Definition at line 241 of file class.ilLocatorGUI.php.

        {
                $this->entries = array();
        }

ilLocatorGUI::getHTML (  ) 

Get locator HTML.

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

References $ilSetting, $lng, ilObject::_getIcon(), ilObject::_lookupObjId(), ilObject::_lookupType(), getItems(), getOffline(), and getTextOnly().

        {
                global $lng, $ilSetting;
                
                if ($this->getTextOnly())
                {
                        $loc_tpl = new ilTemplate("tpl.locator_text_only.html", true, true);
                }
                else
                {
                        $loc_tpl = new ilTemplate("tpl.locator.html", true, true);
                }
                
                $items = $this->getItems();
                $first = true;

                if (is_array($items))
                {
                        foreach($items as $item)
                        {
                                if (!$first)
                                {
                                        $loc_tpl->touchBlock("locator_separator_prefix");
                                }
                                
                                if ($item["ref_id"] > 0)
                                {
                                        $obj_id = ilObject::_lookupObjId($item["ref_id"]);
                                        $type = ilObject::_lookupType($obj_id);
                                        
                                        $icon_path = ilObject::_getIcon($obj_id, "tiny", $type,
                                                $this->getOffline());
                                        
                                        $loc_tpl->setCurrentBlock("locator_img");                                       
                                        $loc_tpl->setVariable("IMG_SRC", $icon_path);
                                        $loc_tpl->setVariable("IMG_ALT",
                                                $lng->txt("obj_".$type));
                                        $loc_tpl->parseCurrentBlock();
                                }
                                
                                $loc_tpl->setCurrentBlock("locator_item");
                                if ($item["link"] != "")
                                {
                                        $loc_tpl->setVariable("LINK_ITEM", $item["link"]);
                                        if ($item["frame"] != "")
                                        {
                                                $loc_tpl->setVariable("LINK_TARGET", ' target="'.$item["frame"].'" ');
                                        }
                                        $loc_tpl->setVariable("ITEM", $item["title"]);
                                }
                                else
                                {
                                        $loc_tpl->setVariable("PREFIX", $item["title"]);
                                }
                                $loc_tpl->parseCurrentBlock();
                                
                                $first = false;
                        }
                }
                else
                {
                        $loc_tpl->setVariable("NOITEM", "&nbsp;");
                        $loc_tpl->touchBlock("locator");
                }
                
                return trim($loc_tpl->get());
        }

Here is the call graph for this function:

ilLocatorGUI::getItems (  ) 

Get all locator entries.

Definition at line 249 of file class.ilLocatorGUI.php.

Referenced by getHTML().

        {
                return $this->entries;
        }

Here is the caller graph for this function:

ilLocatorGUI::getOffline (  ) 

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

Referenced by getHTML().

        {
                return $this->offline;
        }

Here is the caller graph for this function:

ilLocatorGUI::getTextOnly (  ) 

Get Only text, no HTML.

Returns:
boolean Only text, no HTML

Definition at line 79 of file class.ilLocatorGUI.php.

Referenced by getHTML().

        {
                return $this->textonly;
        }

Here is the caller graph for this function:

ilLocatorGUI::ilLocatorGUI (  ) 

Constructor.

Definition at line 44 of file class.ilLocatorGUI.php.

References $lng, and setTextOnly().

        {
                global $lng;

                $this->lng =& $lng;     
                $this->entries = array();
                $this->setTextOnly(false);
                $this->offline = false;
        }

Here is the call graph for this function:

ilLocatorGUI::setOffline ( a_offline  ) 

Definition at line 64 of file class.ilLocatorGUI.php.

        {
                $this->offline = $a_offline;
        }

ilLocatorGUI::setTextOnly ( a_textonly  ) 

Set Only text, no HTML.

Parameters:
boolean $a_textonly Only text, no HTML

Definition at line 59 of file class.ilLocatorGUI.php.

Referenced by ilLocatorGUI().

        {
                $this->textonly = $a_textonly;
        }

Here is the caller graph for this function:


Field Documentation

ilLocatorGUI::$entries [protected]

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

ilLocatorGUI::$lng [protected]

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

Referenced by addAdministrationItems(), getHTML(), and ilLocatorGUI().


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