/**
  * 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();
 }
 function getTabs($a_activate = "")
 {
     global $ilTabs, $ilCtrl;
     parent::getTabs($a_activate);
     $ilCtrl->setParameterByClass("ilobjwikigui", "wpg_id", ilWikiPage::getPageIdForTitle($this->getPageObject()->getParentId(), ilWikiUtil::makeDbTitle($_GET["page"])));
     $ilCtrl->setParameterByClass("ilobjwikigui", "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
     $ilTabs->addTarget("wiki_what_links_here", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "whatLinksHere"), "whatLinksHere");
     //$ilTabs->addTarget("wiki_print_view",
     //	$this->ctrl->getLinkTargetByClass("ilobjwikigui",
     //	"printViewSelection"), "printViewSelection");
     $ilTabs->addTarget("wiki_print_view", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "printViewSelection"), "printViewSelection");
 }
 /**
  * Add Pages SubTabs
  */
 function addPagesSubTabs()
 {
     global $ilTabs, $ilCtrl;
     $ilTabs->activateTab("wiki_pages");
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $ilCtrl->setParameter($this, "wpg_id", ilWikiPage::getPageIdForTitle($this->object->getId(), ilWikiUtil::makeDbTitle($_GET["page"])));
     $ilCtrl->setParameter($this, "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
     $ilTabs->addSubTabTarget("wiki_all_pages", $this->ctrl->getLinkTarget($this, "allPages"), "allPages");
     $ilTabs->addSubTabTarget("wiki_recent_changes", $this->ctrl->getLinkTarget($this, "recentChanges"), "recentChanges");
     $ilTabs->addSubTabTarget("wiki_new_pages", $this->ctrl->getLinkTarget($this, "newPages"), "newPages");
     $ilTabs->addSubTabTarget("wiki_popular_pages", $this->ctrl->getLinkTarget($this, "popularPages"), "popularPages");
     $ilTabs->addSubTabTarget("wiki_orphaned_pages", $this->ctrl->getLinkTarget($this, "orphanedPages"), "orphanedPages");
 }
Exemple #4
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;
 }
 function getTabs($a_activate = "")
 {
     global $ilTabs, $ilCtrl, $ilAccess;
     parent::getTabs($a_activate);
     if ($ilAccess->checkAccess("statistics_read", "", $_GET["ref_id"])) {
         $ilTabs->addTarget("statistics", $this->ctrl->getLinkTargetByClass(array("ilwikipagegui", "ilwikistatgui"), "initial"), "", "ilwikistatgui");
     }
     $ilCtrl->setParameterByClass("ilobjwikigui", "wpg_id", ilWikiPage::getPageIdForTitle($this->getPageObject()->getParentId(), ilWikiUtil::makeDbTitle($_GET["page"])));
     $ilCtrl->setParameterByClass("ilobjwikigui", "page", ilWikiUtil::makeUrlTitle($_GET["page"]));
     $ilTabs->addTarget("wiki_what_links_here", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "whatLinksHere"), "whatLinksHere");
     //$ilTabs->addTarget("wiki_print_view",
     //	$this->ctrl->getLinkTargetByClass("ilobjwikigui",
     //	"printViewSelection"), "printViewSelection");
     $ilTabs->addTarget("wiki_print_view", $this->ctrl->getLinkTargetByClass("ilwikipagegui", "printViewSelection"), "printViewSelection");
 }