/**
  * List templates
  */
 function listTemplates()
 {
     // list pages
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pages = ilWikiPage::getAllPages($this->wiki->getId());
     $options = array("" => $this->lng->txt("please_select"));
     foreach ($pages as $p) {
         //if (!in_array($p["id"], $ipages_ids))
         //{
         $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
         //}
     }
     $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
     $this->toolbar->setOpenFormTag(true);
     $this->toolbar->setCloseFormTag(false);
     if (count($options) > 0) {
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
         $si->setOptions($options);
         $this->toolbar->addInputItem($si);
         $this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
         $this->toolbar->addSeparator();
     }
     // empty page as template?
     include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
     $cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
     $cb->setChecked($this->wiki->getEmptyPageTemplate());
     $this->toolbar->addInputItem($cb, true);
     $this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
     include_once "./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php";
     $tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
     $tab->setOpenFormTag(false);
     $tab->setCloseFormTag(true);
     $this->tpl->setContent($tab->getHTML());
 }
 /**
  * Get pages for list.
  */
 function getPages()
 {
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pages = array();
     $this->setDefaultOrderField("title");
     switch ($this->pg_list_mode) {
         case IL_WIKI_WHAT_LINKS_HERE:
             $pages = ilWikiPage::getLinksToPage($this->wiki_id, $this->page_id);
             break;
         case IL_WIKI_ALL_PAGES:
             $pages = ilWikiPage::getAllPages($this->wiki_id);
             break;
         case IL_WIKI_NEW_PAGES:
             $this->setDefaultOrderField("created");
             $this->setDefaultOrderDirection("desc");
             $pages = ilWikiPage::getNewPages($this->wiki_id);
             break;
         case IL_WIKI_POPULAR_PAGES:
             $this->setDefaultOrderField("cnt");
             $this->setDefaultOrderDirection("desc");
             $pages = ilWikiPage::getPopularPages($this->wiki_id);
             break;
         case IL_WIKI_ORPHANED_PAGES:
             $pages = ilWikiPage::getOrphanedPages($this->wiki_id);
             break;
     }
     if ($pages) {
         // enable sorting
         include_once "./Services/User/classes/class.ilUserUtil.php";
         foreach (array_keys($pages) as $idx) {
             $pages[$idx]["user_sort"] = ilUserUtil::getNamePresentation($pages[$idx]["user"], false, false);
         }
     }
     $this->setData($pages);
 }
예제 #3
0
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pg_ids = array();
     foreach ($a_ids as $id) {
         $pages = ilWikiPage::getAllPages($id);
         foreach ($pages as $p) {
             if (ilWikiPage::_exists("wpg", $p["id"])) {
                 $pg_ids[] = "wpg:" . $p["id"];
             }
         }
     }
     $deps = array(array("component" => "Services/COPage", "entity" => "pg", "ids" => $pg_ids), array("component" => "Services/Rating", "entity" => "rating_category", "ids" => $a_ids));
     $advmd_ids = array();
     foreach ($a_ids as $id) {
         $rec_ids = $this->getActiveAdvMDRecords($id);
         if (sizeof($rec_ids)) {
             foreach ($rec_ids as $rec_id) {
                 $advmd_ids[] = $id . ":" . $rec_id;
             }
         }
     }
     if (sizeof($advmd_ids)) {
         $deps[] = array("component" => "Services/AdvancedMetaData", "entity" => "advmd", "ids" => $advmd_ids);
     }
     return $deps;
 }
예제 #4
0
 /**
  * Export all pages
  */
 function exportHTMLPages()
 {
     global $tpl, $ilBench, $ilLocator;
     $pages = ilWikiPage::getAllPages($this->wiki->getId());
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     foreach ($pages as $page) {
         if (ilWikiPage::_exists("wpg", $page["id"])) {
             $this->exportPageHTML($page["id"]);
             $this->co_page_html_export->collectPageElements("wpg:pg", $page["id"]);
         }
     }
     $this->co_page_html_export->exportPageElements();
 }
예제 #5
0
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pg_ids = array();
     foreach ($a_ids as $id) {
         $pages = ilWikiPage::getAllPages($id);
         foreach ($pages as $p) {
             if (ilWikiPage::_exists("wpg", $p["id"])) {
                 $pg_ids[] = "wpg:" . $p["id"];
             }
         }
     }
     return array(array("component" => "Services/COPage", "entity" => "pg", "ids" => $pg_ids), array("component" => "Services/Rating", "entity" => "rating_category", "ids" => $a_ids));
 }
예제 #6
0
 /**
  * Init print view selection form.
  */
 public function initPrintViewSelectionForm()
 {
     global $lng, $ilCtrl;
     $pages = ilWikiPage::getAllPages(ilObject::_lookupObjId($this->getWikiRefId()));
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     //var_dump($pages);
     // selection type
     $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
     $radg->setValue("page");
     $op1 = new ilRadioOption($lng->txt("cont_current_page"), "page");
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("wiki_whole_wiki") . " (" . $lng->txt("wiki_pages") . ": " . count($pages) . ")", "wiki");
     $radg->addOption($op2);
     $op3 = new ilRadioOption($lng->txt("wiki_selected_pages"), "selection");
     $radg->addOption($op3);
     include_once "./Services/Form/classes/class.ilNestedListInputGUI.php";
     $nl = new ilNestedListInputGUI("", "obj_id");
     $op3->addSubItem($nl);
     foreach ($pages as $p) {
         $nl->addListNode($p["id"], $p["title"], 0, false, false, ilUtil::getImagePath("icon_pg_s.png"), $lng->txt("wiki_page"));
     }
     $this->form->addItem($radg);
     $this->form->addCommandButton("printView", $lng->txt("cont_show_print_view"));
     //$this->form->setOpenTag(false);
     $this->form->setCloseTag(false);
     $this->form->setTitle($lng->txt("cont_print_selection"));
     //$this->form->setFormAction($ilCtrl->getFormAction($this));
 }
예제 #7
0
 /**
  * Get orphaned pages of wiki	
  *
  * @access	public
  */
 static function getOrphanedPages($a_wiki_id)
 {
     global $ilDB;
     $pages = ilWikiPage::getAllPages($a_wiki_id);
     include_once "./Services/COPage/classes/class.ilInternalLink.php";
     $orphaned = array();
     foreach ($pages as $k => $page) {
         $sources = ilInternalLink::_getSourcesOfTarget("wpg", $page["id"], 0);
         $ids = array();
         foreach ($sources as $source) {
             if ($source["type"] == "wpg:pg") {
                 $ids[] = $source["id"];
             }
         }
         $query = "SELECT count(*) cnt FROM il_wiki_page" . " WHERE " . $ilDB->in("id", $ids, false, "integer") . " AND wiki_id = " . $ilDB->quote($a_wiki_id, "integer") . " GROUP BY wiki_id";
         $set = $ilDB->query($query);
         $rec = $ilDB->fetchAssoc($set);
         if ($rec["cnt"] == 0 && ilObjWiki::_lookupStartPage($a_wiki_id) != $page["title"]) {
             $orphaned[] = $page;
         }
     }
     return $orphaned;
 }
예제 #8
0
 /**
  * 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;
         case "WikiPage":
             if (empty($_SESSION["il_link_wiki"]) && $def_type == "wiki") {
                 $_SESSION["il_link_wiki"] = $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 == "WikiPage" && (empty($_SESSION["il_link_wiki"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_wiki"], true), array("wiki")))) {
         $this->changeTargetObject("wiki");
     }
     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, "Services/Link");
     } else {
         $tpl =& new ilTemplate("tpl.link_help.html", true, true, "Services/Link");
         $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;
         case "WikiPage":
             $this->ctrl->setParameter($this, "target_type", "wiki");
             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"];
     $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("obj_lm"));
             $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
             $tpl->setVariable("THEAD", $this->lng->txt("pages"));
             $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("obj_lm"));
             $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
             $tpl->setVariable("THEAD", $this->lng->txt("link_chapters"));
             $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->setVariable("THEAD", $this->lng->txt("link_terms"));
             $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 = $ilUser->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("THEAD", $this->lng->txt("link_mobs"));
                 $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->setVariable("THEAD", $this->lng->txt("link_mobs"));
                 $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.svg"));
                     $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.svg"));
                         $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;
             // glossary item link
         // glossary item link
         case "WikiPage":
             $wiki_id = ilObject::_lookupObjId($_SESSION["il_link_wiki"]);
             require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
             $wpages = ilWikiPage::getAllPages($wiki_id);
             // get all glossary items
             $tpl->setCurrentBlock("chapter_list");
             $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("obj_wiki"));
             $tpl->setVariable("TXT_CONT_TITLE", ilObject::_lookupTitle($wiki_id));
             $tpl->setVariable("THEAD", $this->lng->txt("link_wpages"));
             $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 ($wpages as $wpage) {
                 $this->renderLink($tpl, $wpage["title"], $wpage["id"], "WikiPage", "wpage", "wpage");
             }
             $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;
 }
예제 #9
0
 /**
  * Count pages in wiki
  * 
  * @param int $a_wiki_id
  * @return int
  */
 protected static function countPages($a_wiki_id)
 {
     return sizeof(ilWikiPage::getAllPages($a_wiki_id));
 }
예제 #10
0
 /**
  * List important pages
  */
 function editImportantPagesObject()
 {
     global $tpl, $ilToolbar, $ilTabs, $lng, $ilCtrl;
     $this->checkPermission("write");
     ilUtil::sendInfo($lng->txt("wiki_navigation_info"));
     $ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());
     $ipages_ids = array();
     foreach ($ipages as $i) {
         $ipages_ids[] = $i["page_id"];
     }
     // list pages
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pages = ilWikiPage::getAllPages($this->object->getId());
     $options = array("" => $lng->txt("please_select"));
     foreach ($pages as $p) {
         if (!in_array($p["id"], $ipages_ids)) {
             $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
         }
     }
     if (count($options) > 0) {
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($lng->txt("wiki_pages"), "imp_page_id");
         $si->setOptions($options);
         $si->setInfo($lng->txt(""));
         $ilToolbar->addInputItem($si);
         $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
         $ilToolbar->addFormButton($lng->txt("add"), "addImportantPage");
     }
     $ilTabs->activateTab("settings");
     $this->setSettingsSubTabs("imp_pages");
     include_once "./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php";
     $imp_table = new ilImportantPagesTableGUI($this, "editImportantPages");
     $tpl->setContent($imp_table->getHTML());
 }
예제 #11
0
 /**
  * Clone wiki
  *
  * @param int target ref_id
  * @param int copy id
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser, $ilias;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setStartPage($this->getStartPage());
     $new_obj->setShortTitle($this->getShortTitle());
     $new_obj->setRatingOverall($this->getRatingOverall());
     $new_obj->setRating($this->getRating());
     $new_obj->setRatingAsBlock($this->getRatingAsBlock());
     $new_obj->setRatingForNewPages($this->getRatingForNewPages());
     $new_obj->setRatingCategories($this->getRatingCategories());
     $new_obj->setPublicNotes($this->getPublicNotes());
     $new_obj->setIntroduction($this->getIntroduction());
     $new_obj->setImportantPages($this->getImportantPages());
     $new_obj->setPageToc($this->getPageToc());
     $new_obj->update();
     // set/copy stylesheet
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $style_id = $this->getStyleSheetId();
     if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
         $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
         $new_id = $style_obj->ilClone();
         $new_obj->setStyleSheetId($new_id);
         $new_obj->update();
     }
     // copy content
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pages = ilWikiPage::getAllPages($this->getId());
     if (count($pages) > 0) {
         // if we have any pages, delete the start page first
         $pg_id = ilWikiPage::getPageIdForTitle($new_obj->getId(), $new_obj->getStartPage());
         $start_page = new ilWikiPage($pg_id);
         $start_page->delete();
     }
     $map = array();
     foreach ($pages as $p) {
         $page = new ilWikiPage($p["id"]);
         $new_page = new ilWikiPage();
         $new_page->setTitle($page->getTitle());
         $new_page->setWikiId($new_obj->getId());
         $new_page->setTitle($page->getTitle());
         $new_page->setBlocked($page->getBlocked());
         $new_page->setRating($page->getRating());
         $new_page->hideAdvancedMetadata($page->isAdvancedMetadataHidden());
         $new_page->create();
         $page->copy($new_page->getId(), "", 0, true);
         //$new_page->setXMLContent($page->copyXMLContent(true));
         //$new_page->buildDom(true);
         //$new_page->update();
         $map[$p["id"]] = $new_page->getId();
     }
     // copy important pages
     foreach (ilObjWiki::_lookupImportantPagesList($this->getId()) as $ip) {
         $new_obj->addImportantPage($map[$ip["page_id"]], $ip["ord"], $ip["indent"]);
     }
     // copy rating categories
     include_once "./Services/Rating/classes/class.ilRatingCategory.php";
     foreach (ilRatingCategory::getAllForObject($this->getId()) as $rc) {
         $new_rc = new ilRatingCategory();
         $new_rc->setParentId($new_obj->getId());
         $new_rc->setTitle($rc["title"]);
         $new_rc->setDescription($rc["description"]);
         $new_rc->save();
     }
     return $new_obj;
 }
예제 #12
0
 protected function printViewOrderList($a_pdf_export = false)
 {
     global $ilTabs;
     $pg_ids = $all_pages = array();
     // coming from type selection
     if (!is_array($_POST["wordr"])) {
         switch (trim($_POST["sel_type"])) {
             case "wiki":
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $all_pages = ilWikiPage::getAllPages($this->getPageObject()->getWikiId());
                 foreach ($all_pages as $p) {
                     $pg_ids[] = $p["id"];
                 }
                 break;
             case "selection":
                 if (is_array($_POST["obj_id"])) {
                     $pg_ids = $_POST["obj_id"];
                 } else {
                     $pg_ids[] = $_GET["wpg_id"];
                 }
                 if (sizeof($pg_ids) > 1) {
                     break;
                 } else {
                     $_GET["wpg_id"] = array_pop($pg_ids);
                 }
                 // fallthrough
                 // no order needed for single page
             // fallthrough
             // no order needed for single page
             default:
                 //case "page":
                 $this->ctrl->setParameterByClass("ilObjWikiGUI", "wpg_id", $_GET["wpg_id"]);
                 if ($a_pdf_export) {
                     $this->ctrl->redirectByClass("ilObjWikiGUI", "pdfExport");
                 } else {
                     $this->ctrl->redirectByClass("ilObjWikiGUI", "printView");
                 }
                 break;
         }
         if ($a_pdf_export) {
             $this->ctrl->setParameter($this, "pexp", 1);
         }
     } else {
         $a_pdf_export = (bool) $_GET["pexp"];
         asort($_POST["wordr"]);
         $pg_ids = array_keys($_POST["wordr"]);
     }
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "preview"));
     if (!sizeof($all_pages)) {
         include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
         $all_pages = ilWikiPage::getAllPages($this->getPageObject()->getWikiId());
     }
     include_once "Modules/Wiki/classes/class.ilWikiExportOrderTableGUI.php";
     $tbl = new ilWikiExportOrderTableGUI($this, "printViewOrderList", $a_pdf_export, $all_pages, $pg_ids);
     $this->tpl->setContent($tbl->getHTML());
 }