/** * execute command */ function &executeCommand() { global $lng, $ilAccess, $tpl, $ilNavigationHistory; $cmd = $this->ctrl->getCmd(); $next_class = $this->ctrl->getNextClass($this); if ($next_class == "") { $this->ctrl->setCmdClass("ilobjwikigui"); $next_class = $this->ctrl->getNextClass($this); } // add entry to navigation history if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $obj_id = ilObject::_lookupObjId($_GET["ref_id"]); $title = ilObject::_lookupTitle($obj_id); if ($_GET["page"] != "") { $page = $_GET["page"]; } else { include_once "./Modules/Wiki/classes/class.ilObjWiki.php"; $page = ilObjWiki::_lookupStartPage($obj_id); } include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; if (ilWikiPage::exists($obj_id, $page)) { include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $add = "_" . rawurlencode($page); $page_id = ilWikiPage::getPageIdForTitle($obj_id, $page); $ptitle = ilWikiPage::lookupTitle($page_id); $title .= ": " . $ptitle; $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($page) : ""; include_once './Services/Link/classes/class.ilLink.php'; $goto = ilLink::_getStaticLink($_GET["ref_id"], "wiki", true, $append); //var_dump($goto); $ilNavigationHistory->addItem($_GET["ref_id"], "./goto.php?target=wiki_" . $_GET["ref_id"] . $add, "wiki", $title, $page_id, $goto); } } switch ($next_class) { case 'ilobjwikigui': require_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php"; $mc_gui =& new ilObjWikiGUI("", (int) $_GET["ref_id"], true, false); $this->ctrl->forwardCommand($mc_gui); break; } $tpl->show(); }
/** * view wiki page */ function viewPageObject() { global $lng, $ilCtrl, $tpl, $ilTabs, $ilAccess; $this->checkPermission("read"); $ilTabs->clearTargets(); $tpl->setHeaderActionMenu(null); $page = $_GET["page"] != "" ? $_GET["page"] : $this->object->getStartPage(); $_GET["page"] = $page; include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; if (!ilWikiPage::exists($this->object->getId(), $page)) { $page = $this->object->getStartPage(); } if (!ilWikiPage::exists($this->object->getId(), $page)) { ilUtil::sendInfo($lng->txt("wiki_no_start_page"), true); $ilCtrl->redirect($this, "infoScreen"); return; } // page exists, show it ! $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($page)); include_once "./Modules/Wiki/classes/class.ilWikiPageGUI.php"; $wpage_gui = ilWikiPageGUI::getGUIForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($page), 0, $this->object->getRefId()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $wpage_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->object->getStyleSheetId(), "wiki")); $this->setContentStyleSheet(); //$wpage_gui->setOutputMode(IL_PAGE_PREVIEW); //$wpage_gui->setSideBlock(); $ilCtrl->setCmdClass("ilwikipagegui"); $ilCtrl->setCmd("preview"); if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()) && (!$ilAccess->checkAccess("edit_content", "", $this->object->getRefId()) || $wpage_gui->getPageObject()->getBlocked())) { $wpage_gui->setEnableEditing(false); } // alter title and description //$tpl->setTitle($wpage_gui->getPageObject()->getTitle()); //$tpl->setDescription($this->object->getTitle()); $html = $ilCtrl->forwardCommand($wpage_gui); //$this->addPageTabs(); $tpl->setContent($html); }
/** * update object data * * @access public * @return boolean */ function update($a_prevent_start_page_creation = false) { global $ilDB; if (!parent::update()) { return false; } $ilDB->update("il_wiki_data", array("is_online" => array("integer", $this->getOnline()), "startpage" => array("text", $this->getStartPage()), "short" => array("text", $this->getShortTitle()), "rating_overall" => array("integer", $this->getRatingOverall()), "rating" => array("integer", $this->getRating()), "rating_side" => array("integer", (bool) $this->getRatingAsBlock()), "rating_new" => array("integer", $this->getRatingForNewPages()), "rating_ext" => array("integer", $this->getRatingCategories()), "public_notes" => array("integer", $this->getPublicNotes()), "introduction" => array("clob", $this->getIntroduction()), "imp_pages" => array("integer", $this->getImportantPages()), "page_toc" => array("integer", $this->getPageToc()), "empty_page_templ" => array("integer", $this->getEmptyPageTemplate())), array("id" => array("integer", $this->getId()))); // check whether start page exists include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; if (!ilWikiPage::exists($this->getId(), $this->getStartPage()) && !$a_prevent_start_page_creation) { $start_page = new ilWikiPage(); $start_page->setWikiId($this->getId()); $start_page->setTitle($this->getStartPage()); $start_page->create(); } include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; ilObjStyleSheet::writeStyleUsage($this->getId(), $this->getStyleSheetId()); return true; }