/** * Search */ function performSearchObject() { global $tpl, $ilTabs, $ilCtrl, $lng; $this->checkPermission("read"); include_once "./Modules/Wiki/classes/class.ilWikiSearchResultsTableGUI.php"; $ilTabs->setTabActive("wiki_search_results"); if (trim($_POST["search_term"]) == "") { ilUtil::sendFailure($lng->txt("wiki_please_enter_search_term"), true); $ilCtrl->redirectByClass("ilwikipagegui", "preview"); } $search_results = ilObjWiki::_performSearch($this->object->getId(), ilUtil::stripSlashes($_POST["search_term"])); $table_gui = new ilWikiSearchResultsTableGUI($this, "performSearch", $this->object->getId(), $search_results, $_POST["search_term"]); $this->setSideBlock(); $tpl->setContent($table_gui->getHTML()); }
/** * Search wiki link list */ function searchWikiLinkAC() { global $lng; $lng->loadLanguageModule("wiki"); $tpl = new ilTemplate("tpl.wiki_ac_search_result.html", true, true, "Modules/Wiki"); $term = trim($_GET["term"]); $pages = ilObjWiki::_performSearch($this->getPageObject()->getParentId(), $term); $found = array(); foreach ($pages as $page) { $found[] = array("page_id" => $page["page_id"], "title" => ilWikiPage::lookupTitle($page["page_id"])); } // sort if all pages are listed if ($term == "") { $found = ilUtil::sortArray($found, "title", "asc"); } foreach ($found as $f) { $tpl->setCurrentBlock("item"); $tpl->setVariable("WIKI_TITLE", $f["title"]); $tpl->parseCurrentBlock(); } if (count($pages) == 0) { $tpl->setVariable("INFOTEXT", str_replace("\$1", $term, $lng->txt("wiki_no_page_found"))); } else { if ($term == '') { $tpl->setVariable("INFOTEXT", $lng->txt("wiki_no_search_term"), $term); } else { $tpl->setVariable("INFOTEXT", str_replace("\$1", $term, $lng->txt("wiki_pages_found"))); } } $tpl->setVariable("TXT_BACK", $lng->txt("back")); echo $tpl->get(); exit; }