Пример #1
0
 function _deleteUser($a_usr_id)
 {
     // Delete all user related data
     // delete lm_history
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     ilCourseLMHistory::_deleteUser($a_usr_id);
     include_once './Modules/Course/classes/class.ilCourseParticipants.php';
     ilCourseParticipants::_deleteUser($a_usr_id);
     // Course objectives
     include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
     ilLOUserResults::deleteResultsForUser($a_usr_id);
 }
Пример #2
0
 /**
  * process <ilPage> content tag
  *
  * @param	object		page node
  * @param	integer		footer/header page id
  */
 function ilPage(&$a_page_node, $a_page_id = 0)
 {
     global $ilUser, $ilHelp;
     global $ilHelp;
     $ilHelp->setScreenIdComponent("lm");
     $ilHelp->setScreenId("content");
     $ilHelp->setSubScreenId("content");
     $this->fill_on_load_code = true;
     // check if page is (not) visible in public area
     if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == 'selected') {
         $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
         if (!$public) {
             return $this->showNoPublicAccess($this->getCurrentPageId());
         }
     }
     if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) {
         return $this->showPreconditionsOfPage($this->getCurrentPageId());
     }
     // if navigation is restricted based on correct answered questions
     // check if we have preceeding pages including unsanswered/incorrect answered questions
     if (!$this->offlineMode()) {
         if ($this->lm->getRestrictForwardNavigation()) {
             if ($this->getTracker()->hasPredIncorrectAnswers($this->getCurrentPageId())) {
                 $this->showNavRestrictionDueToQuestions();
                 return;
             }
         }
     }
     require_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     require_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // page id is e.g. > 0 when footer or header page is processed
     if ($a_page_id == 0) {
         $page_id = $this->getCurrentPageId();
         //echo ":".$page_id.":";
         // highlighting?
         if ($_GET["srcstring"] != "" && !$this->offlineMode()) {
             include_once './Services/Search/classes/class.ilUserSearchCache.php';
             $cache = ilUserSearchCache::_getInstance($ilUser->getId());
             $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
             $search_string = $cache->getQuery();
             // advanced search?
             if (is_array($search_string)) {
                 $search_string = $search_string["lom_content"];
             }
             include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php";
             include_once "./Services/Search/classes/class.ilQueryParser.php";
             $p = new ilQueryParser($search_string);
             $p->parse();
             $words = $p->getQuotedWords();
             if (is_array($words)) {
                 foreach ($words as $w) {
                     ilTextHighlighterGUI::highlight("ilLMPageContent", $w, $this->tpl);
                 }
             }
             $this->fill_on_load_code = true;
         }
     } else {
         $page_id = $a_page_id;
     }
     // content style
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     // no active page found in chapter
     if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.svg",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // current page is deactivated
     if ($this->deactivated_page) {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $m = $this->lng->txt("cont_page_currently_deactivated");
         $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType());
         if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
             $m .= "<p>" . sprintf($this->lng->txt("cont_page_activation_on"), ilDatePresentation::formatDate(new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME))) . "</p>";
         }
         $mtpl->setVariable("MESSAGE", $m);
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.svg",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // check if page is out of focus
     $focus_mess = "";
     if ($this->focus_id > 0) {
         $path = $this->lm_tree->getPathId($page_id);
         // out of focus
         if (!in_array($this->focus_id, $path)) {
             $mtpl = new ilTemplate("tpl.out_of_focus_message.html", true, true, "Modules/LearningModule");
             $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message"));
             $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
             if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
                 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
                 $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
                 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
                 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
             } else {
                 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
                 include_once "./Services/Link/classes/class.ilLink.php";
                 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
             }
             $this->ctrl->setParameter($this, "focus_id", "");
             $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
             $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
             $focus_mess = $mtpl->get();
         } else {
             $sp = $this->getSuccessorPage();
             $path2 = array();
             if ($sp > 0) {
                 $path2 = $this->lm_tree->getPathId($this->getSuccessorPage());
             }
             if ($sp == 0 || !in_array($this->focus_id, $path2)) {
                 $mtpl = new ilTemplate("tpl.out_of_focus_message.html", true, true, "Modules/LearningModule");
                 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message_last_page"));
                 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
                 if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
                     $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
                     $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
                     $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
                     $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
                 } else {
                     $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
                     include_once "./Services/Link/classes/class.ilLink.php";
                     $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
                 }
                 $this->ctrl->setParameter($this, "focus_id", "");
                 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
                 $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
                 $focus_mess = $mtpl->get();
             }
         }
     }
     // no page found
     if ($page_id == 0) {
         $cont = $this->lng->txt("cont_no_page");
         $this->tpl->setVariable("PAGE_CONTENT", $cont);
         return $cont;
     }
     $page_object_gui = $this->getLMPageGUI($page_id);
     $this->basicPageGuiInit($page_object_gui);
     $page_object = $page_object_gui->getPageObject();
     $page_object->buildDom();
     $page_object->registerOfflineHandler($this);
     $int_links = $page_object->getInternalLinks();
     $page_object_gui->setTemplateOutput(false);
     // Update personal desktop items
     $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
     // Update course items
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
     // read link targets
     $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
     $link_xml .= $this->getLinkTargetsXML();
     //echo htmlentities($link_xml);
     // get lm page object
     $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
     $lm_pg_obj->setLMId($this->lm->getId());
     //$pg_obj->setParentId($this->lm->getId());
     $page_object_gui->setLinkXML($link_xml);
     // determine target frames for internal links
     //$pg_frame = $_GET["frame"];
     $page_object_gui->setLinkFrame($_GET["frame"]);
     // page title and tracking (not for header or footer page)
     if ($page_id == 0 || $page_id != $this->lm->getHeaderPage() && $page_id != $this->lm->getFooterPage()) {
         $page_object_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang));
         // track access
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $page_id != 0 && !$this->offlineMode()) {
             $this->getTracker()->trackAccess($page_id);
         }
     } else {
         $page_object_gui->setEnabledPageFocus(false);
         $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
     }
     // ADDED FOR CITATION
     $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
     $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
     $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
     // syntax style
     $this->tpl->setCurrentBlock("SyntaxStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     } else {
         $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", "syntaxhighlight.css");
     }
     $this->tpl->parseCurrentBlock();
     $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
     // process header
     if ($this->lm->getHeaderPage() > 0 && $page_id != $this->lm->getHeaderPage() && ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
         if (ilLMObject::_exists($this->lm->getHeaderPage())) {
             $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
         }
     }
     // process footer
     if ($this->lm->getFooterPage() > 0 && $page_id != $this->lm->getFooterPage() && ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
         if (ilLMObject::_exists($this->lm->getFooterPage())) {
             $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
         }
     }
     // rating
     $rating = "";
     if ($this->lm->hasRatingPages()) {
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         $rating_gui = new ilRatingGUI();
         $rating_gui->setObject($this->lm->getId(), "lm", $page_id, "lm");
         $rating_gui->setYourRatingText($this->lng->txt("lm_rate_page"));
         /*			
         	$this->tpl->setVariable("VAL_RATING", $rating->getHTML(false, true, 
         		"il.ExcPeerReview.saveComments(".$a_set["peer_id"].", %rating%)"));				
         */
         $this->ctrl->setParameter($this, "pgid", $page_id);
         $this->tpl->addOnLoadCode("il.LearningModule.setRatingUrl('" . $this->ctrl->getLinkTarget($this, "updatePageRating", "", true, false) . "')");
         $this->ctrl->setParameter($this, "pgid", "");
         $rating = '<div id="ilrtrpg" style="text-align:right">' . $rating_gui->getHtml(true, true, "il.LearningModule.saveRating(%rating%);") . "</div>";
     }
     $this->tpl->setVariable("PAGE_CONTENT", $rating . $head . $focus_mess . $ret . $foot);
     //echo htmlentities("-".$ret."-");
     return $head . $focus_mess . $ret . $foot;
 }
 protected function getItems()
 {
     global $ilUser, $ilObjDataCache, $ilAccess;
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     include_once './Services/Link/classes/class.ilLink.php';
     $lm_continue = new ilCourseLMHistory($this->start_object->getRefId(), $ilUser->getId());
     $continue_data = $lm_continue->getLMHistory();
     $items = array();
     $counter = 0;
     foreach ($this->start_object->getStartObjects() as $start) {
         $obj_id = $ilObjDataCache->lookupObjId($start['item_ref_id']);
         $ref_id = $start['item_ref_id'];
         $type = $ilObjDataCache->lookupType($obj_id);
         if (!$ilAccess->checkAccess("visible", "", $ref_id)) {
             continue;
         }
         // start object status
         if ($this->start_object->isFullfilled($ilUser->getId(), $ref_id)) {
             $accomplished = 'accomplished';
         } else {
             $accomplished = 'not_accomplished';
         }
         // add/remove desktop
         $actions = array();
         if ((bool) $this->enable_desktop) {
             // add to desktop link
             if (!$ilUser->isDesktopItem($ref_id, $type)) {
                 if ($ilAccess->checkAccess('read', '', $ref_id)) {
                     $this->ctrl->setParameter($this->getParentObject(), 'item_ref_id', $ref_id);
                     $this->ctrl->setParameter($this->getParentObject(), 'item_id', $ref_id);
                     $this->ctrl->setParameter($this->getParentObject(), 'type', $type);
                     $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'addToDesk');
                     $actions[$url] = $this->lng->txt("to_desktop");
                 }
             } else {
                 $this->ctrl->setParameter($this->getParentObject(), 'item_ref_id', $ref_id);
                 $this->ctrl->setParameter($this->getParentObject(), 'item_id', $ref_id);
                 $this->ctrl->setParameter($this->getParentObject(), 'type', $type);
                 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'removeFromDesk');
                 $actions[$url] = $this->lng->txt("unsubscribe");
             }
         }
         $default_params = null;
         if ($type == "tst") {
             $default_params["crs_show_result"] = $ref_id;
         }
         /* continue is currently inactive
         			if(isset($continue_data[$ref_id]))
         			{
         				// :TODO: should "continue" be default or 2nd link/action?
         				// $this->lng->txt('continue_work') 
         				$default_params["obj_id"] = $continue_data[$ref_id]['lm_page_id'];
         			}
         			*/
         if ($accomplished == 'accomplished') {
             $icon = ilUtil::getImagePath("icon_ok.svg");
         } else {
             $icon = ilUtil::getImagePath("icon_not_ok.svg");
         }
         $items[] = array("nr" => ++$counter, "obj_id" => $obj_id, "ref_id" => $ref_id, "type" => $type, "append_default" => $default_params, "title" => $ilObjDataCache->lookupTitle($obj_id), "description" => $ilObjDataCache->lookupDescription($obj_id), "status" => $this->lng->txt('crs_objective_' . $accomplished), "status_img" => $icon, "actions" => $actions);
     }
     include_once "./Services/Object/classes/class.ilObjectListGUIPreloader.php";
     $preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY);
     foreach ($items as $item) {
         $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
     }
     $preloader->preload();
     unset($preloader);
     reset($items);
     $this->setData($items);
 }
 /**
  * process <ilPage> content tag
  *
  * @param	object		page node
  * @param	integer		footer/header page id
  */
 function ilPage(&$a_page_node, $a_page_id = 0)
 {
     global $ilUser;
     if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == 'selected') {
         $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
         if (!$public) {
             return $this->showNoPublicAccess($this->getCurrentPageId());
         }
     }
     if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) {
         return $this->showPreconditionsOfPage($this->getCurrentPageId());
     }
     require_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     require_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // page id is e.g. > 0 when footer or header page is processed
     if ($a_page_id == 0) {
         $page_id = $this->getCurrentPageId();
         //echo ":".$page_id.":";
         // highlighting?
         if ($_GET["srcstring"] != "" && !$this->offlineMode()) {
             include_once './Services/Search/classes/class.ilUserSearchCache.php';
             $cache = ilUserSearchCache::_getInstance($ilUser->getId());
             $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
             $search_string = $cache->getQuery();
             include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php";
             include_once "./Services/Search/classes/class.ilQueryParser.php";
             $p = new ilQueryParser($search_string);
             $p->parse();
             $words = $p->getQuotedWords();
             if (is_array($words)) {
                 foreach ($words as $w) {
                     ilTextHighlighterGUI::highlight("ilLMPageContent", $w, $this->tpl);
                 }
             }
             $this->fill_on_load_code = true;
         }
     } else {
         $page_id = $a_page_id;
     }
     // content style
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     // no active page found in chapter
     if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.png",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // current page is deactivated
     if ($this->deactivated_page) {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $m = $this->lng->txt("cont_page_currently_deactivated");
         $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType());
         if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
             $m .= "<p>" . sprintf($this->lng->txt("cont_page_activation_on"), ilDatePresentation::formatDate(new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME))) . "</p>";
         }
         $mtpl->setVariable("MESSAGE", $m);
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.png",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // no page found
     if ($page_id == 0) {
         $cont = $this->lng->txt("cont_no_page");
         $this->tpl->setVariable("PAGE_CONTENT", $cont);
         return $cont;
     }
     $page_object_gui = $this->getLMPageGUI($page_id);
     $this->basicPageGuiInit($page_object_gui);
     $page_object = $page_object_gui->getPageObject();
     $page_object->buildDom();
     $page_object->registerOfflineHandler($this);
     $int_links = $page_object->getInternalLinks();
     $page_object_gui->setTemplateOutput(false);
     // Update personal desktop items
     $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
     // Update course items
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
     // read link targets
     $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
     $link_xml .= $this->getLinkTargetsXML();
     //echo htmlentities($link_xml);
     // get lm page object
     $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
     $lm_pg_obj->setLMId($this->lm->getId());
     //$pg_obj->setParentId($this->lm->getId());
     $page_object_gui->setLinkXML($link_xml);
     // determine target frames for internal links
     //$pg_frame = $_GET["frame"];
     $page_object_gui->setLinkFrame($_GET["frame"]);
     // page title and tracking (not for header or footer page)
     if ($page_id == 0 || $page_id != $this->lm->getHeaderPage() && $page_id != $this->lm->getFooterPage()) {
         $page_object_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation")));
         // update learning progress
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             // #9483
             include_once "./Services/Tracking/classes/class.ilLearningProgress.php";
             ilLearningProgress::_tracProgress($ilUser->getId(), $this->lm->getId(), $this->lm->getRefId(), $this->lm->getType());
             // obsolete?
             include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
             ilLPStatusWrapper::_updateStatus($this->lm->getId(), $ilUser->getId());
         }
     } else {
         $page_object_gui->setEnabledPageFocus(false);
         $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
     }
     // ADDED FOR CITATION
     $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
     $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
     $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
     // syntax style
     $this->tpl->setCurrentBlock("SyntaxStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     } else {
         $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", "syntaxhighlight.css");
     }
     $this->tpl->parseCurrentBlock();
     $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
     // process header
     if ($this->lm->getHeaderPage() > 0 && $page_id != $this->lm->getHeaderPage() && ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
         if (ilLMObject::_exists($this->lm->getHeaderPage())) {
             $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
         }
     }
     // process footer
     if ($this->lm->getFooterPage() > 0 && $page_id != $this->lm->getFooterPage() && ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
         if (ilLMObject::_exists($this->lm->getFooterPage())) {
             $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
         }
     }
     $this->tpl->setVariable("PAGE_CONTENT", $head . $ret . $foot);
     //echo htmlentities("-".$ret."-");
     return $head . $ret . $foot;
 }
 public function isFullfilled($a_user_id, $a_item_id)
 {
     global $ilObjDataCache;
     $obj_id = $ilObjDataCache->lookupObjId($a_item_id);
     $type = $ilObjDataCache->lookupType($obj_id);
     switch ($type) {
         case 'tst':
             include_once './Modules/Test/classes/class.ilObjTestAccess.php';
             if (!ilObjTestAccess::checkCondition($obj_id, 'finished', '', $a_user_id)) {
                 return false;
             }
             break;
         case 'svy':
             include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
             if (!ilObjSurveyAccess::_lookupFinished($obj_id, $a_user_id)) {
                 return false;
             }
             break;
         case 'sahs':
             include_once 'Services/Tracking/classes/class.ilLPStatus.php';
             if (!ilLPStatus::_hasUserCompleted($obj_id, $a_user_id)) {
                 return false;
             }
             break;
         default:
             include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
             $lm_continue = new ilCourseLMHistory($this->getRefId(), $a_user_id);
             $continue_data = $lm_continue->getLMHistory();
             if (!isset($continue_data[$a_item_id])) {
                 return false;
             }
             break;
     }
     return true;
 }