/**
  * get html 
  * @return
  */
 public function getHTML()
 {
     global $lng, $ilUser;
     include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
     foreach ($this->getSubItemIds(true) as $sub_item) {
         if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) {
             $this->tpl->setCurrentBlock('sea_fragment');
             $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('subitem');
         $this->tpl->setVariable('SEPERATOR', ':');
         switch (ilLMObject::_lookupType($sub_item, $this->getObjId())) {
             case 'pg':
                 $this->getItemListGUI()->setChildId($sub_item);
                 $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_pg'));
                 $link = $this->getItemListGUI()->getCommandLink('page');
                 include_once './Services/Search/classes/class.ilUserSearchCache.php';
                 $link .= '&srcstring=1';
                 $this->tpl->setVariable('LINK', $link);
                 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
                 $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
                 break;
             case 'st':
                 $this->getItemListGUI()->setChildId($sub_item);
                 $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_st'));
                 $link = $this->getItemListGUI()->getCommandLink('page');
                 include_once './Services/Search/classes/class.ilUserSearchCache.php';
                 $link .= '&srcstring=1';
                 $this->tpl->setVariable('LINK', $link);
                 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
                 $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
                 break;
             default:
                 if (ilObject::_lookupType($sub_item) != 'file') {
                     return '';
                 }
                 $this->getItemListGUI()->setChildId('il__file_' . $sub_item);
                 $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file'));
                 $link = $this->getItemListGUI()->getCommandLink('downloadFile');
                 $this->tpl->setVariable('LINK', $link);
                 $this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item));
                 break;
         }
         if (count($this->getSubItemIds(true)) > 1) {
             $this->parseRelevance($sub_item);
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->showDetailsLink();
     return $this->tpl->get();
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $ilCtrl, $lng;
     $this->tpl->setVariable("PAGE_TITLE", ilLMObject::_lookupTitle($a_set["page_id"]));
     $this->tpl->setVariable("QUESTION", assQuestion::_getQuestionText($a_set["question_id"]));
     include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
     $stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
     $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
     if ($stats["all"] == 0) {
         $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
         $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
         $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
         $this->tpl->setVariable("VAL_NEVER", 0);
     } else {
         $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] . " (" . 100 / $stats["all"] * $stats["first"] . " %)");
         $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] . " (" . 100 / $stats["all"] * $stats["second"] . " %)");
         $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] . " (" . 100 / $stats["all"] * $stats["third_or_more"] . " %)");
         $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
         $this->tpl->setVariable("VAL_NEVER", $nev . " (" . 100 / $stats["all"] * $nev . " %)");
     }
 }
 /**
  * show preconditions of the page
  */
 function showPreconditionsOfPage()
 {
     $conds = ilObjContentObject::_getMissingPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
     $topchap = ilObjContentObject::_getMissingPreconditionsTopChapter($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
     $page_id = $this->getCurrentPageId();
     // 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();
     $this->tpl->addBlockFile("PAGE_CONTENT", "pg_content", "tpl.page_preconditions.html", true);
     // list all missing preconditions
     include_once "./Services/Repository/classes/class.ilRepositoryExplorer.php";
     foreach ($conds as $cond) {
         $obj_link = ilRepositoryExplorer::buildLinkTarget($cond["trigger_ref_id"], $cond["trigger_type"]);
         $obj_frame = ilRepositoryExplorer::buildFrameTarget($cond["trigger_type"], $cond["trigger_ref_id"], $cond["trigger_obj_id"]);
         $this->tpl->setCurrentBlock("condition");
         $this->tpl->setVariable("ROWCOL", $rc = $rc != "tblrow2" ? "tblrow2" : "tblrow1");
         $this->tpl->setVariable("VAL_ITEM", ilObject::_lookupTitle($cond["trigger_obj_id"]));
         $this->tpl->setVariable("LINK_ITEM", $obj_link);
         $this->tpl->setVariable("FRAME_ITEM", $obj_frame);
         if ($cond["operator"] == "passed") {
             $cond_str = $this->lng->txt("passed");
         } else {
             $cond_str = $cond["operator"];
         }
         $this->tpl->setVariable("VAL_CONDITION", $cond_str . " " . $cond["value"]);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("pg_content");
     $this->tpl->setVariable("TXT_MISSING_PRECONDITIONS", sprintf($this->lng->txt("cont_missing_preconditions"), ilLMObject::_lookupTitle($topchap)));
     $this->tpl->setVariable("TXT_ITEM", $this->lng->txt("item"));
     $this->tpl->setVariable("TXT_CONDITION", $this->lng->txt("condition"));
     // output skip chapter link
     $parent = $this->lm_tree->getParentId($topchap);
     $childs = $this->lm_tree->getChildsByType($parent, "st");
     $next = "";
     $j = -2;
     $i = 1;
     foreach ($childs as $child) {
         if ($child["child"] == $topchap) {
             $j = $i;
         }
         if ($i++ == $j + 1) {
             $succ_node = $this->lm_tree->fetchSuccessorNode($child["child"], "pg");
         }
     }
     if ($succ_node != "") {
         $framestr = !empty($_GET["frame"]) ? "frame=" . $_GET["frame"] . "&" : "";
         $showViewInFrameset = true;
         $link = "<br /><a href=\"" . $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]) . "\">" . $this->lng->txt("cont_skip_chapter") . "</a>";
         $this->tpl->setVariable("LINK_SKIP_CHAPTER", $link);
     }
     $this->tpl->parseCurrentBlock();
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_POSITION', $a_set['position']);
     // begin-patch lok
     if ($a_set['online']) {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('online'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallgreen');
     } else {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('offline'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallred');
     }
     if ($a_set['passes']) {
         $this->tpl->setVariable('PASSES_TXT', $this->lng->txt('crs_loc_passes_info'));
         $this->tpl->setVariable('PASSES_VAL', $a_set['passes']);
     }
     // begin-patch lok
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     $this->tpl->setVariable('VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
     // materials
     foreach ($a_set['materials'] as $ref_id => $data) {
         if ($data['items']) {
             $this->tpl->touchBlock('ul_begin');
             foreach ($data['items'] as $pg_st) {
                 $this->tpl->setCurrentBlock('st_pg');
                 $this->tpl->setVariable('MAT_IMG', ilObject::_getIcon($pg_st['obj_id'], "tiny", $pg_st['type']));
                 $this->tpl->setVariable('MAT_ALT', $this->lng->txt('obj_' . $pg_st['type']));
                 include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = ilLMObject::_lookupTitle($pg_st['obj_id']);
                 $this->tpl->setVariable('MAT_TITLE', $title);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->touchBlock('ul_end');
         } else {
             $this->tpl->touchBlock('new_line');
         }
         $this->tpl->setCurrentBlock('mat_row');
         $this->tpl->setVariable('LM_IMG', ilObject::_getIcon($data['obj_id'], "tiny", $data['type']));
         $this->tpl->setVariable('LM_ALT', $this->lng->txt('obj_' . $data['type']));
         if ($data['type'] == 'catr' or $data['type'] == 'crsr') {
             include_once './Services/ContainerReference/classes/class.ilContainerReference.php';
             $this->tpl->setVariable('LM_TITLE', ilContainerReference::_lookupTargetTitle($data['obj_id']));
         } else {
             $this->tpl->setVariable('LM_TITLE', ilObject::_lookupTitle($data['obj_id']));
         }
         $this->tpl->parseCurrentBlock();
     }
     // self assessment
     // begin-patch lok
     if ($this->getSettings()->worksWithInitialTest()) {
         foreach ($a_set['self'] as $test) {
             // begin-patch lok
             foreach ((array) $test['questions'] as $question) {
                 $this->tpl->setCurrentBlock('self_qst_row');
                 $this->tpl->setVariable('SELF_QST_TITLE', $question['title']);
                 $this->tpl->parseCurrentBlock();
             }
             #$this->tpl->setCurrentBlock('self_test_row');
             #$this->tpl->setVariable('SELF_TST_ALT',$this->lng->txt('obj_tst'));
             #$this->tpl->setVariable('SELF_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
             #$this->tpl->parseCurrentBlock();
             // end-patch lok
         }
         // begin-patch lok
         if (!count($a_set['self'])) {
             $this->tpl->touchBlock('self_qst_row');
         }
         // end-patch lok
     }
     // end-patch lok
     // final test questions
     foreach ((array) $a_set['final'] as $test) {
         foreach ((array) $test['questions'] as $question) {
             $this->tpl->setCurrentBlock('final_qst_row');
             $this->tpl->setVariable('FINAL_QST_TITLE', $question['title']);
             $this->tpl->parseCurrentBlock();
         }
         // begin-patch lok
         #$this->tpl->setCurrentBlock('final_test_row');
         #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst'));
         #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
         #$this->tpl->parseCurrentBlock();
         // end-patch lok
     }
     // begin-patch lok
     // Edit Link
     #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']);
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit'));
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $alist = new ilAdvancedSelectionListGUI();
     $alist->setId($a_set['id']);
     $alist->setListTitle($this->lng->txt("actions"));
     $alist->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // materials
     $alist->addItem($this->lng->txt('crs_objective_action_materials'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'materialAssignment'));
     // itest
     if ($this->getSettings()->worksWithInitialTest()) {
         $alist->addItem($this->lng->txt('crs_objective_action_itest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'selfAssessmentAssignment'));
     }
     // qtest
     $alist->addItem($this->lng->txt('crs_objective_action_qtest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalTestAssignment'));
     if ($this->getSettings()->isQualifiedTestPerObjectiveVisible()) {
         $this->ctrl->setParameterByClass('ilconditionhandlerinterface', 'objective_id', $a_set['id']);
         $alist->addItem($this->lng->txt('preconditions'), '', $this->ctrl->getLinkTargetByClass('ilconditionhandlerinterface', 'listConditions'));
     }
     $this->ctrl->setParameterByClass('illopagegui', 'objective_id', $a_set['id']);
     $alist->addItem($this->lng->txt('edit_page'), '', $this->ctrl->getLinkTargetByClass('illopagegui', 'edit'));
     $this->tpl->setVariable('VAL_ACTIONS', $alist->getHTML());
     // end-patch lok
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "sahs":
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
                     $page_obj = new ilSCORM2004Page($usage["id"]);
                     require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
                     $lm_obj = new ilObjSAHSLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "sahs");
                     }
                     break;
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                     $page_obj = new ilLMPage($usage["id"]);
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "lm");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $page_obj = new ilWikiPage($usage["id"]);
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                     $page_obj = new ilGlossaryDefPage($usage["id"]);
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "fold":
                 case "root":
                 case "crs":
                 case "grp":
                 case "cat":
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
                     $ref_id = $this->getFirstWritableRefId($usage["id"]);
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
                 default:
                     $item["obj_title"] = "Page " . $cont_type . ", " . $usage["id"];
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
         case "sqst":
             $item["obj_type_txt"] = $this->lng->txt("cont_sqst");
             include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
             $obj_id = SurveyQuestion::lookupObjFi($usage["id"]);
             $item["obj_title"] = ilObject::_lookupTitle($obj_id);
             $item["sub_txt"] = $this->lng->txt("question");
             $item["sub_title"] = SurveyQuestion::_getTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($obj_id);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id);
             }
             break;
         default:
             $item["obj_title"] = "Type " . $usage["type"] . ", " . $usage["id"];
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_POSITION', $a_set['position']);
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
     // materials
     foreach ($a_set['materials'] as $ref_id => $data) {
         if ($data['items']) {
             $this->tpl->touchBlock('ul_begin');
             foreach ($data['items'] as $pg_st) {
                 $this->tpl->setCurrentBlock('st_pg');
                 $this->tpl->setVariable('MAT_IMG', ilUtil::getImagePath('icon_' . $pg_st['type'] . '_s.png'));
                 $this->tpl->setVariable('MAT_ALT', $this->lng->txt('obj_' . $pg_st['type']));
                 include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = ilLMObject::_lookupTitle($pg_st['obj_id']);
                 $this->tpl->setVariable('MAT_TITLE', $title);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->touchBlock('ul_end');
         } else {
             $this->tpl->touchBlock('new_line');
         }
         $this->tpl->setCurrentBlock('mat_row');
         $this->tpl->setVariable('LM_IMG', ilUtil::getImagePath('icon_' . $data['type'] . '_s.png'));
         $this->tpl->setVariable('LM_ALT', $this->lng->txt('obj_' . $data['type']));
         $this->tpl->setVariable('LM_TITLE', ilObject::_lookupTitle($data['obj_id']));
         $this->tpl->parseCurrentBlock();
     }
     // self assessment
     foreach ($a_set['self'] as $test) {
         foreach ($test['questions'] as $question) {
             $this->tpl->setCurrentBlock('self_qst_row');
             $this->tpl->setVariable('SELF_QST_TITLE', $question['title']);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('self_test_row');
         $this->tpl->setVariable('SELF_TST_IMG', ilUtil::getImagePath('icon_tst_s.png'));
         $this->tpl->setVariable('SELF_TST_ALT', $this->lng->txt('obj_tst'));
         $this->tpl->setVariable('SELF_TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
         $this->tpl->parseCurrentBlock();
     }
     // final test questions
     foreach ($a_set['final'] as $test) {
         foreach ($test['questions'] as $question) {
             $this->tpl->setCurrentBlock('final_qst_row');
             $this->tpl->setVariable('FINAL_QST_TITLE', $question['title']);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('final_test_row');
         $this->tpl->setVariable('FINAL_TST_IMG', ilUtil::getImagePath('icon_tst_s.png'));
         $this->tpl->setVariable('FINAL_TST_ALT', $this->lng->txt('obj_tst'));
         $this->tpl->setVariable('FINAL_TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
         $this->tpl->parseCurrentBlock();
     }
     // Edit Link
     $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'objective_id', $a_set['id']);
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()), 'edit'));
     $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     //var_dump($usage);
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     //var_dump($usage);
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
             $page_obj = ilPageObjectFactory::getInstance($cont_type, $usage["id"]);
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj = new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($page_obj->getId() . "_" . $ref_id, "pg");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         if (count($usage["hist_nr"]) > 5) {
             $ver .= "..., ";
             $cnt = count($usage["hist_nr"]) - 5;
             for ($i = 0; $i < $cnt; $i++) {
                 unset($usage["hist_nr"][$i]);
             }
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 /**
  * presentation title doesn't have to be page title, it may be
  * chapter title + page title or chapter title only, depending on settings
  *
  * @param	string	$a_mode		IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER
  */
 static function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-")
 {
     if ($a_mode == IL_NO_HEADER && !$a_force_content) {
         return "";
     }
     if ($a_lm_id == 0) {
         $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
     }
     if ($a_lm_id == 0) {
         return "";
     }
     // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
     $title = ilLMObject::_lookupTitle($a_pg_id);
     // this is also optimized since ilObjectTranslation re-uses instances for one lm
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($a_lm_id);
     $languages = $ot->getLanguages();
     if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang])) {
         include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
         $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $title = $lmobjtrans->getTitle();
         }
     }
     if ($a_mode == IL_PAGE_TITLE) {
         return $title;
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($a_lm_id);
     if ($tree->isInTree($a_pg_id)) {
         $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st");
         $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
         $cnt_str = "";
         if (count($childs) > 1) {
             $cnt = 0;
             foreach ($childs as $child) {
                 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                 $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($a_lm_id), $a_time_scheduled_activation);
                 if (!$active) {
                     $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
                     if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
                         $active = true;
                     }
                 }
                 if ($child["type"] != "pg" || $active) {
                     $cnt++;
                 }
                 if ($child["obj_id"] == $a_pg_id) {
                     $cur_cnt = $cnt;
                 }
             }
             if ($cnt > 1) {
                 $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
             }
         }
         require_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
         //$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
         //return $struct_obj->getTitle();
         return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers, false, 0, $a_lang) . $cnt_str;
         //return $pred_node["title"].$cnt_str;
     } else {
         return $title;
     }
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     $GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($a_set, TRUE));
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_POSITION', $a_set['position']);
     // begin-patch lok
     if ($a_set['online']) {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('online'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallgreen');
     } else {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('offline'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallred');
     }
     if ($a_set['passes']) {
         $this->tpl->setVariable('PASSES_TXT', $this->lng->txt('crs_loc_passes_info'));
         $this->tpl->setVariable('PASSES_VAL', $a_set['passes']);
     }
     // begin-patch lok
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     $this->tpl->setVariable('VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
     // materials
     foreach ($a_set['materials'] as $ref_id => $data) {
         if ($data['items']) {
             $this->tpl->touchBlock('ul_begin');
             foreach ($data['items'] as $pg_st) {
                 $this->tpl->setCurrentBlock('st_pg');
                 $this->tpl->setVariable('MAT_IMG', ilObject::_getIcon($pg_st['obj_id'], "tiny", $pg_st['type']));
                 $this->tpl->setVariable('MAT_ALT', $this->lng->txt('obj_' . $pg_st['type']));
                 include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = ilLMObject::_lookupTitle($pg_st['obj_id']);
                 $this->tpl->setVariable('MAT_TITLE', $title);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->touchBlock('ul_end');
         } else {
             $this->tpl->touchBlock('new_line');
         }
         $this->tpl->setCurrentBlock('mat_row');
         $this->tpl->setVariable('LM_IMG', ilObject::_getIcon($data['obj_id'], "tiny", $data['type']));
         $this->tpl->setVariable('LM_ALT', $this->lng->txt('obj_' . $data['type']));
         if ($data['type'] == 'catr' or $data['type'] == 'crsr') {
             include_once './Services/ContainerReference/classes/class.ilContainerReference.php';
             $this->tpl->setVariable('LM_TITLE', ilContainerReference::_lookupTargetTitle($data['obj_id']));
         } else {
             $this->tpl->setVariable('LM_TITLE', ilObject::_lookupTitle($data['obj_id']));
         }
         $this->tpl->parseCurrentBlock();
     }
     // self assessment
     // begin-patch lok
     if ($this->getSettings()->worksWithInitialTest()) {
         if ($this->getSettings()->hasSeparateInitialTests()) {
             if ($a_set['initial']) {
                 include_once './Services/Link/classes/class.ilLink.php';
                 $obj_id = ilObject::_lookupObjId($a_set['initial']);
                 $this->tpl->setCurrentBlock('initial_test_per_objective');
                 $this->tpl->setVariable('IT_IMG', ilObject::_getIcon($obj_id, 'tiny'));
                 $this->tpl->setVariable('IT_ALT', $this->lng->txt('obj_tst'));
                 $this->tpl->setVariable('IT_TITLE', ilObject::_lookupTitle($obj_id));
                 $this->tpl->setVariable('IT_TITLE_LINK', ilLink::_getLink($a_set['initial']));
                 include_once './Services/Link/classes/class.ilLink.php';
                 $this->ctrl->setParameterByClass('ilobjtestgui', 'ref_id', $a_set['initial']);
                 $this->ctrl->setParameterByClass('ilobjtestgui', 'cmd', 'questionsTabGateway');
                 $this->tpl->setVariable('IT_TITLE_LINK', $this->ctrl->getLinkTargetByClass('ilobjtestgui'));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->touchBlock('initial_test_per_objective');
             }
         } else {
             foreach ($a_set['self'] as $test) {
                 // begin-patch lok
                 foreach ((array) $test['questions'] as $question) {
                     $this->tpl->setCurrentBlock('self_qst_row');
                     $this->tpl->setVariable('SELF_QST_TITLE', $question['title']);
                     $this->tpl->parseCurrentBlock();
                 }
                 // end-patch lok
             }
             // begin-patch lok
             if (!count($a_set['self'])) {
                 $this->tpl->touchBlock('self_qst_row');
             }
         }
         // end-patch lok
     }
     // end-patch lok
     // final test questions
     if ($this->getSettings()->getQualifyingTestType() == ilLOSettings::TYPE_QUALIFYING_SELECTED) {
         if ($a_set['final']) {
             $obj_id = ilObject::_lookupObjId($a_set['final']);
             $this->tpl->setCurrentBlock('final_test_per_objective');
             $this->tpl->setVariable('FT_IMG', ilObject::_getIcon($obj_id, 'tiny'));
             $this->tpl->setVariable('FT_ALT', $this->lng->txt('obj_tst'));
             $this->tpl->setVariable('FT_TITLE', ilObject::_lookupTitle($obj_id));
             include_once './Services/Link/classes/class.ilLink.php';
             $this->ctrl->setParameterByClass('ilobjtestgui', 'ref_id', $a_set['final']);
             $this->ctrl->setParameterByClass('ilobjtestgui', 'cmd', 'questionsTabGateway');
             $this->tpl->setVariable('FT_TITLE_LINK', $this->ctrl->getLinkTargetByClass('ilobjtestgui'));
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->touchBlock('final_test_per_objective');
         }
     } else {
         foreach ((array) $a_set['final'] as $test) {
             foreach ((array) $test['questions'] as $question) {
                 $this->tpl->setCurrentBlock('final_qst_row');
                 $this->tpl->setVariable('FINAL_QST_TITLE', $question['title']);
                 $this->tpl->parseCurrentBlock();
             }
             // begin-patch lok
             #$this->tpl->setCurrentBlock('final_test_row');
             #$this->tpl->setVariable('FINAL_TST_IMG',ilUtil::getImagePath('icon_tst_s.png'));
             #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst'));
             #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
             #$this->tpl->parseCurrentBlock();
             // end-patch lok
         }
     }
     // begin-patch lok
     // Edit Link
     #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']);
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit'));
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $alist = new ilAdvancedSelectionListGUI();
     $alist->setId($a_set['id']);
     $alist->setListTitle($this->lng->txt("actions"));
     $alist->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // materials
     $alist->addItem($this->lng->txt('crs_objective_action_materials'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'materialAssignment'));
     // itest
     if ($this->getSettings()->worksWithInitialTest() && !$this->getSettings()->hasSeparateInitialTests()) {
         $alist->addItem($this->lng->txt('crs_objective_action_itest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'selfAssessmentAssignment'));
     }
     // qtest
     if ($this->getSettings()->hasSeparateQualifiedTests()) {
         #$alist->addItem(
         #		$this->lng->txt('crs_objective_action_qtest_sep'),
         #		'',
         #		$this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalSeparatedTestAssignment')
         #);
     } else {
         $alist->addItem($this->lng->txt('crs_objective_action_qtest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalTestAssignment'));
     }
     $this->ctrl->setParameterByClass('illopagegui', 'objective_id', $a_set['id']);
     $alist->addItem($this->lng->txt('edit_page'), '', $this->ctrl->getLinkTargetByClass('illopagegui', 'edit'));
     $this->tpl->setVariable('VAL_ACTIONS', $alist->getHTML());
     // end-patch lok
 }
 /**
  * parse
  *
  * @access public
  * @param array array of assignable nodes (tree node data)
  * @return
  */
 public function parse($a_assignable)
 {
     global $objDefinition;
     $materials = array();
     foreach ($a_assignable as $node) {
         // no side blocks here
         if ($objDefinition->isSideBlock($node['type'])) {
             continue;
         }
         $tmp_data = array();
         $subobjects = array();
         if ($node['type'] == 'lm') {
             include_once './Modules/LearningModule/classes/class.ilLMObject.php';
             // Chapters and pages
             foreach ($chapters = $this->getAllSubObjects($node['child']) as $chapter => $chapter_data) {
                 $sub['title'] = ilLMObject::_lookupTitle($chapter);
                 $sub['id'] = $chapter;
                 $sub['depth'] = $chapter_data['depth'];
                 $sub['type'] = $chapter_data['type'];
                 $subobjects[] = $sub;
             }
         }
         $tmp_data['sub'] = $subobjects;
         $tmp_data['title'] = $node['title'];
         $tmp_data['description'] = $node['description'];
         $tmp_data['type'] = $node['type'];
         $tmp_data['id'] = $node['child'];
         $tmp_data['obj_id'] = $node['obj_id'];
         $materials[] = $tmp_data;
     }
     $this->setData($materials);
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]);
     $ilCtrl->setParameterByClass("illmpageobjectgui", "obj_id", $a_set["obj_id"]);
     $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     $page_object = new ilLMPage($a_set["obj_id"]);
     $page_object->buildDom();
     $int_links = $page_object->getInternalLinks();
     foreach ($int_links as $link) {
         $target = $link["Target"];
         if (substr($target, 0, 4) == "il__") {
             $target_arr = explode("_", $target);
             $target_id = $target_arr[count($target_arr) - 1];
             $type = $link["Type"];
             switch ($type) {
                 case "PageObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg"));
                     if (ilLMObject::_exists($target_id)) {
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : "";
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str);
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "StructureObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st"));
                     if (ilLMObject::_exists($target_id)) {
                         $lm_id = ilLMObject::_lookupContObjID($target_id);
                         $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : "";
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str);
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "GlossaryItem":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term"));
                     include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     if (ilGlossaryTerm::_exists($target_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilGlossaryTerm::_lookGlossaryTerm($target_id));
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "MediaObject":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob"));
                     if (ilObject::_exists($target_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($target_id));
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
                 case "RepositoryItem":
                     $this->tpl->setCurrentBlock("link");
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item"));
                     $obj_type = ilObject::_lookupType($target_id, true);
                     $obj_id = ilObject::_lookupObjId($target_id);
                     if (ilObject::_exists($obj_id)) {
                         $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($obj_id) . " (" . $lng->txt("obj_" . $obj_type) . ")");
                     } else {
                         $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>");
                     }
                     $this->tpl->parseCurrentBlock();
                     break;
             }
         } else {
             $type = $link["Type"];
             switch ($type) {
                 case "PageObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg"));
                     break;
                 case "StructureObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st"));
                     break;
                 case "GlossaryItem":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term"));
                     break;
                 case "MediaObject":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob"));
                     break;
                 case "RepositoryItem":
                     $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item"));
                     break;
             }
             $this->tpl->setCurrentBlock("link");
             $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target . "]" . "</b>");
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * get presentation title
  *
  */
 static function _getPresentationTitle($a_st_id, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_lm_id = 0, $a_lang = "-")
 {
     global $ilDB;
     if ($a_lm_id == 0) {
         $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
     }
     if ($a_lm_id == 0) {
         return "";
     }
     // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
     $title = ilLMObject::_lookupTitle($a_st_id);
     // this is also optimized since ilObjectTranslation re-uses instances for one lm
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($a_lm_id);
     $languages = $ot->getLanguages();
     if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang])) {
         include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
         $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
         if ($lmobjtrans->getTitle() != "") {
             $title = $lmobjtrans->getTitle();
         }
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $tree = ilLMTree::getInstance($a_lm_id);
     if ($a_include_numbers) {
         // this is optimized, since isInTree is cached
         if ($tree->isInTree($a_st_id)) {
             // optimization needed from here
             // get chapter tree node
             $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($a_st_id, "integer") . " AND lm_id = " . $ilDB->quote($a_lm_id, "integer");
             $tree_set = $ilDB->query($query);
             $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
             $depth = $tree_node["depth"];
             $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
             for ($i = $depth - 1; $i > 1; $i--) {
                 // get next parent tree node
                 $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " . $ilDB->quote($a_lm_id, "integer");
                 $tree_set = $ilDB->query($query);
                 $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC);
                 $seq = $tree->getChildSequenceNumber($tree_node, "st");
                 $nr = $seq . "." . $nr;
             }
         }
     }
     return $nr . $title;
 }
 /**
  * Get text name of internal link
  *
  * @param	string		$a_target		target object link id
  * @param	string		$a_type			type
  * @param	string		$a_frame		target frame
  *
  * @access	private
  */
 function getMapAreaLinkString($a_target, $a_type, $a_frame)
 {
     global $lng;
     $t_arr = explode("_", $a_target);
     if ($a_frame != "") {
         $frame_str = " (" . $a_frame . " Frame)";
     }
     switch ($a_type) {
         case "StructureObject":
             require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
             $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
             $link_str = $lng->txt("chapter") . ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
             break;
         case "PageObject":
             require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
             $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
             $link_str = $lng->txt("page") . ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
             break;
         case "GlossaryItem":
             require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
             $term =& new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
             $link_str = $lng->txt("term") . ": " . $term->getTerm() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
             break;
         case "MediaObject":
             require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mob =& new ilObjMediaObject($t_arr[count($t_arr) - 1]);
             $link_str = $lng->txt("mob") . ": " . $mob->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
             break;
         case "RepositoryItem":
             $title = ilObject::_lookupTitle(ilObject::_lookupObjId($t_arr[count($t_arr) - 1]));
             $link_str = $lng->txt("obj_" . $t_arr[count($t_arr) - 2]) . ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
             break;
     }
     return $link_str;
 }
 /**
  * Show page
  *
  * @param
  * @return
  */
 function showPage()
 {
     global $lng;
     $page_id = (int) $_GET["help_page"];
     $h_tpl = new ilTemplate("tpl.help.html", true, true, "Services/Help");
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     $h_tpl->setCurrentBlock("backlink");
     $h_tpl->setVariable("TXT_BACK", $lng->txt("back"));
     $h_tpl->setVariable("ONCLICK_BACK", "return il.Help.listHelp(event, true);");
     $h_tpl->parseCurrentBlock();
     $h_tpl->setVariable("HEAD", $lng->txt("help") . " - " . ilLMObject::_lookupTitle($page_id));
     include_once "./Services/COPage/classes/class.ilPageUtil.php";
     if (!ilPageUtil::_existsAndNotEmpty("lm", $page_id)) {
         exit;
     }
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     // get page object
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     $page_gui = new ilLMPageGUI($page_id);
     $cfg = $page_gui->getPageConfig();
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader("");
     $page_gui->setRawPageContent(true);
     $cfg->setEnablePCType("Map", false);
     $cfg->setEnablePCType("Tabs", false);
     $cfg->setEnablePCType("FileList", false);
     $page_gui->getPageObject()->buildDom();
     $int_links = $page_gui->getPageObject()->getInternalLinks();
     $link_xml = $this->getLinkXML($int_links);
     $link_xml .= $this->getLinkTargetsXML();
     //echo htmlentities($link_xml);
     $page_gui->setLinkXML($link_xml);
     $ret = $page_gui->showPage();
     $h_tpl->setVariable("CONTENT", $ret);
     $h_tpl->setVariable("CLOSE_IMG", ilUtil::img(ilUtil::getImagePath("icon_close2_s.png")));
     ilSession::set("help_pg", $page_id);
     $page = $h_tpl->get();
     // replace style classes
     //$page = str_replace("ilc_text_inline_Strong", "ilHelpStrong", $page);
     echo $page;
     exit;
 }
 /**
  * Validate all pages
  */
 function validatePages()
 {
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     $mess = "";
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $page) {
         if (ilLMPage::_exists($this->getType(), $page["obj_id"])) {
             $cpage = new ilLMPage($page["obj_id"]);
             $cpage->buildDom();
             $error = @$cpage->validateDom();
             if ($error != "") {
                 $this->lng->loadLanguageModule("content");
                 ilUtil::sendInfo($this->lng->txt("cont_import_validation_errors"));
                 $title = ilLMObject::_lookupTitle($page["obj_id"]);
                 $page_obj = new ilLMPageObject($this, $page["obj_id"]);
                 $mess .= $this->lng->txt("obj_pg") . ": " . $title;
                 $mess .= '<div class="small">';
                 foreach ($error as $e) {
                     $err_mess = implode($e, " - ");
                     if (!is_int(strpos($err_mess, ":0:"))) {
                         $mess .= htmlentities($err_mess) . "<br />";
                     }
                 }
                 $mess .= '</div>';
                 $mess .= "<br />";
             }
         }
     }
     return $mess;
 }
 function __showLearningMaterials()
 {
     global $rbacsystem, $ilias, $ilUser, $ilObjDataCache;
     include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
     include_once './Services/Repository/classes/class.ilRepositoryExplorer.php';
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     if (!count($lms = ilCourseObjectiveMaterials::_getAllAssignedMaterials($this->course_obj->getId()))) {
         return false;
     }
     if ($this->details_id) {
         $objectives_lm_obj =& new ilCourseObjectiveMaterials($this->details_id);
     }
     $lm_continue =& new ilCourseLMHistory($this->course_obj->getRefId(), $ilUser->getId());
     $continue_data = $lm_continue->getLMHistory();
     $this->tpl->addBlockfile('LM_BLOCK', 'lm_block', 'tpl.crs_objectives_view_lm_table.html', 'Modules/Course');
     $this->tpl->setVariable("TBL_TITLE_LMS", $this->lng->txt('crs_learning_materials'));
     $this->__showHideLinks('lms');
     if (isset($_SESSION['crs_hide_lms'])) {
         return true;
     }
     $this->tpl->setVariable("TBL_HEADER_LMS_TYPE", $this->lng->txt('type'));
     $this->tpl->setVariable("TBL_HEADER_NAME_LMS", $this->lng->txt('description'));
     $counter = 1;
     foreach ($lms as $lm_id) {
         $obj_id = $ilObjDataCache->lookupObjId($lm_id);
         $obj_type = $ilObjDataCache->lookupType($obj_id);
         $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($lm_id, $obj_id);
         $obj_link = ilRepositoryExplorer::buildLinkTarget($lm_id, $ilObjDataCache->lookupType($obj_id));
         $obj_frame = ilRepositoryExplorer::buildFrameTarget($ilObjDataCache->lookupType($obj_id), $lm_id, $obj_id);
         $obj_frame = $obj_frame ? $obj_frame : '';
         $contentObj = false;
         if (ilRepositoryExplorer::isClickable($obj_type, $lm_id, $obj_id)) {
             $this->tpl->setCurrentBlock("lm_read");
             $this->tpl->setVariable("READ_TITLE_LMS", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->setVariable("READ_TARGET_LMS", $obj_frame);
             $this->tpl->setVariable("READ_LINK_LMS", $obj_link);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("lm_visible");
             $this->tpl->setVariable("VISIBLE_LINK_LMS", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->parseCurrentBlock();
         }
         // add to desktop link
         if (!$ilUser->isDesktopItem($lm_id, $obj_type) and $this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED) {
             if ($rbacsystem->checkAccess('read', $lm_id)) {
                 $this->tpl->setCurrentBlock("lm_desklink");
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $lm_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $lm_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $obj_type);
                 $this->tpl->setVariable("DESK_LINK_LMS", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk'));
                 $this->tpl->setVariable("TXT_DESK_LMS", $this->lng->txt("to_desktop"));
                 $this->tpl->parseCurrentBlock();
             }
         }
         // CONTINUE LINK
         if (isset($continue_data[$lm_id])) {
             $this->tpl->setCurrentBlock("lm_continuelink");
             $this->tpl->setVariable("CONTINUE_LINK_LMS", 'ilias.php?baseClass=ilLMPresentationGUI&ref_id=' . $lm_id . '&obj_id=' . $continue_data[$lm_id]['lm_page_id']);
             $target = '';
             $this->tpl->setVariable("CONTINUE_LINK_TARGET", $obj_frame);
             $this->tpl->setVariable("TXT_CONTINUE_LMS", $this->lng->txt('continue_work'));
             $this->tpl->parseCurrentBlock();
         }
         // Description
         if (strlen($ilObjDataCache->lookupDescription($obj_id))) {
             $this->tpl->setCurrentBlock("lms_description");
             $this->tpl->setVariable("DESCRIPTION_LMS", $ilObjDataCache->lookupDescription($obj_id));
             $this->tpl->parseCurrentBlock();
         }
         // LAST ACCESS
         if (isset($continue_data["{$lm_id}"])) {
             $this->tpl->setVariable("TEXT_INFO_LMS", $this->lng->txt('last_access'));
             $this->tpl->setVariable('INFO_LMS', ilDatePresentation::formatDate(new ilDateTime($continue_data[$lm_id]['last_access'], IL_CAL_UNIX)));
         } elseif ($obj_type == 'lm') {
             $this->tpl->setVariable("INFO_LMS", $this->lng->txt('not_accessed'));
         }
         if ($this->details_id) {
             $objectives_lm_obj->setLMRefId($lm_id);
             if ($objectives_lm_obj->checkExists()) {
                 $objectives_lm_obj =& new ilCourseObjectiveMaterials($this->details_id);
                 if ($conditions_ok) {
                     foreach ($objectives_lm_obj->getChapters() as $lm_obj_data) {
                         if ($lm_obj_data['ref_id'] != $lm_id) {
                             continue;
                         }
                         include_once './Modules/LearningModule/classes/class.ilLMObject.php';
                         $this->tpl->setCurrentBlock("chapters");
                         if ($lm_obj_data['type'] == 'st') {
                             $this->tpl->setVariable("TXT_CHAPTER", $this->lng->txt('chapter'));
                         } else {
                             $this->tpl->setVariable("TXT_CHAPTER", $this->lng->txt('page'));
                         }
                         $this->tpl->setVariable("CHAPTER_LINK_LMS", "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $lm_obj_data['ref_id'] . '&obj_id=' . $lm_obj_data['obj_id']);
                         $this->tpl->setVariable("CHAPTER_LINK_TARGET_LMS", $obj_frame);
                         $this->tpl->setVariable("CHAPTER_TITLE", ilLMObject::_lookupTitle($lm_obj_data['obj_id']));
                         $this->tpl->parseCurrentBlock();
                     }
                 }
                 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS", 'option_value_center_details');
                 $this->tpl->setVariable("OBJ_CLASS_LMS", 'option_value_details');
             } else {
                 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS", 'option_value_center');
                 $this->tpl->setVariable("OBJ_CLASS_LMS", 'option_value');
             }
         } else {
             $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS", 'option_value_center');
             $this->tpl->setVariable("OBJ_CLASS_LMS", 'option_value');
         }
         $this->tpl->setCurrentBlock("lm_row");
         $this->tpl->setVariable('IMG_TYPE_MAT', ilUtil::getImagePath('icon_' . $obj_type . '.png'));
         $this->tpl->setVariable('TXT_IMG_MAT', $this->lng->txt('obj_' . $obj_type));
         $this->tpl->setVariable("OBJ_NR_LMS", $counter . '.');
         $this->tpl->parseCurrentBlock();
         ++$counter;
     }
 }
 public function __appendChildLinks($html, $item, &$item_list_gui)
 {
     if (!count($item['child'])) {
         return $html;
     }
     $tpl = new ilTemplate('tpl.detail_links.html', true, true, 'Services/Search');
     switch ($item['type']) {
         case 'lm':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 switch (ilLMObject::_lookupType($child)) {
                     case 'pg':
                         $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_pg'));
                         break;
                     case 'st':
                         $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_st'));
                         break;
                 }
                 $item_list_gui->setChildId($child);
                 $tpl->setVariable("SEPERATOR", ' -> ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('page'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame('page'));
                 $tpl->setVariable("TITLE", ilLMObject::_lookupTitle($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'frm':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Forum/classes/class.ilObjForum.php';
             foreach ($item['child'] as $child) {
                 $thread_post = explode('_', $child);
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('thread'));
                 $item_list_gui->setChildId($thread_post);
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('posting'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame(''));
                 $tpl->setVariable("TITLE", ilObjForum::_lookupThreadSubject($thread_post[0]));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'glo':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Glossary/classes/class.ilGlossaryTerm.php';
             $this->lng->loadLanguageModule('content');
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('cont_term'));
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'git', array('target' => 'git_' . $child . '_' . $item['ref_id'])));
                 $tpl->setVariable("TITLE", ilGlossaryTerm::_lookGlossaryTerm($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'wiki':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once './Modules/Wiki/classes/class.ilWikiPage.php';
             include_once './Modules/Wiki/classes/class.ilWikiUtil.php';
             $this->lng->loadLanguageModule('wiki');
             foreach ($item['child'] as $child) {
                 $page_title = ilWikiPage::lookupTitle($child);
                 $tpl->setCurrentBlock("link_row");
                 $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('wiki_page'));
                 $tpl->setVariable("SEPERATOR", ': ');
                 $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'wiki', array(), "_" . ilWikiUtil::makeUrlTitle($page_title)));
                 $tpl->setVariable("TITLE", $page_title);
                 $tpl->parseCurrentBlock();
             }
             break;
         case 'mcst':
             $tpl->setVariable("HITS", $this->lng->txt('search_hits'));
             include_once "./Services/News/classes/class.ilNewsItem.php";
             foreach ($item['child'] as $child) {
                 $tpl->setCurrentBlock("link_row");
                 //$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('item'));
                 $item_list_gui->setChildId($child);
                 //$tpl->setVariable("SEPERATOR",': ');
                 $tpl->setVariable("LINK", $item_list_gui->getCommandLink('listItems'));
                 $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame(''));
                 $tpl->setVariable("TITLE", ilNewsItem::_lookupTitle($child));
                 $tpl->parseCurrentBlock();
             }
             break;
         default:
     }
     return $html . $tpl->get();
 }
 /**
  * render objective
  *
  * @access protected
  * @param int objective id
  * @param bool co page status
  * @param ilAccordionGUI $a_accordion 
  * @param array $a_lo_result 
  * @return string html
  */
 protected function renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion = null, array $a_lo_result = null)
 {
     global $ilUser, $lng;
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
     include_once './Services/Container/classes/class.ilContainerSorting.php';
     include_once './Services/Object/classes/class.ilObjectActivation.php';
     $items = ilObjectActivation::getItemsByObjective($a_objective_id);
     // sorting is handled by ilCourseObjectiveMaterials
     // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
     include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
     $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
     // #13381 - map material assignment to position
     $sort_map = array();
     foreach ($objectives_lm_obj->getMaterials() as $item) {
         $sort_map[$item["lm_ass_id"]] = $item["position"];
     }
     $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
     $is_order = $this->getContainerGUI()->isActiveOrdering();
     $sort_content = array();
     foreach ($items as $item) {
         if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
             continue;
         }
         $item_list_gui2 = $this->getItemGUI($item);
         $item_list_gui2->enableIcon(true);
         if ($is_order || $a_accordion) {
             $item_list_gui2->enableCommands(true, true);
             $item_list_gui2->enableProperties(false);
         }
         $chapters = $objectives_lm_obj->getChapters();
         if (count($chapters)) {
             $has_sections = false;
             foreach ($chapters as $chapter) {
                 if ($chapter['ref_id'] != $item['child']) {
                     continue;
                 }
                 $has_sections = true;
                 include_once './Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = $item['title'] . " &rsaquo; " . ilLMObject::_lookupTitle($chapter['obj_id']) . " (" . $lng->txt('obj_' . $chapter['type']) . ")";
                 $item_list_gui2->setDefaultCommandParameters(array("obj_id" => $chapter['obj_id'], "focus_id" => $chapter['obj_id'], "focus_return" => $this->container_obj->getRefId()));
                 if ($is_order) {
                     $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]", sprintf('%d', $chapter['position'] * 10));
                 }
                 $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $title, $item['description']);
                 // #13381 - use materials order
                 $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
                 $sort_content[$sort_key] = $sub_item_html;
             }
         }
         $this->rendered_items[$item['child']] = true;
         if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
             if ($is_order) {
                 $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]", sprintf('%d', $sort_map[$lm_ass_id] * 10));
             }
             $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']);
             // #13381 - use materials order
             $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
             $sort_content[$sort_key] = $sub_item_html;
         }
     }
     if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
         $this->objective_list_gui->enableCommands(false);
     } else {
         $this->objective_list_gui->enableCommands(true);
     }
     if ($is_order) {
         $this->objective_list_gui->setPositionInputField("[lobj][" . $a_objective_id . "][0]", $objective->__getPosition() * 10);
     }
     ksort($sort_content);
     if (!$a_accordion) {
         foreach ($sort_content as $sub_item_html) {
             $this->objective_list_gui->addSubItemHTML($sub_item_html);
         }
         return $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription(), $is_manage || $is_order);
     } else {
         $acc_content = $sort_content;
         $initial_shown = false;
         if ($this->getSettings()->hasSeparateInitialTests() and !$a_lo_result['initial_status']) {
             $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL), $a_objective_id, true, false, $a_lo_result);
             $initial_shown = TRUE;
         } elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
             $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED), $a_objective_id, false, false, $a_lo_result);
         }
         /*
         if($this->loc_settings->getInitialTest() &&
         	$this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
         	!$a_lo_result["initial_status"])
         {
         	$acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
         	$initial_shown = true;
         }	
         if(!$initial_shown &&
         	$this->loc_settings->getQualifiedTest() && 
         	$this->loc_settings->isQualifiedTestPerObjectiveVisible())
         {
         	$acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result);
         }
         */
         $co_page = null;
         include_once "./Services/COPage/classes/class.ilPageUtil.php";
         if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
             $a_has_lo_page = true;
             include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
             $page_gui = new ilLOPageGUI($objective->getObjectiveId());
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0));
             $page_gui->setPresentationTitle("");
             $page_gui->setTemplateOutput(false);
             $page_gui->setHeader("");
             $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
         }
         // patch optes start
         $a_accordion->addItem($this->buildAccordionTitle($objective, $a_lo_result), $co_page . $this->buildAccordionContent($acc_content), isset($_GET["oobj"]) && (int) $_GET["oobj"] == $objective->getObjectiveId());
         // patch optes end
     }
 }
 /**
  * render objective
  *
  * @access protected
  * @param int objective id
  * @return string html
  */
 protected function renderObjective($a_objective_id)
 {
     global $ilUser, $lng;
     include_once './Modules/Course/classes/class.ilCourseObjective.php';
     $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
     include_once './Services/Container/classes/class.ilContainerSorting.php';
     include_once './Services/Object/classes/class.ilObjectActivation.php';
     $items = ilObjectActivation::getItemsByObjective($a_objective_id);
     $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj', $a_objective_id, $items);
     include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
     $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
     $pos = 1;
     foreach ($items as $item) {
         if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
             continue;
         }
         $chapters = $objectives_lm_obj->getChapters();
         $item_list_gui2 = $this->getItemGUI($item);
         $item_list_gui2->enableIcon(true);
         if (count($chapters)) {
             $num = 0;
             $has_sections = false;
             foreach ($chapters as $chapter) {
                 if ($chapter['ref_id'] != $item['child']) {
                     continue;
                 }
                 $has_sections = true;
                 include_once './Modules/LearningModule/classes/class.ilLMObject.php';
                 $details[$num]['desc'] = $lng->txt('obj_' . $chapter['type']) . ' -> ';
                 $details[$num]['target'] = '_top';
                 $details[$num]['link'] = "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $chapter['ref_id'] . '&obj_id=' . $chapter['obj_id'];
                 $details[$num]['name'] = ilLMObject::_lookupTitle($chapter['obj_id']);
                 $num++;
             }
             if ($has_sections) {
                 $item_list_gui2->enableItemDetailLinks(true);
                 $item_list_gui2->setItemDetailLinks($details, $lng->txt('crs_suggested_sections') . ': ');
             }
         }
         if ($this->getContainerGUI()->isActiveAdministrationPanel()) {
             $item_list_gui2->enableCheckbox(true);
             if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL) {
                 $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $item["ref_id"] . "]", sprintf('%.1f', $pos));
                 $pos++;
             }
         }
         $this->rendered_items[$item['child']] = true;
         $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']);
         $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded());
         $this->objective_list_gui->addSubItemHTML($sub_item_html);
     }
     if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
         $this->objective_list_gui->enableCommands(false);
     } else {
         $this->objective_list_gui->enableCommands(true);
     }
     $html = $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription());
     return $html;
 }
 /**
  * delete page object or structure objects
  *
  * @param	int		$a_parent_subobj_id		id of parent object (structure object)
  *											of the objects, that should be deleted
  *											(or no parent object id for top level)
  */
 function confirmedDelete($a_parent_subobj_id = 0)
 {
     $tree = new ilTree($this->object->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     // check number of objects
     if (!$_POST["id"]) {
         $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
     }
     // delete all selected objects
     foreach ($_POST["id"] as $id) {
         if ($id != IL_FIRST_NODE) {
             $obj =& ilLMObjectFactory::getInstance($this->object, $id, false);
             $node_data = $tree->getNodeData($id);
             if (is_object($obj)) {
                 $obj->setLMId($this->object->getId());
                 include_once "./Services/History/classes/class.ilHistory.php";
                 ilHistory::_createEntry($this->object->getId(), "delete_" . $obj->getType(), array(ilLMObject::_lookupTitle($id), $id), $this->object->getType());
                 $obj->delete();
             }
             if ($tree->isInTree($id)) {
                 $tree->deleteTree($node_data);
             }
         }
     }
     // check the tree
     $this->object->checkTree();
     // feedback
     ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
     if ($a_parent_subobj_id == 0) {
         $this->ctrl->redirect($this, $_GET["backcmd"]);
     }
 }
 /**
  * paste page
  */
 function pastePage()
 {
     global $ilUser;
     if (!$ilUser->clipboardHasObjectsOfType("pg")) {
         $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"), $this->ilias->error_obj->MESSAGE);
     }
     return $this->insertPageClip();
     return;
     $tree = new ilTree($this->content_object->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     // paste selected object
     $id = ilEditClipboard::getContentObjectId();
     // copy page, if action is copy
     if (ilEditClipboard::getAction() == "copy") {
         // check wether page belongs to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) == $this->content_object->getID()) {
             $lm_page = new ilLMPageObject($this->content_object, $id);
             $new_page =& $lm_page->copy();
             $id = $new_page->getId();
         } else {
             // get page from other content object into current content object
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $copied_nodes = array();
             $new_page =& $lm_page->copyToOtherContObject($this->content_object, $copied_nodes);
             $id = $new_page->getId();
             ilLMObject::updateInternalLinks($copied_nodes);
         }
     }
     if (ilEditClipboard::getAction() == "cut") {
         // check wether page belongs not to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) != $this->content_object->getID()) {
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $lm_page->setLMId($this->content_object->getID());
             $lm_page->update();
             $page =& $lm_page->getPageObject();
             $page->buildDom();
             $page->setParentId($this->content_object->getID());
             $page->update();
         }
     }
     if (!$tree->isInTree($id)) {
         if (!isset($_POST["id"])) {
             $target = IL_FIRST_NODE;
         } else {
             $target = $_POST["id"][0];
         }
         $tree->insertNode($id, $this->obj->getId(), $target);
         ilEditClipboard::clear();
     }
     // write history comments
     include_once "./Services/History/classes/class.ilHistory.php";
     $parent_id = $tree->getParentId($id);
     ilHistory::_createEntry($id, "paste", array(ilLMObject::_lookupTitle($this->obj->getId()), $this->obj->getId()), $this->content_object->getType() . ":pg");
     ilHistory::_createEntry($parent_id, "paste_page", array(ilLMObject::_lookupTitle($id), $id), $this->content_object->getType() . ":st");
     // check the tree
     $this->checkTree();
     $this->ctrl->redirect($this, "view");
 }
Exemple #22
0
 /**
  * Copy a set of chapters/pages into the clipboard
  */
 static function clipboardCopy($a_cont_obj_id, $a_ids)
 {
     global $ilUser;
     $tree = ilLMObject::getTree($a_cont_obj_id);
     $ilUser->clipboardDeleteObjectsOfType("pg");
     $ilUser->clipboardDeleteObjectsOfType("st");
     // put them into the clipboard
     $time = date("Y-m-d H:i:s", time());
     foreach ($a_ids as $id) {
         $curnode = "";
         if ($tree->isInTree($id)) {
             $curnode = $tree->getNodeData($id);
             $subnodes = $tree->getSubTree($curnode);
             foreach ($subnodes as $subnode) {
                 if ($subnode["child"] != $id) {
                     $ilUser->addObjectToClipboard($subnode["child"], $subnode["type"], $subnode["title"], $subnode["parent"], $time, $subnode["lft"]);
                 }
             }
         }
         $order = $curnode["lft"] > 0 ? $curnode["lft"] : (int) ($order + 1);
         $ilUser->addObjectToClipboard($id, ilLMObject::_lookupType($id), ilLMObject::_lookupTitle($id), 0, $time, $order);
     }
 }
 /**
  * Show page
  *
  * @param
  * @return
  */
 function showPage()
 {
     global $lng;
     $page_id = (int) $_GET["help_page"];
     $h_tpl = new ilTemplate("tpl.help.html", true, true, "Services/Help");
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     $h_tpl->setCurrentBlock("backlink");
     $h_tpl->setVariable("TXT_BACK", $lng->txt("back"));
     $h_tpl->setVariable("ONCLICK_BACK", "return il.Help.listHelp(event, true);");
     $h_tpl->parseCurrentBlock();
     $h_tpl->setVariable("HEAD", $lng->txt("help") . " - " . ilLMObject::_lookupTitle($page_id));
     include_once "./Services/COPage/classes/class.ilPageUtil.php";
     if (!ilPageUtil::_existsAndNotEmpty("lm", $page_id)) {
         exit;
     }
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     // get page object
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     $page_gui =& new ilPageObjectGUI("lm", $page_id);
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     $page_gui->setHeader("");
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledPCTabs(false);
     $page_gui->setFileDownloadLink(".");
     $page_gui->setFullscreenLink(".");
     $page_gui->setSourcecodeDownloadScript(".");
     $page_gui->setRawPageContent(true);
     $page_gui->setEnabledMaps(false);
     $ret = $page_gui->showPage();
     $h_tpl->setVariable("CONTENT", $ret);
     $h_tpl->setVariable("CLOSE_IMG", ilUtil::img(ilUtil::getImagePath("icon_close2_s.png")));
     ilSession::set("help_pg", $page_id);
     $page = $h_tpl->get();
     // replace style classes
     //$page = str_replace("ilc_text_inline_Strong", "ilHelpStrong", $page);
     echo $page;
     exit;
 }