/**
  * 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"]);
 }
Example #2
0
 protected function doCloneObject(ilObjBlog $new_obj, $a_target_id, $a_copy_id = null)
 {
     // banner?
     $img = $this->getImage();
     if ($img) {
         $new_obj->setImage($img);
         $source = $this->initStorage($this->getId());
         $target = $new_obj->initStorage($new_obj->getId());
         copy($source . $img, $target . $img);
     }
     $new_obj->setNotesStatus($this->getNotesStatus());
     $new_obj->setProfilePicture($this->hasProfilePicture());
     $new_obj->setBackgroundColor($this->getBackgroundColor());
     $new_obj->setFontColor($this->getFontColor());
     $new_obj->setRSS($this->hasRSS());
     $new_obj->setApproval($this->hasApproval());
     $new_obj->update();
     // set/copy stylesheet
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $style_id = $this->getStyleSheetId();
     if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
         $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
         $new_id = $style_obj->ilClone();
         $new_obj->setStyleSheetId($new_id);
         $new_obj->update();
     }
 }
 protected function saveBlogObject()
 {
     global $ilUser;
     if (!$_POST["node"]) {
         ilUtil::sendFailure($this->lng->txt("select_one"));
         return $this->createBlogObject();
     }
     $parent_node = $_POST["node"];
     include_once "Modules/Blog/classes/class.ilObjBlog.php";
     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
     $blog = new ilObjBlog();
     $blog->setTitle($this->object->getTitle() . " - " . $this->ass->getTitle());
     $blog->create();
     $tree = new ilWorkspaceTree($ilUser->getId());
     $node_id = $tree->insertObject($parent_node, $blog->getId());
     $access_handler = new ilWorkspaceAccessHandler($tree);
     $access_handler->setPermissions($parent_node, $node_id);
     $this->object->addResourceObject($node_id, $this->ass->getId(), $ilUser->getId());
     ilUtil::sendSuccess($this->lng->txt("exc_blog_created"), true);
     $this->ctrl->redirect($this, "showOverview");
 }
 /**
  * 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();
 }
Example #5
0
 /**
  * Update blog posting
  *
  * @param bool $a_validate
  * @param bool $a_no_history
  * @param bool $a_notify
  * @param string $a_notify_action
  * @return boolean
  */
 function update($a_validate = true, $a_no_history = false, $a_notify = true, $a_notify_action = "update")
 {
     global $ilDB;
     // blog_id, author and created cannot be changed
     $query = "UPDATE il_blog_posting SET" . " title = " . $ilDB->quote($this->getTitle(), "text") . ",created = " . $ilDB->quote($this->getCreated()->get(IL_CAL_DATETIME), "text") . ",approved =" . $ilDB->quote($this->isApproved(), "integer") . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     parent::update($a_validate, $a_no_history);
     if ($a_notify && $this->getActive()) {
         include_once "Modules/Blog/classes/class.ilObjBlog.php";
         ilObjBlog::sendNotification($a_notify_action, $this->blog_node_is_wsp, $this->blog_node_id, $this->getId());
     }
     return true;
 }
 function activatePage($a_to_list = false)
 {
     // send notifications
     include_once "Modules/Blog/classes/class.ilObjBlog.php";
     ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
     $this->getBlogPosting()->setActive(true);
     $this->getBlogPosting()->update(true, false, false);
     if (!$a_to_list) {
         $this->ctrl->redirect($this, "edit");
     } else {
         $this->ctrl->redirectByClass("ilobjbloggui", "");
     }
 }
Example #7
0
    	in both cases a further '/' won't be appended due to the following regex
    	*/
    $cookie_path .= !preg_match("/[\\/|\\\\]\$/", $cookie_path) ? "/" : "";
    if ($cookie_path == "\\") {
        $cookie_path = '/';
    }
    $cookie_domain = '';
    // Temporary Fix
    setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain);
    $_COOKIE["ilClientId"] = $_GET["client_id"];
}
include_once "Services/Context/classes/class.ilContext.php";
ilContext::init(ilContext::CONTEXT_RSS);
require_once "Services/Init/classes/class.ilInitialisation.php";
ilInitialisation::initILIAS();
if ($_GET["user_id"] != "") {
    include_once "./Services/Feeds/classes/class.ilUserFeedWriter.php";
    $writer = new ilUserFeedWriter($_GET["user_id"], $_GET["hash"]);
    $writer->showFeed();
} else {
    if ($_GET["ref_id"] != "") {
        include_once "./Services/Feeds/classes/class.ilObjectFeedWriter.php";
        $writer = new ilObjectFeedWriter($_GET["ref_id"], false, $_GET["purpose"]);
        $writer->showFeed();
    } else {
        if ($_GET["blog_id"] != "") {
            include_once "Modules/Blog/classes/class.ilObjBlog.php";
            ilObjBlog::deliverRSS($_GET["blog_id"]);
        }
    }
}
 protected static function createBlogInPersonalWorkspace($a_title)
 {
     global $ilUser;
     static $ws_access = null;
     include_once "Modules/Blog/classes/class.ilObjBlog.php";
     $blog = new ilObjBlog();
     $blog->setType("blog");
     $blog->setTitle($a_title);
     $blog->create();
     if (!$ws_access) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $tree = new ilWorkspaceTree($ilUser->getId());
         $ws_access = new ilWorkspaceAccessHandler($tree);
     }
     $tree = $ws_access->getTree();
     $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
     $ws_access->setPermissions($tree->getRootId(), $node_id);
     return $blog->getId();
 }
Example #9
0
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     switch ($a_entity) {
         case "blog":
             include_once "./Modules/Blog/classes/class.ilObjBlog.php";
             // container copy
             if ($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjBlog();
                 $newObj->create();
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->setNotesStatus($a_rec["Notes"]);
             $newObj->setBackgroundColor($a_rec["BgColor"]);
             $newObj->setFontColor($a_rec["FontColor"]);
             $newObj->setProfilePicture($a_rec["Ppic"]);
             $newObj->setRSS($a_rec["RssActive"]);
             $newObj->setApproval($a_rec["Approval"]);
             $newObj->setImage($a_rec["Img"]);
             $newObj->setAbstractShorten($a_rec["AbsShorten"]);
             $newObj->setAbstractShortenLength($a_rec["AbsShortenLen"]);
             $newObj->setAbstractImage($a_rec["AbsImage"]);
             $newObj->setAbstractImageWidth($a_rec["AbsImgWidth"]);
             $newObj->setAbstractImageHeight($a_rec["AbsImgHeight"]);
             $newObj->setNavMode($a_rec["NavMode"]);
             $newObj->setNavModeListPostings($a_rec["NavListPost"]);
             $newObj->setNavModeListMonths($a_rec["NavListMon"]);
             $newObj->setKeywords($a_rec["Keywords"]);
             $newObj->setAuthors($a_rec["Authors"]);
             $newObj->setOrder(trim($a_rec["NavOrder"]) ? explode(";", $a_rec["NavOrder"]) : null);
             $newObj->setOverviewPostings($a_rec["OvPost"]);
             $newObj->update();
             // handle image(s)
             if ($a_rec["Img"]) {
                 $dir = str_replace("..", "", $a_rec["Dir"]);
                 if ($dir != "" && $this->getImportDirectory() != "") {
                     $source_dir = $this->getImportDirectory() . "/" . $dir;
                     $target_dir = ilObjBlog::initStorage($newObj->getId());
                     ilUtil::rCopy($source_dir, $target_dir);
                 }
             }
             if ($a_rec["Style"]) {
                 self::$style_map[$a_rec["Style"]][] = $newObj->getId();
             }
             $a_mapping->addMapping("Modules/Blog", "blog", $a_rec["Id"], $newObj->getId());
             break;
         case "blog_posting":
             $blog_id = (int) $a_mapping->getMapping("Modules/Blog", "blog", $a_rec["BlogId"]);
             if ($blog_id) {
                 include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
                 $newObj = new ilBlogPosting();
                 $newObj->setBlogId($blog_id);
                 $newObj->setTitle($a_rec["Title"]);
                 $newObj->setCreated(new ilDateTime($a_rec["Created"], IL_CAL_DATETIME));
                 $newObj->setApproved($a_rec["Approved"]);
                 // parse export id into local id (if possible)
                 $author = $this->parseObjectExportId($a_rec["Author"], -1);
                 $newObj->setAuthor($author["id"]);
                 $newObj->create(true);
                 // keywords
                 $keywords = array();
                 for ($loop = 0; $loop < 1000; $loop++) {
                     if (isset($a_rec["Keyword" . $loop])) {
                         $keyword = trim($a_rec["Keyword" . $loop]);
                         if (strlen($keyword)) {
                             $keywords[] = $keyword;
                         }
                     }
                 }
                 if (sizeof($keywords)) {
                     $newObj->updateKeywords($keywords);
                 }
                 $a_mapping->addMapping("Services/COPage", "pg", "blp:" . $a_rec["Id"], "blp:" . $newObj->getId());
             }
             break;
     }
 }
 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>');
 }
 function activatePage()
 {
     // send notifications
     include_once "Modules/Blog/classes/class.ilObjBlog.php";
     ilObjBlog::sendNotification("new", $this->isInWorkspace(), $this->node_id, $this->getBlogPosting()->getId());
     $this->getBlogPosting()->setActive(true);
     $this->getBlogPosting()->update(true, false, false);
     $this->ctrl->redirect($this, "edit");
 }
 /**
  * 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;
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     switch ($a_entity) {
         case "blog":
             include_once "./Modules/Blog/classes/class.ilObjBlog.php";
             $newObj = new ilObjBlog();
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->create();
             $newObj->setNotesStatus($a_rec["Notes"]);
             $newObj->setBackgroundColor($a_rec["BgColor"]);
             $newObj->setFontColor($a_rec["FontColor"]);
             $newObj->setProfilePicture($a_rec["Ppic"]);
             $newObj->setRSS($a_rec["RssActive"]);
             $newObj->setApproval($a_rec["Approval"]);
             $newObj->setImage($a_rec["Img"]);
             $newObj->update();
             // handle image(s)
             if ($a_rec["Img"]) {
                 $dir = str_replace("..", "", $a_rec["Dir"]);
                 if ($dir != "" && $this->getImportDirectory() != "") {
                     $source_dir = $this->getImportDirectory() . "/" . $dir;
                     $target_dir = ilObjBlog::initStorage($newObj->getId());
                     ilUtil::rCopy($source_dir, $target_dir);
                 }
             }
             $a_mapping->addMapping("Modules/Blog", "blog", $a_rec["Id"], $newObj->getId());
             break;
         case "blog_posting":
             $blog_id = (int) $a_mapping->getMapping("Modules/Blog", "blog", $a_rec["BlogId"]);
             if ($blog_id) {
                 include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
                 $newObj = new ilBlogPosting();
                 $newObj->setBlogId($blog_id);
                 $newObj->setTitle($a_rec["Title"]);
                 $newObj->setCreated(new ilDateTime($a_rec["Created"], IL_CAL_DATETIME));
                 $newObj->setApproved($a_rec["Approved"]);
                 // parse export id into local id (if possible)
                 $author = $this->parseObjectExportId($a_rec["Author"], -1);
                 $newObj->setAuthor($author["id"]);
                 $newObj->create(true);
                 $a_mapping->addMapping("Services/COPage", "pg", "blp:" . $a_rec["Id"], "blp:" . $newObj->getId());
             }
             break;
     }
 }
 /**
  * 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;
 }