/**
  * Render list of booking objects
  *
  * uses ilBookingObjectsTableGUI
  */
 function render()
 {
     global $tpl, $ilCtrl, $lng, $ilAccess;
     if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
         include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
         $bar = new ilToolbarGUI();
         $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
         $bar = $bar->getHTML();
     }
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $plink = new ilPermanentLinkGUI('book', $this->ref_id);
     include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
     $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule);
     $tpl->setContent($bar . $table->getHTML() . $plink->getHTML());
 }
 /**
  * @param bool $editComments
  */
 public function renderRecord($editComments = false)
 {
     global $ilTabs, $tpl, $ilCtrl, $lng;
     $rctpl = new ilTemplate("tpl.record_view.html", false, true, "Modules/DataCollection");
     $ilTabs->setTabActive("id_content");
     $view_id = self::_getViewDefinitionId($this->record_obj);
     if (!$view_id) {
         $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
     }
     // see ilObjDataCollectionGUI->executeCommand about instantiation
     include_once "./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php";
     $pageObj = new ilDataCollectionRecordViewViewdefinitionGUI($this->record_obj->getTableId(), $view_id);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl"));
     $html = $pageObj->getHTML();
     $rctpl->addCss("./Services/COPage/css/content.css");
     $rctpl->fillCssFiles();
     $table = ilDataCollectionCache::getTableCache($this->record_obj->getTableId());
     foreach ($table->getRecordFields() as $field) {
         //ILIAS_Ref_Links
         $pattern = '/\\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dcliln\\]/';
         if (preg_match($pattern, $html)) {
             $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("\$1")), $html);
         }
         //DataCollection Ref Links
         $pattern = '/\\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dclrefln\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doReplace"), $html);
         }
         $pattern = '/\\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html);
         }
         $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
     }
     foreach ($table->getStandardFields() as $field) {
         $html = str_ireplace("[" . $field->getId() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
     }
     $rctpl->setVariable("CONTENT", $html);
     //Permanent Link
     $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $_GET['record_id']);
     $tpl->setVariable('PRMLINK', $perma_link->getHTML());
     // Buttons for previous/next records
     if ($this->is_enabled_paging) {
         $prevNextLinks = $this->renderPrevNextLinks();
         $rctpl->setVariable('PREV_NEXT_RECORD_LINKS', $prevNextLinks);
         $ilCtrl->clearParameters($this);
         // #14083
         $rctpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this));
         $rctpl->setVariable('RECORD', $lng->txt('dcl_record'));
         $rctpl->setVariable('RECORD_FROM_TOTAL', sprintf($lng->txt('dcl_record_from_total'), $this->current_record_position, count($this->record_ids)));
         $rctpl->setVariable('SELECT_OPTIONS', $this->renderSelectOptions());
     }
     // Edit Button
     if ($this->record_obj->hasPermissionToEdit((int) $_GET['ref_id'])) {
         $button = ilLinkButton::getInstance();
         $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'table_id', $this->table->getId());
         $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'redirect', ilDataCollectionRecordEditGUI::REDIRECT_DETAIL);
         $ilCtrl->saveParameterByClass('ildatacollectionrecordeditgui', 'record_id');
         $button->setUrl($ilCtrl->getLinkTargetByClass('ildatacollectionrecordeditgui', 'edit'));
         $button->setCaption($lng->txt('dcl_edit_record'), false);
         $rctpl->setVariable('EDIT_RECORD_BUTTON', $button->render());
     }
     // Comments
     if ($this->table->getPublicCommentsEnabled()) {
         $rctpl->setVariable('COMMENTS', $this->renderComments($editComments));
     }
     $tpl->setContent($rctpl->get());
 }
 /**
  * View wiki page.
  */
 function preview()
 {
     global $ilCtrl, $ilAccess, $lng, $tpl, $ilUser, $ilSetting, $ilToolbar;
     // block/unblock
     if ($this->getPageObject()->getBlocked()) {
         ilUtil::sendInfo($lng->txt("wiki_page_status_blocked"));
     }
     $this->increaseViewCount();
     $this->addHeaderAction();
     // content
     $this->setSideBlock();
     $wtpl = new ilTemplate("tpl.wiki_page_view_main_column.html", true, true, "Modules/Wiki");
     $callback = array($this, "observeNoteAction");
     // notes
     if (!$ilSetting->get("disable_comments") && ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId())) {
         $wtpl->setVariable("NOTES", $this->getNotesHTML($this->getPageObject(), true, ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), $ilAccess->checkAccess("write", "", $_GET["ref_id"]), $callback));
     }
     // permanent link
     $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($_GET["page"]) : "";
     include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
     $perma_link = new ilPermanentLinkGUI("wiki", $_GET["ref_id"], $append);
     $wtpl->setVariable("PERMA_LINK", $perma_link->getHTML());
     // page content
     $this->setOutputMode(IL_PAGE_PRESENTATION);
     $this->setRenderPageContainer(true);
     $wtpl->setVariable("PAGE", $this->showPage());
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     // last edited info
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $wtpl->setVariable("LAST_EDITED_INFO", $lng->txt("wiki_last_edited") . ": " . ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getLastChange(), IL_CAL_DATETIME)) . ", " . ilUserUtil::getNamePresentation($this->getPageObject()->getLastChangeUser(), false, true, $ilCtrl->getLinkTarget($this, "preview")));
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     //highlighting
     if ($_GET["srcstring"] != "") {
         include_once './Services/Search/classes/class.ilUserSearchCache.php';
         $cache = ilUserSearchCache::_getInstance($ilUser->getId());
         $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
         $search_string = $cache->getQuery();
         include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php";
         include_once "./Services/Search/classes/class.ilQueryParser.php";
         $p = new ilQueryParser($search_string);
         $p->parse();
         $words = $p->getQuotedWords();
         if (is_array($words)) {
             foreach ($words as $w) {
                 ilTextHighlighterGUI::highlight("ilCOPageContent", $w, $tpl);
             }
         }
         $this->fill_on_load_code = true;
     }
     return $wtpl->get();
 }
 /**
  * add standard object section
  */
 function addObjectSections()
 {
     global $lng, $ilCtrl, $ilUser, $ilAccess, $tree, $ilSetting, $ilObjDataCache;
     $this->addSection($lng->txt("additional_info"));
     $a_obj = $this->gui_object->object;
     // links to the object
     if (is_object($a_obj)) {
         // permanent link
         $type = $a_obj->getType();
         $ref_id = $a_obj->getRefId();
         if ($ref_id) {
             include_once './Services/Link/classes/class.ilLink.php';
             $href = ilLink::_getStaticLink($ref_id, $type, true);
             include_once 'Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
             if (ilECSServerSettings::getInstance()->activeServerExists()) {
                 $this->addProperty($lng->txt("object_id"), $a_obj->getId());
             }
             include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
             $pm = new ilPermanentLinkGUI($type, $ref_id);
             $pm->setIncludePermanentLinkText(false);
             $pm->setAlignCenter(false);
             $this->addProperty($lng->txt("perma_link"), $pm->getHTML(), "");
             // bookmarks
             $title = $ilObjDataCache->lookupTitle($a_obj->getId());
             $bms = ilPermanentLinkGUI::_getBookmarksSelectionList($title, $href);
             // links to resource
             if ($ilAccess->checkAccess("write", "", $ref_id) || $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
                 $obj_id = $a_obj->getId();
                 $rs = ilObject::_getAllReferences($obj_id);
                 $refs = array();
                 foreach ($rs as $r) {
                     if ($tree->isInTree($r)) {
                         $refs[] = $r;
                     }
                 }
                 if (count($refs) > 1) {
                     $links = $sep = "";
                     foreach ($refs as $r) {
                         $cont_loc = new ilLocatorGUI();
                         $cont_loc->addContextItems($r, true);
                         $links .= $sep . $cont_loc->getHTML();
                         $sep = "<br />";
                     }
                     $this->addProperty($lng->txt("res_links"), '<div class="small">' . $links . '</div>');
                 }
             }
         }
     }
     // creation date
     $this->addProperty($lng->txt("create_date"), ilDatePresentation::formatDate(new ilDateTime($a_obj->getCreateDate(), IL_CAL_DATETIME)));
     // owner
     if ($ilUser->getId() != ANONYMOUS_USER_ID and $a_obj->getOwner()) {
         include_once './Services/Object/classes/class.ilObjectFactory.php';
         include_once './Services/User/classes/class.ilObjUser.php';
         if (ilObjUser::userExists(array($a_obj->getOwner()))) {
             $ownerObj = ilObjectFactory::getInstanceByObjId($a_obj->getOwner(), false);
         } else {
             $ownerObj = ilObjectFactory::getInstanceByObjId(6, false);
         }
         if (!is_object($ownerObj) || $ownerObj->getType() != "usr") {
             $this->addProperty($lng->txt("owner"), $lng->txt("no_owner"));
         } else {
             if ($ownerObj->hasPublicProfile()) {
                 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $ownerObj->getId());
                 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName(), $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
             } else {
                 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName());
             }
         }
     }
     // disk usage
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if ($ilUser->getId() != ANONYMOUS_USER_ID && ilDiskQuotaActivationChecker::_isActive()) {
         $size = $a_obj->getDiskUsage();
         if ($size !== null) {
             $this->addProperty($lng->txt("disk_usage"), ilFormat::formatSize($size, 'long'));
         }
     }
     // change event
     require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
     if (ilChangeEvent::_isActive()) {
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             $readEvents = ilChangeEvent::_lookupReadEvents($a_obj->getId());
             $count_users = 0;
             $count_members = 0;
             $count_user_reads = 0;
             $count_anonymous_reads = 0;
             foreach ($readEvents as $evt) {
                 if ($evt['usr_id'] == ANONYMOUS_USER_ID) {
                     $count_anonymous_reads += $evt['read_count'];
                 } else {
                     $count_user_reads += $evt['read_count'];
                     $count_users++;
                     /* to do: if ($evt['user_id'] is member of $this->getRefId())
                     			{
                     				$count_members++;
                     			}*/
                 }
             }
             if ($count_anonymous_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_anonymous_users"), $count_anonymous_reads);
             }
             if ($count_user_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_users"), $count_user_reads);
             }
             if ($count_users > 0) {
                 $this->addProperty($this->lng->txt("accesscount_registered_users"), $count_users);
             }
         }
     }
     // END ChangeEvent: Display change event info
     // BEGIN WebDAV: Display locking information
     require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
     if (ilDAVServer::_isActive()) {
         global $ilias, $ilUser;
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             $davLocks = new ilDAVLocks();
             // Show lock info
             if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
                 $locks =& $davLocks->getLocksOnObjectObj($a_obj->getId());
                 if (count($locks) > 0) {
                     $lockUser = new ilObjUser($locks[0]['ilias_owner']);
                     $this->addProperty($this->lng->txt("in_use_by"), $lockUser->getPublicName(), "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI');
                 }
             }
         }
     }
     // END WebDAV: Display locking information
 }
Example #5
0
 protected function getPermanentLinkWidget($a_append = null, $a_center = false)
 {
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         $a_append .= "_wsp";
     }
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $plink = new ilPermanentLinkGUI($this->getType(), $this->node_id, $a_append);
     $plink->setIncludePermanentLinkText(false);
     $plink->setAlignCenter($a_center);
     return $plink->getHTML();
 }
Example #6
0
 /**
  * Fill in permanent link
  */
 function fillPermanentLink()
 {
     if (is_array($this->permanent_link)) {
         include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
         $plinkgui = new ilPermanentLinkGUI($this->permanent_link["type"], $this->permanent_link["id"], $this->permanent_link["append"], $this->permanent_link["target"]);
         $this->setVariable("PRMLINK", $plinkgui->getHTML());
     }
 }
 /**
  * output learning module submenu
  */
 function ilLMSubMenu()
 {
     global $rbacsystem;
     // no sub menu for abstract of digilib book
     if ($this->lm->getType() == "dbk" && $this->abstract) {
         return;
     }
     $showViewInFrameset = true;
     if ($showViewInFrameset) {
         $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
     } else {
         $buttonTarget = "_top";
     }
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $tpl_menu = new ilTemplate("tpl.lm_sub_menu.html", true, true, true);
     $pg_id = $this->getCurrentPageId();
     if ($pg_id == 0) {
         return;
     }
     // edit learning module
     if (!$this->offlineMode()) {
         if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
             $tpl_menu->setCurrentBlock("edit_page");
             $page_id = $this->getCurrentPageId();
             $tpl_menu->setVariable("EDIT_LINK", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] . "&obj_id=" . $page_id . "&to_page=1");
             $tpl_menu->setVariable("EDIT_TXT", $this->lng->txt("edit_page"));
             $tpl_menu->setVariable("EDIT_TARGET", $buttonTarget);
             $tpl_menu->parseCurrentBlock();
         }
         $page_id = $this->getCurrentPageId();
         include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
         $plinkgui = new ilPermanentLinkGUI("pg", $page_id . "_" . $this->lm->getRefId(), "", "_top");
         $title = $this->lm->getTitle();
         $pg_title = ilLMPageObject::_getPresentationTitle($page_id, $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang);
         if ($pg_title != "") {
             $title .= ": " . $pg_title;
         }
         $plinkgui->setTitle($title);
         $tpl_menu->setCurrentBlock("perma_link");
         $tpl_menu->setVariable("PERMA_LINK", $plinkgui->getHTML());
         $tpl_menu->parseCurrentBlock();
     }
     $this->tpl->setVariable("SUBMENU", $tpl_menu->get());
 }
 /**
  * Render object context
  */
 function render($a_form = null)
 {
     global $tpl, $ilTabs, $ilCtrl, $lng, $ilToolbar, $ilUser;
     if (!$this->checkPermissionBool("write")) {
         ilUtil::sendInfo($lng->txt("no_permission"));
         return;
     }
     $ilTabs->activateTab("content");
     if (!$a_form) {
         if ($this->object->countVotes()) {
             $url = $ilCtrl->getLinkTarget($this, "showParticipants");
             ilUtil::sendInfo($lng->txt("poll_votes_no_edit") . " <a href=\"" . $url . "\">&raquo;" . $lng->txt("poll_participants") . "</a>");
         }
         $a_form = $this->initQuestionForm($this->object->countVotes());
     }
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $plink = new ilPermanentLinkGUI('poll', $this->node_id);
     $tpl->setContent($a_form->getHTML() . $plink->getHTML());
 }
 /**
  * Preview blog posting
  */
 function preview($a_mode = null)
 {
     global $ilCtrl, $lng, $tpl, $ilUser, $ilToolbar;
     $this->getBlogPosting()->increaseViewCnt();
     $wtpl = new ilTemplate("tpl.blog_page_view_main_column.html", true, true, "Modules/Blog");
     // page commands
     if (!$a_mode) {
         /*
         // delete
         $page_commands = false;
         if ($this->checkAccess("write"))
         {
         	$wtpl->setCurrentBlock("page_command");
         	$wtpl->setVariable("HREF_PAGE_CMD",
         		$ilCtrl->getLinkTarget($this, "deleteBlogPostingConfirmationScreen"));
         	$wtpl->setVariable("TXT_PAGE_CMD", $lng->txt("delete"));
         	$wtpl->parseCurrentBlock();
         }		
         if ($page_commands)
         {
         	$wtpl->setCurrentBlock("page_commands");
         	$wtpl->parseCurrentBlock();
         }			  
         */
     } else {
         $callback = array($this, "observeNoteAction");
         // notes
         $wtpl->setVariable("NOTES", $this->getNotesHTML($this->getBlogPosting(), false, $this->enable_public_notes, $this->checkAccess("contribute"), $callback));
     }
     // permanent link
     if ($a_mode != "embedded") {
         $append = $_GET["blpg"] != "" ? "_" . $_GET["blpg"] : "";
         if ($this->isInWorkspace()) {
             $append .= "_wsp";
         }
         include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
         $perma_link = new ilPermanentLinkGUI("blog", $this->node_id, $append);
         $wtpl->setVariable("PERMA_LINK", $perma_link->getHTML());
     }
     $wtpl->setVariable("PAGE", parent::preview());
     $tpl->setLoginTargetPar("blog_" . $this->node_id . $append);
     $ilCtrl->setParameter($this, "blpg", $this->getBlogPosting()->getId());
     return $wtpl->get();
 }
Example #10
0
 public function viewThreadObject()
 {
     /**
      * @var $tpl ilTemplate
      * @var $lng ilLanguage
      * @var $ilUser ilObjUser
      * @var $ilAccess ilAccessHandler
      * @var $rbacreview ilRbacReview
      * @var $ilNavigationHistory ilNavigationHistory
      * @var $ilCtrl ilCtrl
      * @var $ilToolbar ilToolbarGUI
      */
     global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator;
     $tpl->addCss('./Modules/Forum/css/forum_tree.css');
     if (!isset($_SESSION['viewmode'])) {
         $_SESSION['viewmode'] = $this->objProperties->getDefaultView();
     }
     // quick and dirty: check for treeview
     if (!isset($_SESSION['thread_control']['old'])) {
         $_SESSION['thread_control']['old'] = $_GET['thr_pk'];
         $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
     } else {
         if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) {
             $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
         }
     }
     if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) {
         $_SESSION['viewmode'] = $_GET['viewmode'];
     }
     if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_TREE;
     } else {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_DATE;
     }
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // init objects
     $oForumObjects = $this->getForumObjects();
     /**
      * @var $forumObj ilObjForum
      */
     $forumObj = $oForumObjects['forumObj'];
     /**
      * @var $frm ilForum
      */
     $frm = $oForumObjects['frm'];
     /**
      * @var $file_obj ilFileDataForum
      */
     $file_obj = $oForumObjects['file_obj'];
     // download file
     if ($_GET['file']) {
         if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) {
             ilUtil::sendFailure($this->lng->txt('error_reading_file'));
         } else {
             ilUtil::deliverFile($path['path'], $path['clean_filename']);
         }
     }
     if (!$this->objCurrentTopic->getId()) {
         $ilCtrl->redirect($this, 'showThreads');
     }
     // Set context for login
     $append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : '');
     $tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append);
     // delete temporary media object (not in case a user adds media objects and wants to save an invalid form)
     if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') {
         try {
             include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
             $mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
             foreach ($mobs as $mob) {
                 if (ilObjMediaObject::_exists($mob)) {
                     ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
                     $mob_obj = new ilObjMediaObject($mob);
                     $mob_obj->delete();
                 }
             }
         } catch (Exception $e) {
         }
     }
     require_once './Modules/Forum/classes/class.ilObjForum.php';
     require_once './Modules/Forum/classes/class.ilFileDataForum.php';
     $lng->loadLanguageModule('forum');
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
         $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm');
     }
     // save last access
     $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
     $this->prepareThreadScreen($forumObj);
     $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum');
     if (isset($_GET['anchor'])) {
         $tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']);
     }
     if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) {
         $orderField = 'frm_posts_tree.fpt_date';
         $this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC');
     } else {
         $orderField = 'frm_posts_tree.rgt';
         $this->objCurrentTopic->setOrderDirection('DESC');
     }
     // get forum- and thread-data
     $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
     if (is_array($topicData = $frm->getOneTopic())) {
         // Visit-Counter for topic
         $this->objCurrentTopic->updateVisits();
         $tpl->setTitle($lng->txt('forums_thread') . " \"" . $this->objCurrentTopic->getSubject() . "\"");
         // ********************************************************************************
         // build location-links
         $ilLocator->addRepositoryItems();
         $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ""), "_top");
         $tpl->setLocator();
         // set tabs
         // menu template (contains linkbar)
         /** @var $menutpl ilTemplate */
         $menutpl = new ilTemplate('tpl.forums_threads_menu.html', true, true, 'Modules/Forum');
         include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php";
         // mark all as read
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId())) {
             $this->ctrl->setParameter($this, 'mark_read', '1');
             $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
             $ilToolbar->addButton($this->lng->txt('forums_mark_read'), $this->ctrl->getLinkTarget($this, 'viewThread'), '', ilAccessKey::MARK_ALL_READ);
             $this->ctrl->clearParameters($this);
         }
         // print thread
         $this->ctrl->setParameterByClass('ilforumexportgui', 'print_thread', $this->objCurrentTopic->getId());
         $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_top_fk', $this->objCurrentTopic->getForumId());
         $ilToolbar->addButton($this->lng->txt('forums_print_thread'), $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printThread'));
         $this->ctrl->clearParametersByClass('ilforumexportgui');
         $this->addHeaderAction();
         if ($_GET['mark_read']) {
             $forumObj->markThreadRead($ilUser->getId(), (int) $this->objCurrentTopic->getId());
             ilUtil::sendInfo($lng->txt('forums_thread_marked'), true);
         }
         // delete post and its sub-posts
         require_once './Modules/Forum/classes/class.ilForum.php';
         if ($_GET['action'] == 'ready_delete' && $_POST['confirm'] != '') {
             if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
                 $frm = new ilForum();
                 $frm->setForumId($forumObj->getId());
                 $frm->setForumRefId($forumObj->getRefId());
                 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
                 // if complete thread was deleted ...
                 if ($dead_thr == $this->objCurrentTopic->getId()) {
                     $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($forumObj->getId()));
                     $topicData = $frm->getOneTopic();
                     ilUtil::sendInfo($lng->txt('forums_post_deleted'), true);
                     if ($topicData['top_num_threads'] > 0) {
                         $this->ctrl->redirect($this, 'showThreads');
                     } else {
                         $this->ctrl->redirect($this, 'createThread');
                     }
                 }
                 ilUtil::sendInfo($lng->txt('forums_post_deleted'));
             }
         }
         // form processing (censor)
         if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'ready_censor') {
             if (($_POST['confirm'] != '' || $_POST['no_cs_change'] != '') && $_GET['action'] == 'ready_censor') {
                 $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId(), 1);
             } else {
                 if (($_POST['cancel'] != '' || $_POST['yes_cs_change'] != '') && $_GET['action'] == 'ready_censor') {
                     $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId());
                 }
             }
         }
         // get complete tree of thread
         $first_node = $this->objCurrentTopic->getFirstPostNode();
         $this->objCurrentTopic->setOrderField($orderField);
         $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
         // no posts
         if (!($posNum = count($subtree_nodes))) {
             ilUtil::sendInfo($this->lng->txt('forums_no_posts_available'));
         }
         $pageHits = $frm->getPageHits();
         $z = 0;
         // navigation to browse
         if ($posNum > $pageHits) {
             $params = array('ref_id' => $_GET['ref_id'], 'thr_pk' => $this->objCurrentTopic->getId(), 'orderby' => $_GET['orderby']);
             if (!$_GET['offset']) {
                 $Start = 0;
             } else {
                 $Start = $_GET['offset'];
             }
             $linkbar = ilUtil::Linkbar($ilCtrl->getLinkTarget($this, 'viewThread'), $posNum, $pageHits, $Start, $params);
             if ($linkbar != '') {
                 $menutpl->setCurrentBlock('linkbar');
                 $menutpl->setVariable('LINKBAR', $linkbar);
                 $menutpl->parseCurrentBlock();
             }
         }
         $tpl->setVariable('THREAD_MENU', $menutpl->get());
         // assistance val for anchor-links
         $jump = 0;
         // generate post-dates
         foreach ($subtree_nodes as $node) {
             /**
              * @var $node ilForumPost 
              */
             $this->ctrl->clearParameters($this);
             if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) {
                 $jump++;
             }
             if ($posNum > $pageHits && $z >= $Start + $pageHits) {
                 // if anchor-link was not found ...
                 if ($this->objCurrentPost->getId() && $jump < 1) {
                     $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
                     $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                     $this->ctrl->setParameter($this, 'offset', $Start + $pageHits);
                     $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                     $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId());
                     exit;
                 } else {
                     break;
                 }
             }
             if ($posNum > $pageHits && $z >= $Start || $posNum <= $pageHits) {
                 if ($this->objCurrentPost->getId() == $node->getId()) {
                     # actions for "active" post
                     if ($this->is_moderator || $node->isActivated()) {
                         // reply/edit
                         if (!$this->objCurrentTopic->isClosed() && ($_GET['action'] == 'showreply' || $_GET['action'] == 'showedit')) {
                             if ($_GET['action'] == 'showedit' && (!$this->is_moderator && !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID || $node->isCensored())) {
                                 $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
                             } else {
                                 if ($_GET['action'] == 'showreply' && !$ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id'])) {
                                     $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
                                 }
                             }
                             $tpl->setVariable('REPLY_ANKER', $this->objCurrentPost->getId());
                             $oEditReplyForm = $this->getReplyEditForm();
                             switch ($this->objProperties->getSubjectSetting()) {
                                 case 'add_re_to_subject':
                                     $subject = $this->getModifiedReOnSubject(true);
                                     break;
                                 case 'preset_subject':
                                     $subject = $this->objCurrentPost->getSubject();
                                     break;
                                 case 'empty_subject':
                                 default:
                                     $subject = NULL;
                                     break;
                             }
                             switch ($_GET['action']) {
                                 case 'showreply':
                                     if ($this->ctrl->getCmd() == 'savePost') {
                                         $oEditReplyForm->setValuesByPost();
                                     } else {
                                         if ($this->ctrl->getCmd() == 'quotePost') {
                                             require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                                             $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName());
                                             $oEditReplyForm->setValuesByPost();
                                             $oEditReplyForm->getItemByPostVar('message')->setValue(ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()) . "\n" . $oEditReplyForm->getInput('message'), 1));
                                         } else {
                                             $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $subject, 'message' => '', 'notify' => 0, 'userfile' => '', 'del_file' => array()));
                                         }
                                     }
                                     $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                                     $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
                                     $jsTpl = new ilTemplate('tpl.forum_post_quoation_ajax_handler.html', true, true, 'Modules/Forum/');
                                     $jsTpl->setVariable('IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this, 'getQuotationHTMLAsynch', '', true));
                                     $this->ctrl->clearParameters($this);
                                     $this->tpl->setVariable('FORM_ADDITIONAL_JS', $jsTpl->get());
                                     break;
                                 case 'showedit':
                                     if ($this->ctrl->getCmd() == 'savePost') {
                                         $oEditReplyForm->setValuesByPost();
                                     } else {
                                         $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $this->objCurrentPost->getSubject(), 'message' => ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($this->objCurrentPost->getMessage(), 2), 1), 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true : false, 'userfile' => '', 'del_file' => array()));
                                     }
                                     break;
                             }
                             $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'action', $_GET['action']);
                             $tpl->setVariable('FORM', $oEditReplyForm->getHTML());
                             $this->ctrl->clearParameters($this);
                         } else {
                             if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'delete') {
                                 if ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies() && $ilUser->getId() != ANONYMOUS_USER_ID) {
                                     // confirmation: delete
                                     $tpl->setVariable('FORM', $this->getDeleteFormHTML());
                                 }
                             } else {
                                 if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'censor') {
                                     if ($this->is_moderator) {
                                         // confirmation: censor / remove censorship
                                         $tpl->setVariable('FORM', $this->getCensorshipFormHTML());
                                     }
                                 } else {
                                     if (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) {
                                         if ($this->is_moderator) {
                                             // confirmation: activate
                                             $tpl->setVariable('FORM', $this->getActivationFormHTML());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 // if ($this->objCurrentPost->getId() == $node->getId())
                 if ($this->objCurrentPost->getId() != $node->getId() || $_GET['action'] != 'showreply' && $_GET['action'] != 'showedit' && $_GET['action'] != 'censor' && $_GET['action'] != 'delete' && !$this->displayConfirmPostActivation()) {
                     if ($this->is_moderator || $node->isActivated()) {
                         // button: reply
                         if (!$this->objCurrentTopic->isClosed() && $ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id']) && !$node->isCensored()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'showreply');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('reply'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: edit article
                         if (!$this->objCurrentTopic->isClosed() && ($node->isOwner($ilUser->getId()) || $this->is_moderator) && !$node->isCensored() && $ilUser->getId() != ANONYMOUS_USER_ID) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'showedit');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('edit'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: print
                         if (!$node->isCensored()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
                             $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost'));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('print'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         # buttons for every post except the "active"
                         if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
                             // button: delete
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'delete');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('delete'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
                             // button: censor
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'action', 'censor');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('censorship'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                             // button: activation/deactivation
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             if (!$node->isActivated()) {
                                 $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId()));
                                 $tpl->setVariable('COMMANDS_TXT', $lng->txt('activate_post'));
                             }
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: mark read
                         if ($ilUser->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('is_read'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         // button: mark unread
                         if ($ilUser->getId() != ANONYMOUS_USER_ID && $node->isPostRead()) {
                             $tpl->setCurrentBlock('commands');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                             $this->ctrl->setParameter($this, 'offset', $Start);
                             $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                             $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                             $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId()));
                             $tpl->setVariable('COMMANDS_TXT', $lng->txt('unread'));
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                     }
                 }
                 // if ($this->objCurrentPost->getId() != $node->getId())
                 // download post attachments
                 $tmp_file_obj = new ilFileDataForum($forumObj->getId(), $node->getId());
                 if (count($tmp_file_obj->getFilesOfPost())) {
                     if ($node->getId() != $this->objCurrentPost->getId() || $_GET['action'] != 'showedit') {
                         foreach ($tmp_file_obj->getFilesOfPost() as $file) {
                             $tpl->setCurrentBlock('attachment_download_row');
                             $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                             $this->ctrl->setParameter($this, 'file', $file['md5']);
                             $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
                             $tpl->setVariable('TXT_FILENAME', $file['name']);
                             $this->ctrl->clearParameters($this);
                             $tpl->parseCurrentBlock();
                         }
                         $tpl->setCurrentBlock('attachments');
                         $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $lng->txt('forums_attachments'));
                         include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
                         $tpl->setVariable('DOWNLOAD_IMG', ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $lng->txt('forums_download_attachment')));
                         $tpl->parseCurrentBlock();
                     }
                 }
                 $tpl->setCurrentBlock('posts_row');
                 // anker for every post
                 $tpl->setVariable('POST_ANKER', $node->getId());
                 //permanent link for every post
                 //	$tpl->setVariable('PERMA_LINK', ILIAS_HTTP_PATH."/goto.php?target="."frm"."_".$this->object->getRefId()."_".$node->getThreadId()."_".$node->getId()."&client_id=".CLIENT_ID);
                 $tpl->setVariable('TXT_PERMA_LINK', $lng->txt('perma_link'));
                 $tpl->setVariable('PERMA_TARGET', '_top');
                 if ($this->objProperties->getMarkModeratorPosts() == 1) {
                     if ($node->getIsAuthorModerator() === null && ($is_moderator = ilForum::_isModerator($_GET['ref_id'], $node->getPosAuthorId()))) {
                         $rowCol = 'ilModeratorPosting';
                     } elseif ($node->getIsAuthorModerator()) {
                         $rowCol = 'ilModeratorPosting';
                     } else {
                         $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
                     }
                 } else {
                     $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
                 }
                 if ($_GET['action'] != 'delete' && $_GET['action'] != 'censor' && !$this->displayConfirmPostActivation() || $this->objCurrentPost->getId() != $node->getId()) {
                     $tpl->setVariable('ROWCOL', ' ' . $rowCol);
                 } else {
                     // highlight censored posts
                     $rowCol = 'tblrowmarked';
                 }
                 // post is censored
                 if ($node->isCensored()) {
                     // display censorship advice
                     if ($_GET['action'] != 'censor') {
                         $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator'));
                     }
                     // highlight censored posts
                     $rowCol = 'tblrowmarked';
                 }
                 // set row color
                 $tpl->setVariable('ROWCOL', ' ' . $rowCol);
                 // if post is not activated display message for the owner
                 if (!$node->isActivated() && $node->isOwner($ilUser->getId())) {
                     $tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet'));
                 }
                 // Author
                 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                 $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
                 $this->ctrl->clearParameters($this);
                 $this->ctrl->setParameter($this, 'backurl', $backurl);
                 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                 $this->ctrl->setParameter($this, 'user', $node->getDisplayUserId());
                 require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                 $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName(), array('href' => $this->ctrl->getLinkTarget($this, 'showUser')));
                 $this->ctrl->clearParameters($this);
                 if ($authorinfo->hasSuffix()) {
                     $tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
                     $tpl->setVariable('USR_NAME', $node->getUserAlias());
                 } else {
                     $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
                     if ($authorinfo->getAuthorName(true)) {
                         $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
                     }
                 }
                 $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
                 if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $node->getPosAuthorId())) {
                     if ($authorinfo->getAuthor()->getGender() == 'f') {
                         $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f'));
                     } else {
                         if ($authorinfo->getAuthor()->getGender() == 'm') {
                             $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m'));
                         }
                     }
                 }
                 // get create- and update-dates
                 if ($node->getUpdateUserId() > 0) {
                     $spanClass = '';
                     // last update from moderator?
                     $posMod = $frm->getModeratorFromPost($node->getId());
                     if (is_array($posMod) && $posMod['top_mods'] > 0) {
                         $MODS = $rbacreview->assignedUsers($posMod['top_mods']);
                         if (is_array($MODS)) {
                             if (in_array($node->getUpdateUserId(), $MODS)) {
                                 $spanClass = 'moderator_small';
                             }
                         }
                     }
                     $node->setChangeDate($node->getChangeDate());
                     if ($spanClass == '') {
                         $spanClass = 'small';
                     }
                     $this->ctrl->setParameter($this, 'backurl', $backurl);
                     $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                     $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId());
                     require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
                     $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getUpdateUserId(), '', '', array('href' => $this->ctrl->getLinkTarget($this, 'showUser')));
                     $this->ctrl->clearParameters($this);
                     $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($lng->txt('by')));
                     $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
                     if ($authorinfo->getAuthorName(true)) {
                         $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
                     }
                 }
                 // if ($node->getUpdateUserId() > 0)*/
                 // Author end
                 // prepare post
                 $node->setMessage($frm->prepareText($node->getMessage()));
                 if ($ilUser->getId() == ANONYMOUS_USER_ID || $node->isPostRead()) {
                     $tpl->setVariable('SUBJECT', $node->getSubject());
                 } else {
                     $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
                     $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
                     $this->ctrl->setParameter($this, 'offset', $Start);
                     $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
                     $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
                     $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
                     $tpl->setVariable('SUBJECT', "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>");
                 }
                 $tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate()));
                 if (!$node->isCensored() || $this->objCurrentPost->getId() == $node->getId() && $_GET['action'] == 'censor') {
                     // post from moderator?
                     $modAuthor = $frm->getModeratorFromPost($node->getId());
                     $spanClass = "";
                     if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) {
                         unset($MODS);
                         $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']);
                         if (is_array($MODS)) {
                             if (in_array($node->getDisplayUserId(), $MODS)) {
                                 $spanClass = 'moderator';
                             }
                         }
                     }
                     // possible bugfix for mantis #8223
                     if ($node->getMessage() == strip_tags($node->getMessage())) {
                         // We can be sure, that there are not html tags
                         $node->setMessage(nl2br($node->getMessage()));
                     }
                     if ($spanClass != "") {
                         $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1) . "</span>");
                     } else {
                         $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1));
                     }
                 } else {
                     $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>");
                 }
                 $tpl->parseCurrentBlock();
             }
             $z++;
         }
     } else {
         $tpl->setCurrentBlock('posts_no');
         $tpl->setVariable('TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt('forums_posts_not_available'));
         $tpl->parseCurrentBlock();
     }
     $oThreadToolbar = clone $ilToolbar;
     $oThreadToolbar->addSeparator();
     $oThreadToolbar->addButton($this->lng->txt('top_of_page'), '#frm_page_top');
     $tpl->setVariable('THREAD_TOOLBAR', $oThreadToolbar->getHTML());
     $tpl->setVariable('TPLPATH', $tpl->vars['TPLPATH']);
     // permanent link
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId(), '_' . $this->objCurrentTopic->getId());
     $this->tpl->setVariable('PRMLINK', $permalink->getHTML());
     // Render tree
     if ($_SESSION['viewmode'] == 'answers' || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
         $tpl->setLeftNavContent($this->getForumExplorer());
     }
     return true;
 }
 /**
  * Shows all made bookings.
  *
  * @global type $tpl
  */
 function showBookingsObject()
 {
     $toolbar = new ilToolbarGUI();
     if ($this->permission->checkPrivilege(PRIVC::ADD_OWN_BOOKINGS)) {
         $toolbar->addButton($this->lng->txt('rep_robj_xrs_booking_add'), $this->ctrl->getLinkTargetByClass("ilobjroomsharinggui", "showSearch"));
     }
     include_once "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/appointments/bookings/class.ilRoomSharingBookingsTableGUI.php";
     $bookingsTable = new ilRoomSharingBookingsTableGUI($this, 'showBookings', $this->ref_id);
     $bookingsTable->initFilter();
     $bookingsTable->getItems();
     $plink = new ilPermanentLinkGUI('xrs', $this->ref_id);
     $this->tpl->setContent($toolbar->getHTML() . $bookingsTable->getHTML() . $plink->getHTML());
 }
 /**
  * showRecord
  * a_val = 
  */
 public function renderRecord()
 {
     global $ilTabs, $tpl, $ilCtrl, $lng;
     $rctpl = new ilTemplate("tpl.record_view.html", true, true, "Modules/DataCollection");
     $ilTabs->setTabActive("id_content");
     $view_id = self::_getViewDefinitionId($this->record_obj);
     if (!$view_id) {
         $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
     }
     // please do not use ilPageObjectGUI directly here, use derived class
     // ilDataCollectionRecordViewViewdefinitionGUI
     //$pageObj = new ilPageObjectGUI("dclf", $view_id);
     // see ilObjDataCollectionGUI->executeCommand about instantiation
     include_once "./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php";
     $pageObj = new ilDataCollectionRecordViewViewdefinitionGUI($this->record_obj->getTableId(), $view_id);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl"));
     $html = $pageObj->getHTML();
     $rctpl->addCss("./Services/COPage/css/content.css");
     $rctpl->fillCssFiles();
     $table = ilDataCollectionCache::getTableCache($this->record_obj->getTableId());
     foreach ($table->getFields() as $field) {
         //ILIAS_Ref_Links
         $pattern = '/\\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dcliln\\]/';
         if (preg_match($pattern, $html)) {
             $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("\$1")), $html);
         }
         //DataCollection Ref Links
         $pattern = '/\\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dclrefln\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doReplace"), $html);
         }
         $pattern = '/\\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\\]/';
         if (preg_match($pattern, $html)) {
             $this->currentField = $field;
             $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html);
         }
         $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldHTML($field->getId()), $html);
     }
     $rctpl->setVariable("CONTENT", $html);
     //Permanent Link
     include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
     $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $_GET['record_id']);
     $rctpl->setVariable("PERMA_LINK", $perma_link->getHTML());
     $tpl->setContent($rctpl->get());
 }