/** * get image path (may be overwritten by derived classes) */ function getImage($a_name, $a_type = "", $a_id = "") { // overwrite chapter icons with lp info? if (!$this->offlineMode() && $a_type == "st") { $icon = $this->checkLPIcon($a_id); if ($icon) { return $icon; } } include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; if ($a_type == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_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") && ilLMPage::_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 { $contains_dis = ilLMPage::_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 node icon * * @param array $a_node node array * @return string icon path */ function getNodeIcon($a_node) { if ($a_node["child"] == $this->getNodeId($this->getRootNode())) { $icon = ilUtil::getImagePath("icon_lm.svg"); } else { $a_name = "icon_" . $a_node["type"] . ".svg"; if ($a_node["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()) ? "_sc" : ""; $a_name = "icon_pg" . $img_sc . ".svg"; if (!$active) { $a_name = "icon_pg_d" . $img_sc . ".svg"; } else { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_node["child"], $this->lm->getType()); if ($contains_dis) { $a_name = "icon_pg_del" . $img_sc . ".svg"; } } } $icon = ilUtil::getImagePath($a_name); } return $icon; }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl; //var_dump($a_set); // icon... // check activation include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_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") && ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()) ? "_sc" : ""; if (!$active) { $img = "icon_pg_d" . $img_sc . ".svg"; $alt = $lng->txt("cont_page_deactivated"); } else { if (ilLMPage::_lookupContainsDeactivatedElements($a_set["obj_id"], $this->lm->getType())) { $img = "icon_pg_del" . $img_sc . ".svg"; $alt = $lng->txt("cont_page_deactivated_elements"); } else { $img = "icon_pg" . $img_sc . ".svg"; $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)); } } }
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 "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_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") && ilLMPage::_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 (ilLMPage::_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 icon path for an item. * * @param array itema array * @return string icon path */ function getChildIcon($a_item) { include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; $img = "icon_" . $a_item["type"] . ".png"; if ($a_item["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type, $lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_item["node_id"], $this->lm_type) ? "_sc" : ""; $img = "icon_pg" . $img_sc . ".png"; if (!$active) { $img = "icon_pg_d" . $img_sc . ".png"; } else { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_item["node_id"], $this->lm_type); if ($contains_dis) { $img = "icon_pg_del" . $img_sc . ".png"; } } } return ilUtil::getImagePath($img); }
/** * Get node icon * * @param array $a_node node array * @return string icon path */ function getNodeIcon($a_node) { // overwrite chapter icons with lp info? if (!$this->getOfflineMode() && $a_node["type"] == "st") { $icon = $this->checkLPIcon($a_node["child"]); if ($icon != "") { return $icon; } } // use progress icons (does not depend on lp mode) if (!$this->getOfflineMode() && $this->lm->getProgressIcons()) { return $this->tracker->getIconForLMObject($a_node, $this->highlight_node); } include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; if ($a_node["type"] == "du") { $a_node["type"] = "lm"; } $a_name = "icon_" . $a_node["type"] . ".svg"; if ($a_node["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()) && !$active && !$this->getOfflineMode() ? "_sc" : ""; $a_name = "icon_pg" . $img_sc . ".svg"; if (!$active && !$this->getOfflineMode()) { $a_name = "icon_pg_d" . $img_sc . ".svg"; } } return ilUtil::getImagePath($a_name, false, "output", $this->getOfflineMode()); }