/** * Fill table row */ protected function fillRow($a_set) { global $lng, $lng, $ilCtrl; switch ($a_set["type"]) { case ilPortfolioPage::TYPE_PAGE: $this->tpl->setCurrentBlock("title_field"); $this->tpl->setVariable("ID", $a_set["id"]); $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"])); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("action"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit_page")); $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", $a_set["id"]); $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilportfoliopagegui", "edit")); $this->tpl->parseCurrentBlock(); break; case ilPortfolioPage::TYPE_BLOG: $this->tpl->setCurrentBlock("title_static"); $this->tpl->setVariable("VAL_TITLE", $lng->txt("obj_blog") . ": " . ilObjBlog::_lookupTitle($a_set["title"])); $this->tpl->parseCurrentBlock(); $obj_id = (int) $a_set["title"]; if (isset($this->blogs[$obj_id])) { $node_id = $this->blogs[$obj_id]; $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id); $ilCtrl->setParameterByClass("ilportfoliopagegui", "ppage", $a_set["id"]); $link = $ilCtrl->getLinkTargetByClass(array("ilportfoliopagegui", "ilobjbloggui"), "edit"); $this->tpl->setCurrentBlock("action"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("blog_edit")); $this->tpl->setVariable("CMD_EDIT", $link); $this->tpl->parseCurrentBlock(); } break; } $this->tpl->setVariable("ID", $a_set["id"]); $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]); }
/** * 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(); }
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); } }
/** * Show user page */ function preview($a_return = false, $a_content = false, $a_show_notes = true) { global $ilSetting; $portfolio_id = $this->object->getId(); $user_id = $this->object->getOwner(); $this->tabs_gui->clearTargets(); $pages = ilPortfolioPage::getAllPages($portfolio_id); $current_page = (int) $_GET["user_page"]; // validate current page if ($pages && $current_page) { $found = false; foreach ($pages as $page) { if ($page["id"] == $current_page) { $found = true; break; } } if (!$found) { $current_page = null; } } // display first page of portfolio if none given if (!$current_page && $pages) { $current_page = $pages; $current_page = array_shift($current_page); $current_page = $current_page["id"]; } // #13788 - keep page after login if ($this->user_id == ANONYMOUS_USER_ID && $this->getType() == "prtf") { $this->tpl->setLoginTargetPar("prtf_" . $this->object->getId() . "_" . $current_page); } // public profile if ($_REQUEST["back_url"]) { $back = $_REQUEST["back_url"]; } else { if ($_GET["baseClass"] != "ilPublicUserProfileGUI" && $this->user_id && $this->user_id != ANONYMOUS_USER_ID) { if (!$this->checkPermissionBool("write")) { // shared if ($this->getType() == "prtf") { $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->object->getOwner()); $back = $this->ctrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "showOther"); $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", ""); } else { // #12819 global $tree; $parent_id = $tree->getParentId($this->node_id); include_once "Services/Link/classes/class.ilLink.php"; $back = ilLink::_getStaticLink($parent_id); } } else { $back = $this->ctrl->getLinkTarget($this, "view"); } } } global $ilMainMenu; $ilMainMenu->setMode(ilMainMenuGUI::MODE_TOPBAR_ONLY); if ($back) { // might already be set in ilPublicUserProfileGUI $ilMainMenu->setTopBarBack($back); } // render tabs $current_blog = null; if (count($pages) > 1) { foreach ($pages as $p) { if ($p["type"] == ilPortfolioPage::TYPE_BLOG) { // needed for blog comments (see below) if ($p["id"] == $current_page) { $current_blog = (int) $p["title"]; } include_once "Modules/Blog/classes/class.ilObjBlog.php"; $p["title"] = ilObjBlog::_lookupTitle($p["title"]); } $this->ctrl->setParameter($this, "user_page", $p["id"]); $this->tabs_gui->addTab("user_page_" . $p["id"], $p["title"], $this->ctrl->getLinkTarget($this, "preview")); } $this->tabs_gui->activateTab("user_page_" . $current_page); } $this->ctrl->setParameter($this, "user_page", $current_page); if (!$a_content) { // get current page content $page_gui = $this->getPageGUIInstance($current_page); $page_gui->setEmbedded(true); $content = $this->ctrl->getHTML($page_gui); } else { $content = $a_content; } if ($a_return && $this->checkPermissionBool("write")) { return $content; } // blog posting comments are handled within the blog $notes = ""; if ($a_show_notes && $this->object->hasPublicComments() && !$current_blog) { include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg"); $note_gui->setRepositoryMode(false); $note_gui->enablePublicNotes(true); $note_gui->enablePrivateNotes(false); $note_gui->enablePublicNotesDeletion($this->user_id == $user_id && $ilSetting->get("comments_del_tutor", 1)); $next_class = $this->ctrl->getNextClass($this); if ($next_class == "ilnotegui") { $notes = $this->ctrl->forwardCommand($note_gui); } else { $notes = $note_gui->getNotesHTML(); } } if ($this->perma_link === null) { if ($this->getType() == "prtf") { $this->tpl->setPermanentLink($this->getType(), $this->object->getId(), "_" . $current_page); } else { $this->tpl->setPermanentLink($this->getType(), $this->object->getRefId()); } } else { $this->tpl->setPermanentLink($this->perma_link["type"], $this->perma_link["obj_id"]); } self::renderFullscreenHeader($this->object, $this->tpl, $user_id); // #13564 $this->ctrl->setParameter($this, "user_page", ""); $this->tpl->setTitleUrl($this->ctrl->getLinkTarget($this, "preview")); $this->ctrl->setParameter($this, "user_page", $this->page_id); // blog pages do their own (page) style handling if (!$current_blog) { $content = '<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">' . '<div class="ilc_page_Page">' . $content . '</div></div>'; $this->setContentStyleSheet($this->tpl); } // #10717 $this->tpl->setContent($content . '<div class="ilClearFloat">' . $notes . '</div>'); }
/** * Show user page */ function preview($a_return = false, $a_content = false, $a_show_notes = true) { // public profile if ($_REQUEST["back_url"]) { $back = $_REQUEST["back_url"]; } else { if ($_GET["baseClass"] != "ilPublicUserProfileGUI" && $this->user_id && $this->user_id != ANONYMOUS_USER_ID) { if (!$this->checkPermissionBool("write")) { $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->object->getOwner()); $back = $this->ctrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "showOther"); $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", ""); } else { $back = $this->ctrl->getLinkTarget($this, "view"); } } } $this->tpl->setTopBar($back); $portfolio_id = $this->object->getId(); $user_id = $this->object->getOwner(); $this->tabs_gui->clearTargets(); $pages = ilPortfolioPage::getAllPages($portfolio_id); $current_page = (int) $_GET["user_page"]; // validate current page if ($pages && $current_page) { $found = false; foreach ($pages as $page) { if ($page["id"] == $current_page) { $found = true; break; } } if (!$found) { $current_page = null; } } // display first page of portfolio if none given if (!$current_page && $pages) { $current_page = $pages; $current_page = array_shift($current_page); $current_page = $current_page["id"]; } // render tabs $current_blog = null; if (count($pages) > 1) { foreach ($pages as $p) { if ($p["type"] == ilPortfolioPage::TYPE_BLOG) { // needed for blog comments (see below) if ($p["id"] == $current_page) { $current_blog = (int) $p["title"]; } include_once "Modules/Blog/classes/class.ilObjBlog.php"; $p["title"] = ilObjBlog::_lookupTitle($p["title"]); } $this->ctrl->setParameter($this, "user_page", $p["id"]); $this->tabs_gui->addTab("user_page_" . $p["id"], $p["title"], $this->ctrl->getLinkTarget($this, "preview")); } $this->tabs_gui->activateTab("user_page_" . $current_page); } $this->ctrl->setParameter($this, "user_page", $current_page); if (!$a_content) { // get current page content $page_gui = $this->getPageGUIInstance($current_page); $page_gui->setEmbedded(true); $content = $this->ctrl->getHTML($page_gui); } else { $content = $a_content; } if ($a_return && $this->checkPermissionBool("write")) { return $content; } // blog posting comments are handled within the blog $notes = ""; if ($a_show_notes && $this->object->hasPublicComments() && !$current_blog) { include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg"); $note_gui->setRepositoryMode(false); $note_gui->enablePublicNotes(true); $note_gui->enablePrivateNotes(false); $note_gui->enablePublicNotesDeletion($this->user_id == $user_id); $next_class = $this->ctrl->getNextClass($this); if ($next_class == "ilnotegui") { $notes = $this->ctrl->forwardCommand($note_gui); } else { $notes = $note_gui->getNotesHTML(); } } if ($this->perma_link === null) { include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; if ($this->getType() == "prtf") { $plink = new ilPermanentLinkGUI($this->getType(), $this->object->getId(), "_" . $current_page); } else { $plink = new ilPermanentLinkGUI($this->getType(), $this->object->getRefId()); } $plink = $plink->getHTML(); } else { $plink = $this->perma_link; } self::renderFullscreenHeader($this->object, $this->tpl, $user_id); // wiki/forum will set locator items $this->tpl->setVariable("LOCATOR", ""); // blog pages do their own (page) style handling if (!$current_blog) { $content = '<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">' . '<div class="ilc_page_Page">' . $content . '</div></div>'; $this->setContentStyleSheet($this->tpl); } // #10717 $this->tpl->setContent($content . '<div class="ilClearFloat">' . $notes . $plink . '</div>'); $this->tpl->setFrameFixedWidth(true); echo $this->tpl->show("DEFAULT", true, true); exit; }
/** * Show user page */ function preview($a_return = false, $a_content = false, $a_show_notes = true) { global $ilUser, $tpl, $ilCtrl, $ilTabs, $lng; // public profile if ($_REQUEST["back_url"]) { $back = $_REQUEST["back_url"]; } else { if ($_GET["baseClass"] != "ilPublicUserProfileGUI" && $ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) { if (!$this->checkAccess("write")) { $ilCtrl->setParameter($this, "user", $this->portfolio->getOwner()); $back = $ilCtrl->getLinkTarget($this, "showOther"); $ilCtrl->setParameter($this, "user", ""); } else { $back = $ilCtrl->getLinkTarget($this, "pages"); } } } $tpl->setTopBar($back); $portfolio_id = $this->portfolio->getId(); $user_id = $this->portfolio->getOwner(); $ilTabs->clearTargets(); include_once "./Services/Portfolio/classes/class.ilPortfolioPage.php"; $pages = ilPortfolioPage::getAllPages($portfolio_id); $current_page = $_GET["user_page"]; // display first page of portfolio if none given if (!$current_page && $pages) { $current_page = $pages; $current_page = array_shift($current_page); $current_page = $current_page["id"]; } // render tabs $current_blog = null; if (count($pages) > 1) { foreach ($pages as $p) { if ($p["type"] == ilPortfolioPage::TYPE_BLOG) { // needed for blog comments (see below) if ($p["id"] == $current_page) { $current_blog = (int) $p["title"]; } include_once "Modules/Blog/classes/class.ilObjBlog.php"; $p["title"] = ilObjBlog::_lookupTitle($p["title"]); } $ilCtrl->setParameter($this, "user_page", $p["id"]); $ilTabs->addTab("user_page_" . $p["id"], $p["title"], $ilCtrl->getLinkTarget($this, "preview")); } $ilTabs->activateTab("user_page_" . $current_page); } $ilCtrl->setParameter($this, "user_page", $current_page); if (!$a_content) { // get current page content include_once "./Services/Portfolio/classes/class.ilPortfolioPageGUI.php"; $page_gui = new ilPortfolioPageGUI($portfolio_id, $current_page, 0, $this->portfolio->hasPublicComments()); $page_gui->setEmbedded(true); $page_gui->setAdditional($this->getAdditional()); $content = $ilCtrl->getHTML($page_gui); } else { $content = $a_content; } if ($a_return && $this->checkAccess("write")) { return $content; } // blog posting comments are handled within the blog $notes = ""; if ($a_show_notes && $this->portfolio->hasPublicComments() && !$current_blog) { include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg"); $note_gui->setRepositoryMode(false); $note_gui->enablePublicNotes(true); $note_gui->enablePrivateNotes(false); $note_gui->enablePublicNotesDeletion($ilUser->getId() == $user_id); $next_class = $ilCtrl->getNextClass($this); if ($next_class == "ilnotegui") { $notes = $ilCtrl->forwardCommand($note_gui); } else { $notes = $note_gui->getNotesHTML(); } } if ($this->perma_link === null) { include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; $plink = new ilPermanentLinkGUI("prtf", $this->portfolio->getId()); $plink = $plink->getHTML(); } else { $plink = $this->perma_link; } self::renderFullscreenHeader($this->portfolio, $tpl, $user_id); // wiki/forum will set locator items $tpl->setVariable("LOCATOR", ""); // #10717 $tpl->setContent($content . '<div class="ilClearFloat">' . $notes . $plink . '</div>'); $tpl->setFrameFixedWidth(true); echo $tpl->show("DEFAULT", true, true); exit; }