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 | |
Definition at line 36 of file class.ilLocatorGUI.php.
| ilLocatorGUI::ilLocatorGUI | ( | $ | a_display_frame = true |
) |
| ilLocatorGUI::navigate | ( | $ | newLocLevel, | |
| $ | newLocName, | |||
| $ | newLocLink, | |||
| $ | newLocTarget | |||
| ) |
Manage array of navigation links Calling NAVIGATE will update the $locator_data array.
| int | $newLocLevel level of new entry in tree | |
| string | $newLocName name of new page | |
| string | $newLocLink link to new page |
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.
| void | - - |
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();
}
}
| 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().
1.7.1