Public Member Functions | Data Fields

ilLocatorGUI Class Reference

Public Member Functions

 ilLocatorGUI ($a_display_frame=true)
 Constructor

  • - - - -.

 navigate ($newLocLevel, $newLocName, $newLocLink, $newLocTarget)
 Manage array of navigation links Calling NAVIGATE will update the $locator_data array.
 output ()
 Generate locator.

Data Fields

 $tpl
 $lng
 $locator_data
 $locator_level
 $display_frame
 indicates if the locator bar is displayed in a frame environment or not

Detailed Description

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


Member Function Documentation

ilLocatorGUI::ilLocatorGUI ( a_display_frame = true  ) 

Constructor

  • - - - -.

Parameters:
void --
Returns:
void --

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

References $lng, and $tpl.

        {
                global $tpl, $lng;

                $this->tpl              =& $tpl;
                $this->lng              =& $lng;        
                $this->display_frame = $a_display_frame;
        }

ilLocatorGUI::navigate ( newLocLevel,
newLocName,
newLocLink,
newLocTarget 
)

Manage array of navigation links Calling NAVIGATE will update the $locator_data array.

Parameters:
int $newLocLevel level of new entry in tree
string $newLocName name of new page
string $newLocLink link to new page
Returns:
void - - Author: Arjan Ammerlaan, IngMedia, FH-Aachen, 17.10.2003

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

References $_SESSION.

        {
                if ($newLocLevel > -1)
                {
                        // update local variables
                        if ($this->display_frame) {
                                $this->locator_data             = $_SESSION["locator_data"];
                                $this->locator_level    = $_SESSION["locator_level"];
                        }
                        // navigate: check whether links should be deleted or added / updated
                        if ($newLocLevel < $this->locator_level)
                        {
                                // remove link(s) of deeper levels (clean up array when leap-frogging ;)
                                for ($i = $this->locator_level ; $i >= $newLocLevel ; $i --)
                                {
                                        $this->locator_data[$i][0] = "";
                                        $this->locator_data[$i][1] = "";
                                        $this->locator_data[$i][2] = "";
                                }
                        }
                        // add current link or update
                        $this->locator_data[$newLocLevel][0] = $newLocName;
                        $this->locator_data[$newLocLevel][1] = $newLocLink;
                        $this->locator_data[$newLocLevel][2] = $newLocTarget;
                        
                        // set level current
                        $this->locator_level = $newLocLevel;
                        
                        // update session variables
                        if ($this->display_frame) {
                                $_SESSION["locator_data"] = $this->locator_data;
                                $_SESSION["locator_level"] = $this->locator_level;
                        }
                }
        }

ilLocatorGUI::output (  ) 

Generate locator.

Parameters:
void - -
Returns:
void - - Author: Arjan Ammerlaan, IngMedia, FH-Aachen, 17.10.2003

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

References $_SESSION.

        {
                // update local variables
                if ($this->display_frame) {
                        $this->locator_data             = $_SESSION["locator_data"];
                        $this->locator_level    = $_SESSION["locator_level"];
                }
                                
                // select the template
                if ($this->display_frame) {
                        $this->tpl = new ilTemplate("tpl.locator_frame.html", true, true);
                } else {
                        $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
                }

                // locator title
                $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));             


                // walk through array and generate locator
                if ($this->locator_level < 0)
                {
                        $this->tpl->setCurrentBlock("locator_text");
                        $this->tpl->setVariable("ITEM", " - ERROR Locator array empty! -");             //  ######## LANG FILE ENTRY ###########                

                        $this->tpl->parseCurrentBlock();
                }
                else 
                {
                        for ($i = 0 ; $i <= $this->locator_level ; $i ++) 
                        {
                                // generate links, skip empty links
                                if ( ($this->locator_data[$i][0] != "") & ($this->locator_data[$i][1] != "") )
                                {       
                                        // locator entry
                                        if ($i == $this->locator_level)
                                        {
                                                if ($this->display_frame) {
                                                        $this->tpl->setCurrentBlock("locator_text");
                                                        $this->tpl->setVariable("ITEM", $this->locator_data[$i][0]);
                                                        $this->tpl->parseCurrentBlock("locator_text");
                                                } else {
                                                        $this->tpl->setCurrentBlock("locator_text");
                                                        $this->tpl->setVariable("ITEM", $this->locator_data[$i][0]);
                                                        $this->tpl->setVariable("LINK_ITEM", $this->locator_data[$i][1]);
                                                        $this->tpl->setVariable("LINK_TARGET", $this->locator_data[$i][2]);
                                                        $this->tpl->parseCurrentBlock("locator_text");
                                                }
                                        }
                                        else
                                        {
                                                if ($this->display_frame) {
                                                        $this->tpl->setCurrentBlock("locator_link");
                                                        $this->tpl->setVariable("ITEM", $this->locator_data[$i][0]);
                                                        $this->tpl->setVariable("LINK_ITEM", $this->locator_data[$i][1]);
                                                        $this->tpl->setVariable("LINK_TARGET", $this->locator_data[$i][2]);
                                                        $this->tpl->parseCurrentBlock("locator_link");
                                                } else {
                                                        $this->tpl->touchBlock("locator_separator");
                                                        $this->tpl->setCurrentBlock("locator_item");
                                                        $this->tpl->setVariable("ITEM", $this->locator_data[$i][0]);
                                                        $this->tpl->setVariable("LINK_ITEM", $this->locator_data[$i][1]);
                                                        $this->tpl->setVariable("LINK_TARGET", $this->locator_data[$i][2]);
                                                        $this->tpl->parseCurrentBlock("locator_item");
                                                }
                                        }
                                }
                        }
                }
                
                // output
                if ($this->display_frame) {
                        $this->tpl->show();
                }
        }


Field Documentation

ilLocatorGUI::$display_frame

indicates if the locator bar is displayed in a frame environment or not

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

ilLocatorGUI::$lng

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

Referenced by ilLocatorGUI().

ilLocatorGUI::$locator_data

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

ilLocatorGUI::$locator_level

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

ilLocatorGUI::$tpl

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

Referenced by ilLocatorGUI().


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