/**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     //var_dump($a_set);
     // icon...
     // check activation
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     $active = ilPageObject::_lookupActive($a_set["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation"));
     // is page scheduled?
     $img_sc = $this->lm_set->get("time_scheduled_page_activation") && ilPageObject::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()) ? "_sc" : "";
     if (!$active) {
         $img = "icon_pg_d" . $img_sc . ".png";
         $alt = $lng->txt("cont_page_deactivated");
     } else {
         if (ilPageObject::_lookupContainsDeactivatedElements($a_set["obj_id"], $this->lm->getType())) {
             $img = "icon_pg_del" . $img_sc . ".png";
             $alt = $lng->txt("cont_page_deactivated_elements");
         } else {
             $img = "icon_pg" . $img_sc . ".png";
             $alt = $this->lng->txt("pg");
         }
     }
     $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
     // title/link
     $ilCtrl->setParameter($this, "backcmd", "");
     $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
     $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit"));
     $this->tpl->setVariable("TITLE", $a_set["title"]);
     $this->tpl->setVariable("ID", $a_set["obj_id"]);
     // context
     if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) {
         $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
     } else {
         $path_str = "---";
     }
     // check whether page is header or footer
     $add_str = "";
     if ($a_set["obj_id"] == $this->lm->getHeaderPage()) {
         $add_str = " <b>(" . $lng->txt("cont_header") . ")</b>";
     }
     if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
         $add_str = " <b>(" . $lng->txt("cont_footer") . ")</b>";
     }
     $this->tpl->setVariable("USAGE", $path_str . $add_str);
     // layout
     if ($this->lm->getLayoutPerPage()) {
         if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") {
             $this->tpl->setVariable("LAYOUT", $lng->txt("cont_layout_" . $l));
         }
     }
 }
 /**
  * get image path (may be overwritten by derived classes)
  */
 function getImage($a_name, $a_type = "", $a_id = "")
 {
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     if ($a_type == "pg") {
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         $lm_set = new ilSetting("lm");
         $active = ilPageObject::_lookupActive($a_id, $this->lm_obj->getType(), $lm_set->get("time_scheduled_page_activation"));
         // is page scheduled?
         $img_sc = $lm_set->get("time_scheduled_page_activation") && ilPageObject::_isScheduledActivation($a_id, $this->lm_obj->getType()) ? "_sc" : "";
         $a_name = "icon_pg" . $img_sc . "_s.png";
         if (!$active) {
             $a_name = "icon_pg_d" . $img_sc . "_s.png";
         } else {
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             $contains_dis = ilPageObject::_lookupContainsDeactivatedElements($a_id, $this->lm_obj->getType());
             if ($contains_dis) {
                 $a_name = "icon_pg_del" . $img_sc . "_s.png";
             }
         }
     }
     return ilUtil::getImagePath($a_name, false, "output", $this->offlineMode());
 }
 /**
  * Get icon alt text
  *
  * @param	array		itema array
  * @return	string		icon alt text
  */
 function getChildIconAlt($a_item)
 {
     global $lng;
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     if ($a_item["type"] == "pg") {
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         $active = ilPageObject::_lookupActive($a_item["node_id"], $this->lm_type);
         if (!$active) {
             return $lng->txt("cont_page_deactivated");
         } else {
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             $contains_dis = ilPageObject::_lookupContainsDeactivatedElements($a_item["node_id"], $this->lm_type);
             if ($contains_dis) {
                 return $lng->txt("cont_page_deactivated_elements");
             }
         }
     }
     return ilUtil::getImagePath("icon_" . $a_item["type"] . ".png");
 }
 function view()
 {
     global $tree, $ilUser, $ilCtrl, $lng;
     if ($ilUser->getPref("lm_js_chapter_editing") != "disable") {
         $this->showHierarchy();
     } else {
         $this->setTabs();
         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
         $num = 0;
         $this->tpl->setCurrentBlock("form");
         $this->ctrl->setParameter($this, "backcmd", "view");
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages"));
         $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
         $cnt = 0;
         $childs = $this->tree->getChilds($this->obj->getId());
         foreach ($childs as $child) {
             if ($child["type"] != "pg") {
                 continue;
             }
             // check activation
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             $active = ilPageObject::_lookupActive($child["obj_id"], $this->content_object->getType());
             if (!$active) {
                 $this->tpl->setCurrentBlock("deactivated");
                 $this->tpl->setVariable("TXT_DEACTIVATED", $this->lng->txt("cont_page_deactivated"));
                 $this->tpl->parseCurrentBlock();
             } else {
                 if (ilPageObject::_lookupContainsDeactivatedElements($child["obj_id"], $this->content_object->getType())) {
                     $this->tpl->setCurrentBlock("deactivated");
                     $this->tpl->setVariable("TXT_DEACTIVATED", $this->lng->txt("cont_page_deactivated_elements"));
                     $this->tpl->parseCurrentBlock();
                 }
             }
             $this->tpl->setCurrentBlock("table_row");
             // color changing
             $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2");
             // checkbox
             $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg.png"));
             // link
             $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $child["obj_id"]);
             $link = $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit", "");
             $this->tpl->setVariable("LINK_TARGET", $link);
             // title
             $this->tpl->setVariable("TEXT_CONTENT", $child["title"]);
             $this->tpl->parseCurrentBlock();
         }
         if ($cnt == 0) {
             $this->tpl->setCurrentBlock("notfound");
             $this->tpl->setVariable("NUM_COLS", 3);
             $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
             $this->tpl->parseCurrentBlock();
         }
         //else
         //{
         // SHOW VALID ACTIONS
         $this->tpl->setVariable("NUM_COLS", 3);
         //$this->setActions(array("confirmTermDeletion" => "delete", "addDefinition" => "cont_add_definition"));
         $acts = array("delete" => "delete", "cutPage" => "cutPage", "copyPage" => "copyPage", "activatePages" => "cont_de_activate");
         //echo ":".$this->checkClipboardContentType().":<br>";
         if ($ilUser->clipboardHasObjectsOfType("pg")) {
             $acts["pastePage"] = "pastePage";
         }
         $this->showActions($acts);
         //}
         // SHOW POSSIBLE SUB OBJECTS
         $this->tpl->setVariable("NUM_COLS", 3);
         //$this->showPossibleSubObjects("st");
         $subobj = array("pg");
         $opts = ilUtil::formSelect(12, "new_type", $subobj);
         //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
         $this->tpl->setCurrentBlock("add_object");
         $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
         //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
         $this->tpl->setVariable("BTN_NAME", "create");
         $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("form");
         $this->tpl->parseCurrentBlock();
         $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
         $this->tpl->setVariable("HREF_JS_EDIT", $ilCtrl->getLinkTarget($this, "activateJSChapterEditing"));
         $this->tpl->setVariable("TXT_JS_EDIT", $lng->txt("cont_js_chap_editing"));
     }
 }
 function pages()
 {
     global $tree, $tpl, $ilToolbar, $ilCtrl, $lng;
     $this->setTabs();
     $this->setContentSubTabs("pages");
     if (!false) {
         $ilCtrl->setParameter($this, "backcmd", "pages");
         $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
         $ilToolbar->addButton($lng->txt("pg_add"), $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create"));
         $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
         include_once "./Modules/LearningModule/classes/class.ilLMPagesTableGUI.php";
         $t = new ilLMPagesTableGUI($this, "pages", $this->object);
         $tpl->setContent($t->getHTML());
         return;
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.all_pages.html", "Modules/LearningModule");
     $num = 0;
     $this->tpl->setCurrentBlock("form");
     $this->ctrl->setParameter($this, "backcmd", "pages");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages"));
     $this->tpl->setVariable("CONTEXT", $this->lng->txt("cont_usage"));
     $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
     $cnt = 0;
     $pages = ilLMPageObject::getPageList($this->object->getId());
     foreach ($pages as $page) {
         $this->tpl->setCurrentBlock("table_row");
         // check activation
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         $lm_set = new ilSetting("lm");
         $active = ilPageObject::_lookupActive($page["obj_id"], $this->object->getType(), $lm_set->get("time_scheduled_page_activation"));
         // is page scheduled?
         $img_sc = $lm_set->get("time_scheduled_page_activation") && ilPageObject::_isScheduledActivation($page["obj_id"], $this->object->getType()) ? "_sc" : "";
         if (!$active) {
             $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg_d" . $img_sc . ".png"));
             $this->tpl->setVariable("IMG_ALT", $this->lng->txt("cont_page_deactivated"));
         } else {
             if (ilPageObject::_lookupContainsDeactivatedElements($page["obj_id"], $this->object->getType())) {
                 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg_del" . $img_sc . ".png"));
                 $this->tpl->setVariable("IMG_ALT", $this->lng->txt("cont_page_deactivated_elements"));
             } else {
                 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg" . $img_sc . ".png"));
                 $this->tpl->setVariable("IMG_ALT", $this->lng->txt("pg"));
             }
         }
         // color changing
         $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2");
         // checkbox
         $this->tpl->setVariable("CHECKBOX_ID", $page["obj_id"]);
         $this->tpl->setVariable("CSS_ROW", $css_row);
         // link
         $this->ctrl->setParameter($this, "backcmd", "");
         $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $page["obj_id"]);
         //echo "<br>:".$this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "view").":";
         $this->tpl->setVariable("LINK_TARGET", $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit"));
         // title
         $this->tpl->setVariable("TEXT_CONTENT", $page["title"]);
         // context
         if ($this->lm_tree->isInTree($page["obj_id"])) {
             $path_str = $this->getContextPath($page["obj_id"]);
         } else {
             $path_str = "---";
         }
         // check whether page is header or footer
         $add_str = "";
         if ($page["obj_id"] == $this->object->getHeaderPage()) {
             $add_str = " <b>(" . $this->lng->txt("cont_header") . ")</b>";
         }
         if ($page["obj_id"] == $this->object->getFooterPage()) {
             $add_str = " <b>(" . $this->lng->txt("cont_footer") . ")</b>";
         }
         $this->tpl->setVariable("TEXT_CONTEXT", $path_str . $add_str);
         $this->tpl->parseCurrentBlock();
     }
     if ($cnt == 0) {
         $this->tpl->setCurrentBlock("notfound");
         $this->tpl->setVariable("NUM_COLS", 4);
         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
         $this->tpl->parseCurrentBlock();
     } else {
         $acts = array("delete" => "delete", "movePage" => "movePage", "copyPage" => "copyPage", "selectHeader" => "selectHeader", "selectFooter" => "selectFooter", "activatePages" => "cont_de_activate");
         if (ilEditClipboard::getContentObjectType() == "pg" && ilEditClipboard::getAction() == "copy") {
             $acts["pastePage"] = "pastePage";
         }
         /*
         			if (ilEditClipboard::getContentObjectType() == "st")
         			{
         				$acts["pasteChapter"] =  "pasteChapter";
         			}*/
         $this->tpl->setVariable("NUM_COLS", 4);
         $this->showActions($acts);
         // SHOW VALID ACTIONS
         /*
         			$this->tpl->setCurrentBlock("operation_btn");
         			$this->tpl->setVariable("BTN_NAME", "delete");
         			$this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
         			$this->tpl->parseCurrentBlock();*/
     }
     // SHOW POSSIBLE SUB OBJECTS
     $this->tpl->setVariable("NUM_COLS", 4);
     //$this->showPossibleSubObjects("st");
     $subobj = array("pg");
     $opts = ilUtil::formSelect(12, "new_type", $subobj);
     $this->tpl->setCurrentBlock("add_object");
     $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
     $this->tpl->setVariable("BTN_NAME", "create");
     $this->tpl->setVariable("TXT_ADD", $this->lng->txt("create"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("form");
     $this->tpl->parseCurrentBlock();
 }
 /**
  * get image alt text
  */
 function getImageAlt($a_default_text, $a_type = "", $a_id = "")
 {
     global $lng;
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     if ($a_type == "pg") {
         include_once "./Services/COPage/classes/class.ilPageObject.php";
         $lm_set = new ilSetting("lm");
         $active = ilPageObject::_lookupActive($a_id, $this->lm_obj->getType(), $lm_set->get("time_scheduled_page_activation"));
         if (!$active) {
             return $lng->txt("cont_page_deactivated");
         } else {
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             $contains_dis = ilPageObject::_lookupContainsDeactivatedElements($a_id, $this->lm_obj->getType());
             if ($contains_dis) {
                 return $lng->txt("cont_page_deactivated_elements");
             }
         }
     }
     return $a_default_text;
 }