Пример #1
0
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->lm = $a_lm;
     $this->lm_set = new ilSetting("lm");
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setData(ilLMPageObject::getPageList($this->lm->getId()));
     $this->setTitle($lng->txt("cont_pages"));
     $this->addColumn($this->lng->txt(""), "", "1");
     $this->addColumn($this->lng->txt("type"), "", "1");
     $this->addColumn($this->lng->txt("title"));
     $this->addColumn($this->lng->txt("cont_usage"));
     $this->setSelectAllCheckbox("id[]");
     if ($this->lm->getLayoutPerPage()) {
         $this->addColumn($this->lng->txt("cont_layout"));
     }
     $this->setLimit(9999);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.page_list_row.html", "Modules/LearningModule");
     if (ilEditClipboard::getContentObjectType() == "pg" && ilEditClipboard::getAction() == "copy") {
         $this->addMultiCommand("pastePage", $lng->txt("pastePage"));
     }
     if ($this->lm->getLayoutPerPage()) {
         $this->addMultiCommand("setPageLayout", $lng->txt("cont_set_layout"));
     }
     $this->addMultiCommand("activatePages", $lng->txt("cont_de_activate"));
     $this->addMultiCommand("movePage", $lng->txt("movePage"));
     $this->addMultiCommand("copyPage", $lng->txt("copyPage"));
     $this->addMultiCommand("delete", $lng->txt("delete"));
     $this->addMultiCommand("selectHeader", $lng->txt("selectHeader"));
     $this->addMultiCommand("selectFooter", $lng->txt("selectFooter"));
     //		$this->addCommandButton("", $lng->txt(""));
 }
Пример #2
0
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_validation = false, $a_oh_mode = false)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->setOnlineHelpMode($a_oh_mode);
     $this->setId("lm_expids");
     $this->validation = $a_validation;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     if ($this->getOnlineHelpMode()) {
         $this->setData(ilStructureObject::getChapterList($this->parent_obj->object->getId()));
         $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs($this->parent_obj->object->getId(), "st");
     } else {
         $this->setData(ilLMPageObject::getPageList($this->parent_obj->object->getId()));
         $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs($this->parent_obj->object->getId());
     }
     $this->setTitle($lng->txt("cont_html_export_ids"));
     $this->addColumn($this->lng->txt("pg"), "title");
     $this->addColumn($this->lng->txt("cont_export_id"));
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.export_id_row.html", "Modules/LearningModule");
     $this->setDefaultOrderField("title");
     $this->setDefaultOrderDirection("asc");
     $this->addCommandButton("saveExportIDs", $lng->txt("save"));
 }
 /**
  * Show link help list
  */
 function showLinkHelp()
 {
     global $ilUser, $ilCtrl;
     // filter link types
     if (!$this->filter_white_list) {
         foreach ($this->filter_link_types as $link_type) {
             unset($this->ltypes[$link_type]);
         }
     } else {
         $ltypes = array();
         foreach ($this->ltypes as $k => $l) {
             if (in_array($k, $this->filter_link_types)) {
                 $ltypes[$k] = $l;
             }
         }
         $this->ltypes = $ltypes;
     }
     // determine link type and target
     $this->determineLinkType();
     $ltype = $this->link_target != "" ? $this->link_type . "_" . $this->link_target : $this->link_type;
     $def_type = ilObject::_lookupType($this->default_obj, true);
     // determine content object id
     switch ($this->link_type) {
         case "PageObject":
         case "StructureObject":
             if (empty($_SESSION["il_link_cont_obj"]) && ($def_type != "mep" && $def_type != "glo")) {
                 $_SESSION["il_link_cont_obj"] = $this->default_obj;
             }
             break;
         case "GlossaryItem":
             if (empty($_SESSION["il_link_glossary"]) && $def_type == "glo") {
                 $_SESSION["il_link_glossary"] = $this->default_obj;
             }
             break;
         case "Media":
             if (empty($_SESSION["il_link_mep"]) && $def_type == "mep") {
                 $_SESSION["il_link_mep"] = $this->default_obj;
             }
             break;
     }
     /*
     		$target_str = ($link_target == "")
     			? ""
     			: " target=\"".$link_target."\" ";*/
     $target_str = $this->link_target == "" ? "" : " target=\"" . $this->link_target . "\"";
     //echo "-".$this->link_type."-";
     if ($this->link_type == "GlossaryItem" && (empty($_SESSION["il_link_glossary"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_glossary"], true), array("glo")))) {
         $this->changeTargetObject("glo");
     }
     if (($this->link_type == "PageObject" || $this->link_type == "StructureObject") && (empty($_SESSION["il_link_cont_obj"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk")))) {
         $this->changeTargetObject("cont_obj");
     }
     if ($ilCtrl->isAsynch()) {
         $tpl = new ilTemplate("tpl.link_help_asynch.html", true, true, "Modules/LearningModule");
     } else {
         $tpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule");
         $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     }
     switch ($this->link_type) {
         case "GlossaryItem":
             $this->ctrl->setParameter($this, "target_type", "glo");
             break;
         case "PageObject":
         case "StructureObject":
             $this->ctrl->setParameter($this, "target_type", "cont_obj");
             break;
         case "Media":
             $this->ctrl->setParameter($this, "target_type", "mep");
             break;
         default:
             break;
     }
     //echo "<br><br>:".$this->ctrl->getFormAction($this).":";
     //echo "<br>link_type:".$this->link_type;
     //echo "<br>cont_obj:".$_SESSION["il_link_cont_obj"];
     //echo "<br>link_mep".$_SESSION["il_link_mep"];
     //echo $this->ctrl->getFormAction($this, "", "", true);
     $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "changeLinkType", "", true));
     $tpl->setVariable("FORMACTION2", $this->ctrl->getFormAction($this));
     $tpl->setVariable("TXT_HELP_HEADER", $this->lng->txt("cont_link_select"));
     $tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_link_type"));
     //echo "<br><br>".$ltype;
     $select_ltype = ilUtil::formSelect($ltype, "ltype", $this->ltypes, false, true, "0", "", array("id" => "ilIntLinkTypeSelector"));
     $tpl->setVariable("SELECT_TYPE", $select_ltype);
     $tpl->setVariable("CMD_CHANGETYPE", "changeLinkType");
     $tpl->setVariable("BTN_CHANGETYPE", $this->lng->txt("cont_change_type"));
     /*		if ($this->isEnabledJavaScript())
     		{
     			$tpl->setVariable("BTN_CLOSE_JS", $this->lng->txt("close"));
     		}
     		else 
     		{*/
     $tpl->setVariable("CMD_CLOSE", "closeLinkHelp");
     $tpl->setVariable("BTN_CLOSE", $this->lng->txt("close"));
     //		}
     $chapterRowBlock = "chapter_row";
     $anchor_row_block = "anchor_link";
     if ($this->isEnabledJavaScript()) {
         $chapterRowBlock .= "_js";
         $anchor_row_block .= "_js";
     }
     $obj_id = ilObject::_lookupObjId($_SESSION["il_link_cont_obj"]);
     $type = ilObject::_lookupType($obj_id);
     // switch link type
     switch ($this->link_type) {
         // page link
         case "PageObject":
             require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
             include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
             $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true);
             // get all chapters
             $ctree = $cont_obj->getLMTree();
             $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
             $tpl->setCurrentBlock("chapter_list");
             $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj"));
             $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
             $tpl->setCurrentBlock("change_cont_obj");
             $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
             $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
             $tpl->parseCurrentBlock();
             foreach ($nodes as $node) {
                 if ($node["type"] == "st") {
                     $tpl->setCurrentBlock("chapter_row");
                     $tpl->setVariable("TXT_CHAPTER", $node["title"]);
                     $tpl->setVariable("ROWCLASS", "tblrow1");
                     //$tpl->setVariable("LINK_CHAPTER",
                     //	"[iln chap=\"".$node["obj_id"]."\"".$target_str."] [/iln]");
                     $tpl->parseCurrentBlock();
                     $tpl->setCurrentBlock("row");
                     $tpl->parseCurrentBlock();
                 }
                 if ($node["type"] == "pg") {
                     include_once "./Services/COPage/classes/class.ilPCParagraph.php";
                     $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPCParagraph::_readAnchors($type, $node["obj_id"], ""));
                 }
             }
             // get all free pages
             $pages = ilLMPageObject::getPageList($cont_obj->getId());
             $free_pages = array();
             foreach ($pages as $page) {
                 if (!$ctree->isInTree($page["obj_id"])) {
                     $free_pages[] = $page;
                 }
             }
             if (count($free_pages) > 0) {
                 $tpl->setCurrentBlock(str_replace("_js", "", $chapterRowBlock));
                 $tpl->setVariable("TXT_CHAPTER", $this->lng->txt("cont_free_pages"));
                 $tpl->setVariable("ROWCLASS", "tblrow1");
                 $tpl->parseCurrentBlock();
                 foreach ($free_pages as $node) {
                     include_once "./Services/COPage/classes/class.ilPCParagraph.php";
                     $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPCParagraph::_readAnchors($type, $node["obj_id"], ""));
                 }
             }
             $tpl->setCurrentBlock("chapter_list");
             $tpl->parseCurrentBlock();
             break;
             // chapter link
         // chapter link
         case "StructureObject":
             // check whether current object matchs to type
             if (!in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk"))) {
                 $this->changeTargetObject("lm");
             }
             if ($type == "lm") {
                 require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                 $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true);
             } else {
                 if ($type == "dbk") {
                     require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
                     $cont_obj = new ilObjDlBook($_SESSION["il_link_cont_obj"], true);
                 }
             }
             // get all chapters
             $ctree =& $cont_obj->getLMTree();
             $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
             $tpl->setCurrentBlock("chapter_list");
             $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj"));
             $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
             $tpl->setCurrentBlock("change_cont_obj");
             $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
             $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
             $tpl->parseCurrentBlock();
             foreach ($nodes as $node) {
                 if ($node["type"] == "st") {
                     $this->renderLink($tpl, $node["title"], $node["obj_id"], "StructureObject", "st", "chap");
                 }
             }
             $tpl->setCurrentBlock("chapter_list");
             $tpl->parseCurrentBlock();
             break;
             // glossary item link
         // glossary item link
         case "GlossaryItem":
             require_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
             $glossary =& new ilObjGlossary($_SESSION["il_link_glossary"], true);
             // get all glossary items
             $terms = $glossary->getTermList();
             $tpl->setCurrentBlock("chapter_list");
             $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("glossary"));
             $tpl->setVariable("TXT_CONT_TITLE", $glossary->getTitle());
             $tpl->setCurrentBlock("change_cont_obj");
             $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
             $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
             $tpl->parseCurrentBlock();
             foreach ($terms as $term) {
                 $this->renderLink($tpl, $term["term"], $term["id"], "GlossaryItem", "git", "term");
             }
             $tpl->setCurrentBlock("chapter_list");
             $tpl->parseCurrentBlock();
             break;
             // media object
         // media object
         case "Media":
             include_once "./Modules/MediaPool/classes/class.ilMediaPoolItem.php";
             //$tpl->setVariable("TARGET2", " target=\"content\" ");
             // content object id = 0 --> get clipboard objects
             if ($_SESSION["il_link_mep"] == 0) {
                 $tpl->setCurrentBlock("change_cont_obj");
                 $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
                 $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
                 $tpl->parseCurrentBlock();
                 $mobjs = $this->ilias->account->getClipboardObjects("mob");
                 // sort by name
                 $objs = array();
                 foreach ($mobjs as $obj) {
                     $objs[$obj["title"] . ":" . $obj["id"]] = $obj;
                 }
                 ksort($objs);
                 $tpl->setCurrentBlock("chapter_list");
                 $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_media_source"));
                 $tpl->setVariable("TXT_CONT_TITLE", $this->lng->txt("cont_personal_clipboard"));
                 $tpl->setVariable("COLSPAN", "2");
                 foreach ($objs as $obj) {
                     $this->renderLink($tpl, $obj["title"], $obj["id"], "MediaObject", "mob", "media");
                 }
                 $tpl->setCurrentBlock("chapter_list");
                 $tpl->parseCurrentBlock();
             } else {
                 require_once "./Modules/MediaPool/classes/class.ilObjMediaPool.php";
                 $med_pool =& new ilObjMediaPool($_SESSION["il_link_mep"], true);
                 // get current folders
                 $fobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "fold");
                 $f2objs = array();
                 foreach ($fobjs as $obj) {
                     $f2objs[$obj["title"] . ":" . $obj["child"]] = $obj;
                 }
                 ksort($f2objs);
                 // get current media objects
                 $mobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "mob");
                 $m2objs = array();
                 foreach ($mobjs as $obj) {
                     $m2objs[$obj["title"] . ":" . $obj["child"]] = $obj;
                 }
                 ksort($m2objs);
                 // merge everything together
                 $objs = array_merge($f2objs, $m2objs);
                 $tpl->setCurrentBlock("chapter_list");
                 $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("mep"));
                 $tpl->setVariable("TXT_CONT_TITLE", $med_pool->getTitle());
                 $tpl->setCurrentBlock("change_cont_obj");
                 $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
                 $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
                 $tpl->setVariable("COLSPAN", "2");
                 $tpl->parseCurrentBlock();
                 if ($parent_id = $med_pool->getParentId($_SESSION["il_link_mep_obj"])) {
                     $css_row = "tblrow1";
                     $tpl->setCurrentBlock("icon");
                     $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png"));
                     $tpl->parseCurrentBlock();
                     $tpl->setCurrentBlock("link_row");
                     $tpl->setVariable("ROWCLASS", $css_row);
                     $tpl->setVariable("TXT_CHAPTER", "..");
                     $this->ctrl->setParameter($this, "mep_fold", $parent_id);
                     if ($ilCtrl->isAsynch()) {
                         $tpl->setVariable("LINK", "#");
                         $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $parent_id . "');\" ");
                     } else {
                         $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder"));
                     }
                     $tpl->parseCurrentBlock();
                     $tpl->setCurrentBlock("row");
                     $tpl->parseCurrentBlock();
                 }
                 foreach ($objs as $obj) {
                     if ($obj["type"] == "fold") {
                         $css_row = $css_row == "tblrow2" ? "tblrow1" : "tblrow2";
                         $tpl->setCurrentBlock("icon");
                         $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png"));
                         $tpl->parseCurrentBlock();
                         $tpl->setCurrentBlock("link_row");
                         $tpl->setVariable("ROWCLASS", $css_row);
                         $tpl->setVariable("TXT_CHAPTER", $obj["title"]);
                         $this->ctrl->setParameter($this, "mep_fold", $obj["child"]);
                         if ($ilCtrl->isAsynch()) {
                             $tpl->setVariable("LINK", "#");
                             $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $obj["child"] . "');\" ");
                         } else {
                             $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder"));
                         }
                         $tpl->parseCurrentBlock();
                     } else {
                         $fid = ilMediaPoolItem::lookupForeignId($obj["child"]);
                         if (ilObject::_lookupType($fid) == "mob") {
                             $this->renderLink($tpl, $obj["title"], $fid, "MediaObject", "mob", "media");
                         }
                     }
                     $tpl->setCurrentBlock("row");
                     $tpl->parseCurrentBlock();
                 }
                 $tpl->setCurrentBlock("chapter_list");
                 $tpl->parseCurrentBlock();
             }
             break;
             // repository item
         // repository item
         case "RepositoryItem":
             $tpl->setVariable("LINK_HELP_CONTENT", $this->selectRepositoryItem());
             break;
             // file download link
         // file download link
         case "File":
             if (!is_object($this->uploaded_file)) {
                 $tpl->setVariable("LINK_HELP_CONTENT", $this->getFileLinkHTML());
             } else {
                 echo $this->getFileLinkHTML();
                 exit;
             }
             break;
     }
     if ($ilCtrl->isAsynch()) {
         echo $tpl->get();
         exit;
     }
     exit;
 }
 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();
 }
Пример #5
0
 function outPageSelector()
 {
     require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
     require_once 'Modules/LearningModule/classes/class.ilLMPageObject.php';
     require_once 'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
     $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
     $cont_obj_gui = new ilObjContentObjectGUI('', $_GET['source_id'], true);
     $cont_obj = $cont_obj_gui->object;
     $pages = ilLMPageObject::getPageList($cont_obj->getId());
     $shownpages = array();
     $tree = $cont_obj->getLMTree();
     $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
     $rows = array();
     foreach ($chapters as $chapter) {
         $chapterpages = $tree->getChildsByType($chapter['obj_id'], 'pg');
         foreach ($chapterpages as $page) {
             if ($page['type'] == $_GET['search_link_type']) {
                 array_push($shownpages, $page['obj_id']);
                 if ($tree->isInTree($page['obj_id'])) {
                     $path_str = $this->getContextPath($cont_obj, $page['obj_id']);
                 } else {
                     $path_str = '---';
                 }
                 $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
                 $rows[] = array('title' => $page['title'], 'description' => ilUtil::prepareFormOutput($path_str), 'text_add' => $this->lng->txt('add'), 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type'])));
             }
         }
     }
     foreach ($pages as $page) {
         if (!in_array($page['obj_id'], $shownpages)) {
             $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
             $rows[] = array('title' => $page['title'], 'description' => '---', 'text_add' => $this->lng->txt('add'), 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type'])));
         }
     }
     require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
     $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
     $table->setTitle($this->lng->txt('obj_' . ilUtil::stripSlashes($_GET['search_link_type'])));
     $table->setData($rows);
     $this->tpl->setContent($table->getHTML());
 }
Пример #6
0
 /**
  * Get all pages of lm that contain any internal links
  */
 function getPagesWithLinksList($a_lm_id, $a_par_type)
 {
     $pages = ilLMPageObject::getPageList($a_lm_id);
     $ids = array();
     foreach ($pages as $page) {
         $ids[] = $page["obj_id"];
     }
     $linked_pages = ilLMPage::getPagesWithLinks($a_par_type, $a_lm_id);
     $result = array();
     foreach ($pages as $page) {
         if (is_array($linked_pages[$page["obj_id"]])) {
             $result[] = $page;
         }
     }
     return $result;
 }
Пример #7
0
 function linkChilds()
 {
     global $ilTabs;
     $selectable_items = array();
     $source_id = $_GET["source_id"];
     switch ($_SESSION["search_link_type"]) {
         case "pg":
             include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
             include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
             $cont_obj_gui =& new ilObjContentObjectGUI("", $source_id, true);
             $cont_obj = $cont_obj_gui->object;
             $pages = ilLMPageObject::getPageList($cont_obj->getId());
             foreach ($pages as $page) {
                 if ($page["type"] == $_SESSION["search_link_type"]) {
                     $selectable_items[] = array("item_type" => $page["type"], "item_id" => $page["obj_id"], "title" => $page["title"]);
                 }
             }
             break;
         case "st":
             include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
             $cont_obj_gui =& new ilObjContentObjectGUI("", $source_id, true);
             $cont_obj = $cont_obj_gui->object;
             // get all chapters
             $ctree =& $cont_obj->getLMTree();
             $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
             foreach ($nodes as $node) {
                 if ($node["type"] == $_SESSION["search_link_type"]) {
                     $selectable_items[] = array("item_type" => $node["type"], "item_id" => $node["obj_id"], "title" => $node["title"]);
                 }
             }
             break;
         case "glo":
             include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
             $glossary =& new ilObjGlossary($source_id, true);
             // get all glossary items
             $terms = $glossary->getTermList();
             foreach ($terms as $term) {
                 $selectable_items[] = array("item_type" => "GIT", "item_id" => $term["id"], "title" => $term["term"]);
             }
             break;
         case "lm":
             $this->object->addInternalLink("il__lm_" . $source_id);
             break;
     }
     if (sizeof($selectable_items)) {
         $ilTabs->activateTab("material");
         $this->ctrl->setParameter($this, "q_id", $this->object->getId());
         $this->ctrl->setParameter($this, "source_id", $source_id);
         include_once "Modules/SurveyQuestionPool/classes/tables/class.SurveyMaterialsSourceTableGUI.php";
         $tbl = new SurveyMaterialsSourceTableGUI($this, "linkChilds", "addMaterial");
         $tbl->setData($selectable_items);
         $this->tpl->setContent($tbl->getHTML());
     } else {
         if ($_SESSION["search_link_type"] == "lm") {
             ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
             unset($_SESSION["link_new_type"]);
             unset($_SESSION["search_link_type"]);
             $this->ctrl->redirect($this, "material");
         } else {
             ilUtil::sendFailure($this->lng->txt("material_added_empty"), true);
             $this->ctrl->redirect($this, "addMaterial");
         }
     }
 }
 /**
  * Copy all pages and chapters
  *
  * @param object $a_target_obj target learning module
  */
 function copyAllPagesAndChapters($a_target_obj)
 {
     $parent_id = $a_target_obj->lm_tree->readRootId();
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // get all chapters of root lm
     $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), "st");
     $copied_nodes = array();
     //$time = time();
     foreach ($chapters as $chap) {
         $cid = ilLMObject::pasteTree($a_target_obj, $chap["child"], $parent_id, IL_LAST_NODE, $time, $copied_nodes, true, $this);
         $target = $cid;
     }
     // copy free pages
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $p) {
         if (!$this->lm_tree->isInTree($p["obj_id"])) {
             $item = new ilLMPageObject($this, $p["obj_id"]);
             $target_item = $item->copy($a_target_obj);
             $copied_nodes[$item->getId()] = $target_item->getId();
         }
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     $a_target_obj->checkTree();
 }
Пример #9
0
 /**
  * Copy all pages and chapters
  *
  * @param object $a_target_obj target learning module
  */
 function copyAllPagesAndChapters($a_target_obj, $a_copy_id = 0)
 {
     $parent_id = $a_target_obj->lm_tree->readRootId();
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // get all chapters of root lm
     $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), "st");
     $copied_nodes = array();
     //$time = time();
     foreach ($chapters as $chap) {
         $cid = ilLMObject::pasteTree($a_target_obj, $chap["child"], $parent_id, IL_LAST_NODE, $time, $copied_nodes, true, $this);
         $target = $cid;
     }
     // copy free pages
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $p) {
         if (!$this->lm_tree->isInTree($p["obj_id"])) {
             $item = new ilLMPageObject($this, $p["obj_id"]);
             $target_item = $item->copy($a_target_obj);
             $copied_nodes[$item->getId()] = $target_item->getId();
         }
     }
     // Add mapping for pages and chapters
     include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $options = ilCopyWizardOptions::_getInstance($a_copy_id);
     foreach ($copied_nodes as $old_id => $new_id) {
         $options->appendMapping($this->getRefId() . '_' . $old_id, $a_target_obj->getRefId() . '_' . $new_id);
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     $a_target_obj->checkTree();
 }
 function linkChilds()
 {
     switch ($_SESSION["search_link_type"]) {
         case "pg":
             include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
             include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
             $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
             $cont_obj = $cont_obj_gui->object;
             $pages = ilLMPageObject::getPageList($cont_obj->getId());
             $this->ctrl->setParameter($this, "q_id", $this->object->getId());
             $color_class = array("tblrow1", "tblrow2");
             $counter = 0;
             $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
             foreach ($pages as $page) {
                 if ($page["type"] == $_SESSION["search_link_type"]) {
                     $this->tpl->setCurrentBlock("linktable_row");
                     $this->tpl->setVariable("TEXT_LINK", $page["title"]);
                     $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
                     $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
                     $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                     $this->tpl->parseCurrentBlock();
                     $counter++;
                 }
             }
             $this->tpl->setCurrentBlock("link_selection");
             $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
             $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_SESSION["search_link_type"]));
             $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
             $this->tpl->parseCurrentBlock();
             break;
         case "st":
             $this->ctrl->setParameter($this, "q_id", $this->object->getId());
             $color_class = array("tblrow1", "tblrow2");
             $counter = 0;
             include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
             $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
             $cont_obj = $cont_obj_gui->object;
             // get all chapters
             $ctree =& $cont_obj->getLMTree();
             $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
             $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
             foreach ($nodes as $node) {
                 if ($node["type"] == $_SESSION["search_link_type"]) {
                     $this->tpl->setCurrentBlock("linktable_row");
                     $this->tpl->setVariable("TEXT_LINK", $node["title"]);
                     $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
                     $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($node["type"])) . "&" . $node["type"] . "=" . $node["obj_id"]);
                     $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                     $this->tpl->parseCurrentBlock();
                     $counter++;
                 }
             }
             $this->tpl->setCurrentBlock("link_selection");
             $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
             $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_SESSION["search_link_type"]));
             $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
             $this->tpl->parseCurrentBlock();
             break;
         case "glo":
             $this->ctrl->setParameter($this, "q_id", $this->object->getId());
             $color_class = array("tblrow1", "tblrow2");
             $counter = 0;
             $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
             include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
             $glossary =& new ilObjGlossary($_GET["source_id"], true);
             // get all glossary items
             $terms = $glossary->getTermList();
             foreach ($terms as $term) {
                 $this->tpl->setCurrentBlock("linktable_row");
                 $this->tpl->setVariable("TEXT_LINK", $term["term"]);
                 $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
                 $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "addGIT") . "&git=" . $term["id"]);
                 $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                 $this->tpl->parseCurrentBlock();
                 $counter++;
             }
             $this->tpl->setCurrentBlock("link_selection");
             $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
             $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("glossary_term"));
             $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
             $this->tpl->parseCurrentBlock();
             break;
         case "lm":
             $this->object->addInternalLink("il__lm_" . $_GET["source_id"]);
             unset($_SESSION["link_new_type"]);
             unset($_SESSION["search_link_type"]);
             ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
             $this->ctrl->redirect($this, "material");
             break;
     }
 }
 function outPageSelector()
 {
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
     $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
     $cont_obj = $cont_obj_gui->object;
     $pages = ilLMPageObject::getPageList($cont_obj->getId());
     $shownpages = array();
     $tree = $cont_obj->getLMTree();
     $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
     $this->ctrl->setParameter($this, "q_id", $this->object->getId());
     $color_class = array("tblrow1", "tblrow2");
     $counter = 0;
     $template = new ilTemplate("tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE, "Modules/TestQuestionPool");
     foreach ($chapters as $chapter) {
         $chapterpages = $tree->getChildsByType($chapter["obj_id"], "pg");
         foreach ($chapterpages as $page) {
             if ($page["type"] == $_GET["search_link_type"]) {
                 array_push($shownpages, $page["obj_id"]);
                 $template->setCurrentBlock("linktable_row");
                 $template->setVariable("TEXT_LINK", $page["title"]);
                 $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
                 $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
                 $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                 if ($tree->isInTree($page["obj_id"])) {
                     $path_str = $this->getContextPath($cont_obj, $page["obj_id"]);
                 } else {
                     $path_str = "---";
                 }
                 $template->setVariable("TEXT_DESCRIPTION", ilUtil::prepareFormOutput($path_str));
                 $template->parseCurrentBlock();
                 $counter++;
             }
         }
     }
     foreach ($pages as $page) {
         if (!in_array($page["obj_id"], $shownpages)) {
             $template->setCurrentBlock("linktable_row");
             $template->setVariable("TEXT_LINK", $page["title"]);
             $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
             $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
             $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
             $path_str = "---";
             $template->setVariable("TEXT_DESCRIPTION", ilUtil::prepareFormOutput($path_str));
             $template->parseCurrentBlock();
             $counter++;
         }
     }
     $template->setCurrentBlock("link_selection");
     $template->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
     $template->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_GET["search_link_type"]));
     $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "cancelExplorer"));
     $template->parseCurrentBlock();
     $this->tpl->setVariable("ADM_CONTENT", $template->get());
 }