/** * Export all pages * * @param string $a_target_directory * @param string $a_link_template (embedded) * @param array $a_tpl_callback (embedded) * @param object $a_co_page_html_export (embedded) * @param string $a_index_name (embedded) */ function exportHTMLPages($a_target_directory, $a_link_template = null, $a_tpl_callback = null, $a_co_page_html_export = null, $a_index_name = "index.html") { if (!$a_link_template) { $a_link_template = "bl{TYPE}_{ID}.html"; } if ($a_co_page_html_export) { $this->co_page_html_export = $a_co_page_html_export; } $nav = $this->renderNavigation($this->items, "", "", $a_link_template); // month list $has_index = false; foreach (array_keys($this->items) as $month) { $file = $this->buildExportLink($a_link_template, "list", $month); $list = $this->renderList($this->items[$month], $month, "render", $a_link_template); if (!$a_tpl_callback) { $tpl = $this->buildExportTemplate(); } else { $tpl = call_user_func($a_tpl_callback); } $file = $this->writeExportFile($a_target_directory, $file, $tpl, $list, $nav); if (!$has_index) { copy($file, $a_target_directory . "/" . $a_index_name); $has_index = true; } } // single postings include_once "./Services/COPage/classes/class.ilPageContentUsage.php"; include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $pages = ilBlogPosting::getAllPostings($this->object->getId(), 0); foreach ($pages as $page) { if (ilBlogPosting::_exists("blp", $page["id"])) { include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php"; $blp_gui = new ilBlogPostingGUI(0, null, $page["id"]); $blp_gui->setOutputMode("offline"); $blp_gui->add_date = true; $page_content = $blp_gui->showPage(); $back = $this->buildExportLink($a_link_template, "list", substr($page["created"]->get(IL_CAL_DATE), 0, 7)); $file = $this->buildExportLink($a_link_template, "posting", $page["id"]); if (!$a_tpl_callback) { $tpl = $this->buildExportTemplate(); } else { $tpl = call_user_func($a_tpl_callback); } $this->writeExportFile($a_target_directory, $file, $tpl, $page_content, $nav, $back); $this->co_page_html_export->collectPageElements("blp:pg", $page["id"]); } } $this->co_page_html_export->exportPageElements(); }
protected function renderBlog($a_user_id, $a_blog_id, array $a_posting_ids = null) { global $ilCtrl; // :TODO: what about user? // full blog (separate tab/page) if (!$a_posting_ids) { include_once "Modules/Blog/classes/class.ilObjBlogGUI.php"; $blog = new ilObjBlogGUI($a_blog_id, ilObject2GUI::WORKSPACE_OBJECT_ID); $blog->disableNotes(!$this->enable_comments); $blog->setContentStyleSheet(); if ($this->getOutputMode() != "offline") { return $ilCtrl->getHTML($blog); } else { } } else { $html = array(); include_once "Modules/Blog/classes/class.ilObjBlog.php"; $html[] = ilObjBlog::_lookupTitle($a_blog_id); include_once "Modules/Blog/classes/class.ilBlogPostingGUI.php"; foreach ($a_posting_ids as $post) { $page = new ilBlogPostingGUI(0, null, $post); if ($this->getOutputMode() != "offline") { $page->setOutputMode(IL_PAGE_PREVIEW); } else { $page->setOutputMode("offline"); } $html[] = $page->showPage(); } return implode("\n", $html); } }