/** * 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); }
/** * Delete wiki page confirmation screen. */ function deleteWikiPageConfirmationScreen() { global $ilAccess, $tpl, $ilCtrl, $lng; if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $confirmation_gui = new ilConfirmationGUI(); $confirmation_gui->setFormAction($ilCtrl->getFormAction($this)); $confirmation_gui->setHeaderText($lng->txt("wiki_page_deletion_confirmation")); $confirmation_gui->setCancel($lng->txt("cancel"), "cancelWikiPageDeletion"); $confirmation_gui->setConfirm($lng->txt("delete"), "confirmWikiPageDeletion"); $dtpl = new ilTemplate("tpl.wiki_page_deletion_confirmation.html", true, true, "Modules/Wiki"); $dtpl->setVariable("PAGE_TITLE", $this->getWikiPage()->getTitle()); // other pages that link to this page $dtpl->setVariable("TXT_OTHER_PAGES", $lng->txt("wiki_other_pages_linking")); $pages = ilWikiPage::getLinksToPage($this->getWikiPage()->getWikiId(), $this->getWikiPage()->getId()); if (count($pages) > 0) { foreach ($pages as $page) { $dtpl->setCurrentBlock("lpage"); $dtpl->setVariable("TXT_LINKING_PAGE", $page["title"]); $dtpl->parseCurrentBlock(); } } else { $dtpl->setCurrentBlock("lpage"); $dtpl->setVariable("TXT_LINKING_PAGE", "-"); $dtpl->parseCurrentBlock(); } // contributors $dtpl->setVariable("TXT_CONTRIBUTORS", $lng->txt("wiki_contributors")); $contributors = ilWikiPage::getPageContributors($this->getWikiPage()->getId()); foreach ($contributors as $contributor) { $dtpl->setCurrentBlock("contributor"); $dtpl->setVariable("TXT_CONTRIBUTOR", $contributor["lastname"] . ", " . $contributor["firstname"]); $dtpl->parseCurrentBlock(); } // notes/comments include_once "./Services/Notes/classes/class.ilNote.php"; $cnt_note_users = ilNote::getUserCount($this->getPageObject()->getParentId(), $this->getPageObject()->getId(), "wpg"); $dtpl->setVariable("TXT_NUMBER_USERS_NOTES_OR_COMMENTS", $lng->txt("wiki_number_users_notes_or_comments")); $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users); $confirmation_gui->addItem("", "", $dtpl->get()); $tpl->setContent($confirmation_gui->getHTML()); } }
/** * delete wiki page and al related data * * @access public */ function delete() { global $ilDB; // get other pages that link to this page $linking_pages = ilWikiPage::getLinksToPage($this->getWikiId(), $this->getId()); // delete internal links information to this page include_once "./Services/COPage/classes/class.ilInternalLink.php"; ilInternalLink::_deleteAllLinksToTarget("wpg", $this->getId()); include_once "./Services/Notification/classes/class.ilNotification.php"; ilWikiUtil::sendNotification("delete", ilNotification::TYPE_WIKI_PAGE, $this->getWikiRefId(), $this->getId()); // remove all notifications include_once "./Services/Notification/classes/class.ilNotification.php"; ilNotification::removeForObject(ilNotification::TYPE_WIKI_PAGE, $this->getId()); // delete record of table il_wiki_data $query = "DELETE FROM il_wiki_page" . " WHERE id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($query); // delete co page parent::delete(); // make links of other pages to this page a missing link foreach ($linking_pages as $lp) { $ilDB->manipulateF("DELETE FROM il_wiki_missing_page " . " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ", array("integer", "integer", "text"), array($this->getWikiId(), $lp["id"], $this->getTitle())); $ilDB->manipulateF("INSERT INTO il_wiki_missing_page " . "(wiki_id, source_id, target_name) VALUES " . "(%s,%s,%s)", array("integer", "integer", "text"), array($this->getWikiId(), $lp["id"], $this->getTitle())); } return true; }