/**
  * Export page html
  */
 function exportPageHTML($a_page_id)
 {
     global $ilUser, $lng, $ilTabs;
     $ilTabs->clearTargets();
     $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
     $this->tpl->getStandardTemplate();
     $file = $this->export_dir . "/wpg_" . $a_page_id . ".html";
     // return if file is already existing
     if (@is_file($file)) {
         return;
     }
     // page
     include_once "./Modules/Wiki/classes/class.ilWikiPageGUI.php";
     $wpg_gui = new ilWikiPageGUI($a_page_id);
     $wpg_gui->setOutputMode("offline");
     $page_content = $wpg_gui->showPage();
     // export template: page content
     $ep_tpl = new ilTemplate("tpl.export_page.html", true, true, "Modules/Wiki");
     $ep_tpl->setVariable("PAGE_CONTENT", $page_content);
     // export template: right content
     include_once "./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php";
     $bl = new ilWikiImportantPagesBlockGUI();
     $ep_tpl->setVariable("RIGHT_CONTENT", $bl->getHTML(true));
     // workaround
     //		$this->tpl->setVariable("MAINMENU", "<div style='min-height:40px;'></div>");
     $this->tpl->setVariable("MAINMENU", "");
     $this->tpl->setTitle($this->wiki->getTitle());
     $this->tpl->setTitleIcon("./images/icon_wiki.svg", $lng->txt("obj_wiki"));
     $this->tpl->setContent($ep_tpl->get());
     //$this->tpl->fillMainContent();
     $content = $this->tpl->get("DEFAULT", false, false, false, true, true, true);
     //echo htmlentities($content); exit;
     // open file
     if (!($fp = @fopen($file, "w+"))) {
         die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
     }
     // set file permissions
     chmod($file, 0770);
     // write xml data into the file
     fwrite($fp, $content);
     // close file
     fclose($fp);
     if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle()) {
         copy($file, $this->export_dir . "/index.html");
     }
 }
Esempio n. 2
0
 /**
  * Side column
  */
 static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null)
 {
     global $tpl, $lng;
     if ($a_wpg_id > 0 && !$a_wp) {
         include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
         $a_wp = ilWikiPage($a_wpg_id);
     }
     // search block
     include_once "./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php";
     $wiki_search_block = new ilWikiSearchBlockGUI();
     $rcontent = $wiki_search_block->getHTML();
     // quick navigation
     if ($a_wpg_id > 0) {
         //			include_once("./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php");
         //			$wiki_side_block = new ilWikiSideBlockGUI();
         //			$wiki_side_block->setPageObject($a_wp);
         //			$rcontent.= $wiki_side_block->getHTML();
         // rating
         $wiki_id = ilObject::_lookupObjId($a_wiki_ref_id);
         if (ilObjWiki::_lookupRating($wiki_id) && $a_wp->getRating()) {
             include_once "./Services/Rating/classes/class.ilRatingGUI.php";
             $rgui = new ilRatingGUI();
             $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg");
             $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id));
             $rgui->setYourRatingText("#");
             $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page"));
         }
         // advanced metadata
         include_once "./Modules/Wiki/classes/class.ilWikiAdvMetaDataBlockGUI.php";
         if (ilWikiAdvMetaDataBlockGUI::isActive($wiki_id)) {
             $rec_ids = ilWikiAdvMetaDataBlockGUI::getRecords($wiki_id);
             foreach ($rec_ids as $record) {
                 $advmd_pages_block = new ilWikiAdvMetaDataBlockGUI($record);
                 $advmd_pages_block->setObject($a_wiki_ref_id, $wiki_id, $a_wpg_id);
                 $rcontent .= $advmd_pages_block->getHTML();
             }
         }
     }
     // important pages
     //		if (ilObjWiki::_lookupImportantPages(ilObject::_lookupObjId($a_wiki_ref_id)))
     //		{
     include_once "./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php";
     $imp_pages_block = new ilWikiImportantPagesBlockGUI();
     $rcontent .= $imp_pages_block->getHTML();
     //		}
     // wiki functions block
     if ($a_wpg_id > 0) {
         include_once "./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php";
         $wiki_functions_block = new ilWikiFunctionsBlockGUI();
         $wiki_functions_block->setPageObject($a_wp);
         $rcontent .= $wiki_functions_block->getHTML();
     }
     $tpl->setRightContent($rcontent);
 }