/** * Create new wiki page * * @param string $a_page_title page title * @param int $a_template_page template page id * @return ilWikiPage new wiki page */ function createWikiPage($a_page_title, $a_template_page = 0) { // check if template has to be used if ($a_template_page == 0) { if (!$this->getEmptyPageTemplate()) { include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php"; $wt = new ilWikiPageTemplate($this->getId()); $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES); if (count($ts) == 1) { $t = current($ts); $a_template_page = $t["wpage_id"]; } } } // create the page $page = new ilWikiPage(); $page->setWikiId($this->getId()); $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title)); if ($this->getRating() && $this->getRatingForNewPages()) { $page->setRating(true); } // needed for notification $page->setWikiRefId($this->getRefId()); $page->create(); // copy template into new page if ($a_template_page > 0) { $orig = new ilWikiPage($a_template_page); $orig->copy($page->getId()); } return $page; }