/**
  * show notes section
  */
 function showNotesSection()
 {
     global $ilAccess, $ilSetting;
     $next_class = $this->ctrl->getNextClass($this);
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     $notes_gui = new ilNoteGUI($this->gui_object->object->getId(), 0, $this->gui_object->object->getType());
     // global switch
     if ($ilSetting->get("disable_comments")) {
         $notes_gui->enablePublicNotes(false);
     } else {
         $ref_id = $this->gui_object->object->getRefId();
         $has_write = $ilAccess->checkAccess("write", "", $ref_id);
         if ($has_write && $ilSetting->get("comments_del_tutor", 1)) {
             $notes_gui->enablePublicNotesDeletion(true);
         }
         /* should probably be discussed further
         			for now this will only work properly with comments settings 
         			(see ilNoteGUI constructor) 
         			*/
         if ($has_write || $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
             $notes_gui->enableCommentsSettings();
         }
     }
     /* moved to action menu 
     	    $notes_gui->enablePrivateNotes(); 		
     		*/
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     return $html;
 }
 /**
  * output notes of page
  */
 function ilLMNotes()
 {
     global $ilAccess, $ilSetting;
     // no notes for abstract of digilib book
     if ($this->lm->getType() == "dbk" && $this->abstract) {
         return;
     }
     // no notes in offline (export) mode
     if ($this->offlineMode()) {
         return;
     }
     // output notes (on top)
     if (!$ilSetting->get("disable_notes")) {
         $this->addHeaderAction();
     }
     // now output comments
     if ($ilSetting->get("disable_comments")) {
         return;
     }
     if (!$this->lm->publicNotes()) {
         return;
     }
     $next_class = $this->ctrl->getNextClass($this);
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     $pg_id = $this->getCurrentPageId();
     if ($pg_id == 0) {
         return;
     }
     $notes_gui = new ilNoteGUI($this->lm->getId(), $this->getCurrentPageId(), "pg");
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $ilSetting->get("comments_del_tutor", 1)) {
         $notes_gui->enablePublicNotesDeletion(true);
     }
     $this->ctrl->setParameter($this, "frame", $_GET["frame"]);
     $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     $notes_gui->enablePrivateNotes();
     if ($this->lm->publicNotes()) {
         $notes_gui->enablePublicNotes();
     }
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     $this->tpl->setVariable("NOTES", $html);
 }
 /**
  * Get notes HTML
  */
 function getNotesHTML($a_mode = "")
 {
     global $ilCtrl;
     // notes
     $ilCtrl->setParameter($this, "nodes_mode", $a_mode);
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     $node_id = $_GET["obj_id"];
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Node.php";
     $node_type = $node_id > 0 ? ilSCORM2004Node::_lookupType($node_id) : "sahs";
     $notes_gui = new ilNoteGUI($this->object->getId(), (int) $node_id, $node_type);
     //		if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
     //		{
     //			$notes_gui->enablePublicNotesDeletion(true);
     //		}
     $notes_gui->enablePrivateNotes();
     $notes_gui->enablePublicNotes();
     $next_class = $ilCtrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     return $html;
 }
 /**
  * Get html for public and/or private notes
  *
  * @param bool $a_content_object
  * @param bool $a_enable_private_notes
  * @param bool $a_enable_public_notes
  * @param bool $a_enable_notes_deletion
  * @return string
  */
 function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
 {
     global $ilCtrl;
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // scorm 2004 page gui
     if (!$a_content_object) {
         $notes_gui = new ilNoteGUI($this->notes_parent_id, (int) $this->obj->getId(), "pg");
         $a_enable_private_notes = true;
         $a_enable_public_notes = true;
         $a_enable_notes_deletion = false;
     } else {
         $notes_gui = new ilNoteGUI($a_content_object->getParentId(), $a_content_object->getId(), $a_content_object->getParentType());
     }
     if ($a_enable_private_notes) {
         $notes_gui->enablePrivateNotes();
     }
     if ($a_enable_public_notes) {
         $notes_gui->enablePublicNotes();
         if ((bool) $a_enable_notes_deletion) {
             $notes_gui->enablePublicNotesDeletion(true);
         }
     }
     if ($a_callback) {
         $notes_gui->addObserver($a_callback);
     }
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     return $html;
 }
 function executeCommand()
 {
     global $ilCtrl;
     // check access for object
     if ($this->node_id && !$this->access_handler->checkAccess("visible", "", $this->node_id) && !$this->access_handler->checkAccess("read", "", $this->node_id)) {
         exit;
     }
     $next_class = $ilCtrl->getNextClass($this);
     $cmd = $ilCtrl->getCmd();
     $ilCtrl->saveParameter($this, "cadh");
     switch ($next_class) {
         case "ilnotegui":
             $obj_type = $this->obj_type;
             if ($this->sub_type) {
                 $obj_type = $this->sub_type;
             }
             include_once "Services/Notes/classes/class.ilNoteGUI.php";
             $note_gui = new ilNoteGUI($this->obj_id, $this->sub_id, $obj_type);
             $note_gui->enablePrivateNotes(true);
             // comments cannot be turned off globally
             if ($this->enable_comments_settings) {
                 // should only be shown if active or permission to toggle
                 if ($this->access_handler->checkAccess("write", "", $this->node_id) || $this->access_handler->checkAccess("edit_permissions", "", $this->node_id)) {
                     $note_gui->enableCommentsSettings();
                 }
             } else {
                 if ($this->sub_id) {
                     $note_gui->enablePublicNotes(true);
                 }
             }
             $ilCtrl->forwardCommand($note_gui);
             break;
         case "iltagginggui":
             include_once "Services/Tagging/classes/class.ilTaggingGUI.php";
             $tags_gui = new ilTaggingGUI($this->node_id);
             $tags_gui->setObject($this->obj_id, $this->obj_type);
             $ilCtrl->forwardCommand($tags_gui);
             break;
         case "ilobjectactivationgui":
             $ilCtrl->setParameter($this, "parent_id", (int) $_REQUEST['parent_id']);
             include_once 'Services/Object/classes/class.ilObjectActivationGUI.php';
             $act_gui = new ilObjectActivationGUI((int) $_REQUEST['parent_id'], $this->node_id);
             $ilCtrl->forwardCommand($act_gui);
             break;
         case "ilratinggui":
             include_once "./Services/Rating/classes/class.ilRatingGUI.php";
             $rating_gui = new ilRatingGUI();
             $rating_gui->setObject($this->obj_id, $this->obj_type, $this->sub_id, $this->sub_type);
             $ilCtrl->forwardCommand($rating_gui);
             if ($this->rating_callback) {
                 // as rating in categories is form-based we need to redirect
                 // somewhere after saving
                 $ilCtrl->redirect($this->rating_callback[0], $this->rating_callback[1]);
             }
             break;
         default:
             break;
     }
     exit;
 }
 function view()
 {
     global $ilUser, $lng;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         foreach ($rel_objs as $obj) {
             $this->tpl->setCurrentBlock("related_option");
             $this->tpl->setVariable("VAL_RELATED", $obj["rep_obj_id"]);
             //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $this->tpl->setVariable("TXT_RELATED", $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]));
             } else {
                 $this->tpl->setVariable("TXT_RELATED", $lng->txt("personal_desktop"));
             }
             if ($obj["rep_obj_id"] == $this->current_rel_obj) {
                 $this->tpl->setVariable("SEL", 'selected="selected"');
             }
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("related_selection");
         $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
         $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
         $this->tpl->setVariable("TXT_FILTER", $lng->txt("filter"));
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("adm_content");
     // output notes
     $this->tpl->setVariable("NOTES", $html);
     $this->tpl->parseCurrentBlock();
 }
 /**
  * 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 view()
 {
     global $ilUser, $lng, $ilSetting, $ilAccess, $ilToolbar;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
         // #13707
         if ($this->current_rel_obj > 0 && sizeof($current_ref_ids) && $ilSetting->get("comments_del_tutor", 1)) {
             foreach ($current_ref_ids as $ref_id) {
                 if ($ilAccess->checkAccess("write", "", $ref_id)) {
                     $notes_gui->enablePublicNotesDeletion(true);
                     break;
                 }
             }
         }
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
             $html = $notes_gui->getOnlyNotesHTML();
         } else {
             $html = $notes_gui->getOnlyCommentsHTML();
         }
     }
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         foreach ($rel_objs as $obj) {
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $caption = $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]);
             } else {
                 $caption = $lng->txt("personal_desktop");
             }
             $options[$obj["rep_obj_id"]] = $caption;
         }
         include_once "Services/Form/classes/class.ilSelectInputGUI.php";
         $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
         $rel->setOptions($options);
         $rel->setValue($this->current_rel_obj);
         $ilToolbar->addInputItem($rel);
         $ilToolbar->addFormButton($lng->txt("change"), "changeRelatedObject");
     }
     $this->tpl->setContent($html);
 }
 /**
  * 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;
 }