/**
  * Export all pages
  */
 function exportHTMLPages()
 {
     global $tpl, $ilBench, $ilLocator;
     require_once "Services/Portfolio/classes/class.ilPortfolioPage.php";
     $pages = ilPortfolioPage::getAllPages($this->object->getId());
     $this->tabs = array();
     foreach ($pages as $page) {
         // substitute blog id with title
         if ($page["type"] == ilPortfolioPage::TYPE_BLOG) {
             include_once "Modules/Blog/classes/class.ilObjBlog.php";
             $page["title"] = ilObjBlog::_lookupTitle((int) $page["title"]);
         }
         $this->tabs[$page["id"]] = $page["title"];
     }
     // for sub-pages, e.g. blog postings
     $tpl_callback = array($this, "buildExportTemplate");
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $has_index = false;
     foreach ($pages as $page) {
         if (ilPageObject::_exists("prtf", $page["id"])) {
             $this->active_tab = "user_page_" . $page["id"];
             if ($page["type"] == ilPortfolioPage::TYPE_BLOG) {
                 $link_template = "prtf_" . $page["id"] . "_bl{TYPE}_{ID}.html";
                 include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
                 $blog = new ilObjBlogGUI((int) $page["title"], ilObject2GUI::WORKSPACE_OBJECT_ID);
                 $blog->exportHTMLPages($this->export_dir . "/", $link_template, $tpl_callback, $this->co_page_html_export, "prtf_" . $page["id"] . ".html");
             } else {
                 $this->exportPageHTML($page["id"]);
                 $this->co_page_html_export->collectPageElements("prtf:pg", $page["id"]);
             }
             if (!$has_index) {
                 copy($this->export_dir . "/prtf_" . $page["id"] . ".html", $this->export_dir . "/index.html");
                 $has_index = true;
             }
         }
     }
     $this->co_page_html_export->exportPageElements();
 }
 /**
  * Submit blog for assignment
  * 
  * @param int $a_blog_id
  * @return bool
  */
 function submitBlog($a_blog_id)
 {
     global $ilUser;
     if ($this->object && $this->ass) {
         $blog_id = $a_blog_id;
         include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
         $blog_gui = new ilObjBlogGUI($blog_id, ilObjBlogGUI::WORKSPACE_NODE_ID);
         if ($blog_gui->object) {
             $file = $blog_gui->buildExportFile();
             $size = filesize($file);
             if ($size) {
                 $this->removeExistingSubmissions();
                 $meta = array("name" => $blog_id, "tmp_name" => $file, "size" => $size);
                 $this->object->deliverFile($meta, $this->ass->getId(), $ilUser->getId(), true);
                 $this->sendNotifications($this->ass->getId());
                 $this->object->handleSubmission($this->ass->getId());
                 return true;
             }
         }
     }
     return false;
 }
 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);
     }
 }