/**
  * table of contents
  */
 function ilTOC($a_target)
 {
     require_once "./Modules/LearningModule/classes/class.ilLMTOCExplorer.php";
     if ($this->lm->cleanFrames()) {
         $a_target = "";
     }
     $exp = new ilLMTOCExplorer($this->getLink($this->lm->getRefId(), "layout", "", $a_target), $this->lm, $this->lang);
     $exp->setExpandTarget($this->getLink($this->lm->getRefId(), $_GET["cmd"], $_GET["obj_id"], $_GET["frame"]));
     $exp->setTargetGet("obj_id");
     if ($this->lm->cleanFrames()) {
         if ($this->offlineMode()) {
             $exp->setFrameTarget("_top");
         } else {
             $exp->setFrameTarget(ilFrameTargetInfo::_getFrame("MainContent"));
         }
     } else {
         $exp->setFrameTarget($a_target);
     }
     $exp->addFilter("du");
     $exp->addFilter("st");
     // force expansion
     if ($this->lm->cleanFrames()) {
         $page_id = $this->getCurrentPageId();
         if ($this->deactivated_page) {
             $page_id = $_GET["obj_id"];
         }
         if ($page_id > 0) {
             $path = $this->lm_tree->getPathId($page_id);
             $exp->setForceOpenPath($path);
         }
         if (!$this->offlineMode()) {
             // empty chapter
             if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
                 $exp->highlightNode($_GET["obj_id"]);
             } else {
                 if ($this->lm->getTOCMode() == "pages") {
                     if ($this->deactivated_page) {
                         $exp->highlightNode($_GET["obj_id"]);
                     } else {
                         $exp->highlightNode($page_id);
                     }
                 } else {
                     $exp->highlightNode($this->lm_tree->getParentId($page_id));
                 }
             }
         }
     }
     $exp->setOfflineMode($this->offlineMode());
     if ($this->lm->getTOCMode() == "pages") {
         $exp->addFilter("pg");
     }
     $exp->setFiltered(true);
     $exp->setFilterMode(IL_FM_POSITIVE);
     if ($_GET["lmexpand"] == "") {
         $expand_keys = array();
         if (is_array($_SESSION["lmexpand"])) {
             $expand_keys = array_keys($_SESSION["lmexpand"]);
         }
         $_SESSION["lmexpand"] = array($this->lm_tree->readRootId());
         $expanded = $this->lm_tree->readRootId();
     } else {
         $expanded = $_GET["lmexpand"];
     }
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     //		$this->renderPageTitle();
     // set explorer
     $this->tpl->setCurrentBlock("il_toc");
     $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("overview"));
     $this->tpl->setVariable("EXPLORER", $output);
     $this->tpl->setVariable("ACTION", $this->getLink($this->lm->getRefId(), $_GET["cmd"], "", $_GET["frame"]) . "&lmexpand=" . $_GET["lmexpand"]);
     $this->tpl->parseCurrentBlock();
     //		$this->tpl->parseCurrentBlock();
     if ($_GET["lmexpand"] == "") {
         // collapse all other branches on navigation
         foreach ($expand_keys as $k) {
             unset($_SESSION["lmexpand"][$k]);
         }
     }
     //var_dump($_SESSION["lmexpand"]);
 }
 /**
  * table of contents
  */
 function ilTOC($a_target)
 {
     global $ilBench;
     $ilBench->start("ContentPresentation", "ilTOC");
     require_once "./Modules/LearningModule/classes/class.ilLMTOCExplorer.php";
     if ($this->lm->cleanFrames()) {
         $a_target = "";
     }
     $exp = new ilLMTOCExplorer($this->getLink($this->lm->getRefId(), "layout", "", $a_target), $this->lm);
     $exp->setExpandTarget($this->getLink($this->lm->getRefId(), $_GET["cmd"], $_GET["obj_id"], $_GET["frame"]));
     $exp->setTargetGet("obj_id");
     if ($this->lm->cleanFrames()) {
         if ($this->offlineMode()) {
             $exp->setFrameTarget("_top");
         } else {
             $exp->setFrameTarget(ilFrameTargetInfo::_getFrame("MainContent"));
         }
     } else {
         $exp->setFrameTarget($a_target);
     }
     $exp->addFilter("du");
     $exp->addFilter("st");
     // force expansion
     if ($this->lm->cleanFrames()) {
         $page_id = $this->getCurrentPageId();
         if ($this->deactivated_page) {
             $page_id = $_GET["obj_id"];
         }
         if ($page_id > 0) {
             $path = $this->lm_tree->getPathId($page_id);
             $exp->setForceOpenPath($path);
         }
         if (!$this->offlineMode()) {
             // empty chapter
             if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
                 $exp->highlightNode($_GET["obj_id"]);
             } else {
                 if ($this->lm->getTOCMode() == "pages") {
                     if ($this->deactivated_page) {
                         $exp->highlightNode($_GET["obj_id"]);
                     } else {
                         $exp->highlightNode($page_id);
                     }
                 } else {
                     $exp->highlightNode($this->lm_tree->getParentId($page_id));
                 }
             }
         }
     }
     $exp->setOfflineMode($this->offlineMode());
     if ($this->lm->getTOCMode() == "pages") {
         $exp->addFilter("pg");
     }
     $exp->setFiltered(true);
     $exp->setFilterMode(IL_FM_POSITIVE);
     if ($_GET["lmexpand"] == "") {
         $expand_keys = array();
         if (is_array($_SESSION["lmexpand"])) {
             $expand_keys = array_keys($_SESSION["lmexpand"]);
         }
         $_SESSION["lmexpand"] = array($this->lm_tree->readRootId());
         $expanded = $this->lm_tree->readRootId();
     } else {
         $expanded = $_GET["lmexpand"];
     }
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     //		$this->renderPageTitle();
     // set style sheets
     /*
     		if (!$this->offlineMode())
     		{
     			$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     		}
     		else
     		{
     			$style_name = $this->ilias->account->prefs["style"].".css";;
     			$this->tpl->setVariable("LOCATION_STYLESHEET","./style/".$style_name);
     		}*/
     if (!$this->offlineMode()) {
         //			$this->tpl->addBlockFile("EXPL_TOP", "exp_top", "tpl.explorer_top.html");
         //$this->tpl->setVariable("DUMMY", " ");
         //			$this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
     }
     $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("overview"));
     $this->tpl->setVariable("EXPLORER", $output);
     $this->tpl->setVariable("ACTION", $this->getLink($this->lm->getRefId(), $_GET["cmd"], "", $_GET["frame"]) . "&lmexpand=" . $_GET["lmexpand"]);
     //		$this->tpl->parseCurrentBlock();
     $ilBench->stop("ContentPresentation", "ilTOC");
     if ($_GET["lmexpand"] == "") {
         // collapse all other branches on navigation
         foreach ($expand_keys as $k) {
             unset($_SESSION["lmexpand"][$k]);
         }
     }
     //var_dump($_SESSION["lmexpand"]);
 }